From c7f122d637ba24350ab7b5aee14ef258399083bd Mon Sep 17 00:00:00 2001 From: Babacar Ndoye Date: Thu, 18 May 2023 11:18:43 -0500 Subject: [PATCH 01/21] Rush config files --- common/config/rush/pnpm-lock.yaml | 52 +++++++++++++++++++++++++++++-- rush.json | 5 +++ 2 files changed, 54 insertions(+), 3 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 0dbcd7699241..0de51ea6dfd5 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -233,6 +233,7 @@ specifiers: '@rush-temp/communication-rooms': file:./projects/communication-rooms.tgz '@rush-temp/communication-short-codes': file:./projects/communication-short-codes.tgz '@rush-temp/communication-sms': file:./projects/communication-sms.tgz + '@rush-temp/communication-tiering': file:./projects/communication-tiering.tgz '@rush-temp/communication-toll-free-verification': file:./projects/communication-toll-free-verification.tgz '@rush-temp/confidential-ledger': file:./projects/confidential-ledger.tgz '@rush-temp/container-registry': file:./projects/container-registry.tgz @@ -573,6 +574,7 @@ dependencies: '@rush-temp/communication-rooms': file:projects/communication-rooms.tgz '@rush-temp/communication-short-codes': file:projects/communication-short-codes.tgz '@rush-temp/communication-sms': file:projects/communication-sms.tgz + '@rush-temp/communication-tiering': file:projects/communication-tiering.tgz '@rush-temp/communication-toll-free-verification': file:projects/communication-toll-free-verification.tgz '@rush-temp/confidential-ledger': file:projects/confidential-ledger.tgz '@rush-temp/container-registry': file:projects/container-registry.tgz @@ -3771,7 +3773,7 @@ packages: dependencies: semver: 7.5.0 shelljs: 0.8.5 - typescript: 5.1.0-dev.20230512 + typescript: 5.2.0-dev.20230517 dev: false /ecdsa-sig-formatter/1.0.11: @@ -8315,8 +8317,8 @@ packages: hasBin: true dev: false - /typescript/5.1.0-dev.20230512: - resolution: {integrity: sha512-b0Naij+j/zOXP1SQzlvqlOh60vHqwsGoifrXLOHZ4KSSnbi+0herOKPJ4TTp+tV2K7P/UddA3T67kyt870Y07A==} + /typescript/5.2.0-dev.20230517: + resolution: {integrity: sha512-mTT3ka5HTeudnNirocnOfr/0d2CEvZExrJpP8YXqAvdwlwjwNPJ4TqHHiL1y9lx3RfsUWu6HSX539ZxngUTqeA==} engines: {node: '>=14.17'} hasBin: true dev: false @@ -15776,6 +15778,50 @@ packages: - utf-8-validate dev: false + file:projects/communication-tiering.tgz: + resolution: {integrity: sha512-zym5Gh8ntlYl6yvsJHNwMGkrr/JVyK155DZjK/JEurf7RHz8MBzHEP4dVzUeqgruDhZy5+1uhwpedlNbZnNtwg==, tarball: file:projects/communication-tiering.tgz} + name: '@rush-temp/communication-tiering' + version: 0.0.0 + dependencies: + '@azure/communication-common': 2.2.0 + '@azure/identity': 2.1.0 + '@microsoft/api-extractor': 7.34.8_@types+node@14.18.46 + '@types/chai': 4.3.5 + '@types/mocha': 7.0.2 + '@types/node': 14.18.46 + '@types/sinon': 9.0.11 + '@types/uuid': 8.3.4 + chai: 4.3.7 + cross-env: 7.0.3 + dotenv: 16.0.3 + eslint: 8.40.0 + events: 3.3.0 + inherits: 2.0.4 + karma: 6.4.2 + karma-chrome-launcher: 3.2.0 + karma-coverage: 2.2.0 + karma-env-preprocessor: 0.1.1 + karma-firefox-launcher: 1.3.0 + karma-junit-reporter: 2.0.1_karma@6.4.2 + karma-mocha: 2.0.1 + karma-mocha-reporter: 2.2.5_karma@6.4.2 + karma-sourcemap-loader: 0.3.8 + mocha: 7.2.0 + mocha-junit-reporter: 2.2.0_mocha@7.2.0 + nyc: 15.1.0 + prettier: 2.8.8 + rimraf: 3.0.2 + sinon: 9.2.4 + tslib: 2.5.0 + typescript: 5.0.4 + uuid: 8.3.2 + transitivePeerDependencies: + - bufferutil + - debug + - supports-color + - utf-8-validate + dev: false + file:projects/communication-toll-free-verification.tgz: resolution: {integrity: sha512-tEbb2X57aezkEjuGn0Sfggw8Jv9ln+5DvZPp307DJuYODDtUqm6gjkBDdPqJgKMrOTsIsERq+DG5ndKlWok6QQ==, tarball: file:projects/communication-toll-free-verification.tgz} name: '@rush-temp/communication-toll-free-verification' diff --git a/rush.json b/rush.json index abc73181726c..153a933e53db 100644 --- a/rush.json +++ b/rush.json @@ -450,6 +450,11 @@ "projectFolder": "sdk/communication/communication-recipient-verification", "versionPolicyName": "client" }, + { + "packageName": "@azure-tools/communication-tiering", + "projectFolder": "sdk/communication/communication-tiering", + "versionPolicyName": "client" + }, { "packageName": "@azure-tools/communication-alpha-ids", "projectFolder": "sdk/communication/communication-alpha-ids", From 177029064995511fb7bdf35202cb935ceec65db4 Mon Sep 17 00:00:00 2001 From: Babacar Ndoye Date: Thu, 18 May 2023 11:18:54 -0500 Subject: [PATCH 02/21] SDK for tiering --- .../communication-tiering/api-extractor.json | 35 ++++ .../communication-tiering/karma.conf.js | 129 ++++++++++++ .../communication-tiering/package.json | 139 ++++++++++++ .../review/communication-tiering.api.md | 65 ++++++ .../communication-tiering/sample.env | 3 + .../samples-dev/getAcquiredNumberLimits.ts | 39 ++++ .../samples/v1-beta/javascript/README.md | 63 ++++++ .../javascript/getAcquiredNumberLimits.js | 40 ++++ .../samples/v1-beta/javascript/package.json | 29 +++ .../samples/v1-beta/javascript/sample.env | 3 + .../samples/v1-beta/typescript/README.md | 76 +++++++ .../samples/v1-beta/typescript/package.json | 38 ++++ .../samples/v1-beta/typescript/sample.env | 3 + .../typescript/src/getAcquiredNumberLimits.ts | 39 ++++ .../samples/v1-beta/typescript/tsconfig.json | 17 ++ .../src/generated/src/index.ts | 11 + .../src/generated/src/models/index.ts | 82 ++++++++ .../src/generated/src/models/mappers.ts | 159 ++++++++++++++ .../src/generated/src/models/parameters.ts | 60 ++++++ .../src/generated/src/operations/index.ts | 9 + .../src/operations/numberAllotment.ts | 76 +++++++ .../src/operationsInterfaces/index.ts | 9 + .../operationsInterfaces/numberAllotment.ts | 25 +++ .../src/generated/src/tieringClient.ts | 118 +++++++++++ .../src/generated/src/tracing.ts | 15 ++ .../communication-tiering/src/index.ts | 6 + .../communication-tiering/src/mapper.ts | 5 + .../communication-tiering/src/models.ts | 10 + .../src/tieringClient.ts | 101 +++++++++ .../src/utils/constants.ts | 4 + .../communication-tiering/src/utils/index.ts | 5 + .../communication-tiering/src/utils/logger.ts | 9 + .../communication-tiering/swagger/README.md | 50 +++++ .../swagger/swagger.json | 198 ++++++++++++++++++ .../communication-tiering/tests.yml | 22 ++ .../communication-tiering/tsconfig.json | 11 + 36 files changed, 1703 insertions(+) create mode 100644 sdk/communication/communication-tiering/api-extractor.json create mode 100644 sdk/communication/communication-tiering/karma.conf.js create mode 100644 sdk/communication/communication-tiering/package.json create mode 100644 sdk/communication/communication-tiering/review/communication-tiering.api.md create mode 100644 sdk/communication/communication-tiering/sample.env create mode 100644 sdk/communication/communication-tiering/samples-dev/getAcquiredNumberLimits.ts create mode 100644 sdk/communication/communication-tiering/samples/v1-beta/javascript/README.md create mode 100644 sdk/communication/communication-tiering/samples/v1-beta/javascript/getAcquiredNumberLimits.js create mode 100644 sdk/communication/communication-tiering/samples/v1-beta/javascript/package.json create mode 100644 sdk/communication/communication-tiering/samples/v1-beta/javascript/sample.env create mode 100644 sdk/communication/communication-tiering/samples/v1-beta/typescript/README.md create mode 100644 sdk/communication/communication-tiering/samples/v1-beta/typescript/package.json create mode 100644 sdk/communication/communication-tiering/samples/v1-beta/typescript/sample.env create mode 100644 sdk/communication/communication-tiering/samples/v1-beta/typescript/src/getAcquiredNumberLimits.ts create mode 100644 sdk/communication/communication-tiering/samples/v1-beta/typescript/tsconfig.json create mode 100644 sdk/communication/communication-tiering/src/generated/src/index.ts create mode 100644 sdk/communication/communication-tiering/src/generated/src/models/index.ts create mode 100644 sdk/communication/communication-tiering/src/generated/src/models/mappers.ts create mode 100644 sdk/communication/communication-tiering/src/generated/src/models/parameters.ts create mode 100644 sdk/communication/communication-tiering/src/generated/src/operations/index.ts create mode 100644 sdk/communication/communication-tiering/src/generated/src/operations/numberAllotment.ts create mode 100644 sdk/communication/communication-tiering/src/generated/src/operationsInterfaces/index.ts create mode 100644 sdk/communication/communication-tiering/src/generated/src/operationsInterfaces/numberAllotment.ts create mode 100644 sdk/communication/communication-tiering/src/generated/src/tieringClient.ts create mode 100644 sdk/communication/communication-tiering/src/generated/src/tracing.ts create mode 100644 sdk/communication/communication-tiering/src/index.ts create mode 100644 sdk/communication/communication-tiering/src/mapper.ts create mode 100644 sdk/communication/communication-tiering/src/models.ts create mode 100644 sdk/communication/communication-tiering/src/tieringClient.ts create mode 100644 sdk/communication/communication-tiering/src/utils/constants.ts create mode 100644 sdk/communication/communication-tiering/src/utils/index.ts create mode 100644 sdk/communication/communication-tiering/src/utils/logger.ts create mode 100644 sdk/communication/communication-tiering/swagger/README.md create mode 100644 sdk/communication/communication-tiering/swagger/swagger.json create mode 100644 sdk/communication/communication-tiering/tests.yml create mode 100644 sdk/communication/communication-tiering/tsconfig.json diff --git a/sdk/communication/communication-tiering/api-extractor.json b/sdk/communication/communication-tiering/api-extractor.json new file mode 100644 index 000000000000..f326ea93930c --- /dev/null +++ b/sdk/communication/communication-tiering/api-extractor.json @@ -0,0 +1,35 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "types/src/index.d.ts", + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/communication-tiering.d.ts" + }, + "messages": { + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, + "extractorMessageReporting": { + "ae-forgotten-export": { + "logLevel": "error", + "addToApiReportFile": false + }, + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "error" + } + } + } +} diff --git a/sdk/communication/communication-tiering/karma.conf.js b/sdk/communication/communication-tiering/karma.conf.js new file mode 100644 index 000000000000..b7223a7f2b76 --- /dev/null +++ b/sdk/communication/communication-tiering/karma.conf.js @@ -0,0 +1,129 @@ +// https://github.com/karma-runner/karma-chrome-launcher +process.env.CHROME_BIN = require("puppeteer").executablePath(); +require("dotenv").config(); +const { relativeRecordingsPath } = require("@azure-tools/test-recorder"); + +process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath(); +module.exports = function (config) { + config.set({ + // base path that will be used to resolve all patterns (eg. files, exclude) + basePath: "./", + + // frameworks to use + // available frameworks: https://npmjs.org/browse/keyword/karma-adapter + frameworks: ["mocha"], + + plugins: [ + "karma-mocha", + "karma-mocha-reporter", + "karma-chrome-launcher", + "karma-firefox-launcher", + "karma-env-preprocessor", + "karma-coverage", + "karma-sourcemap-loader", + "karma-junit-reporter", + ], + + // list of files / patterns to load in the browser + files: ["dist-test/index.browser.js"], + + // list of files / patterns to exclude + exclude: [], + + // preprocess matching files before serving them to the browser + // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor + preprocessors: { + "**/*.js": ["sourcemap", "env"], + // IMPORTANT: COMMENT following line if you want to debug in your browsers!! + // Preprocess source file to calculate code coverage, however this will make source file unreadable + //"dist-test/index.browser.js": ["coverage"] + }, + + // inject following environment values into browser testing with window.__env__ + // environment values MUST be exported or set with same console running "karma start" + // https://www.npmjs.com/package/karma-env-preprocessor + envPreprocessor: [ + "TEST_MODE", + "COMMUNICATION_LIVETEST_STATIC_CONNECTION_STRING", + "INCLUDE_PHONENUMBER_LIVE_TESTS", + "AZURE_PHONE_NUMBER", + "COMMUNICATION_ENDPOINT", + "AZURE_CLIENT_ID", + "AZURE_CLIENT_SECRET", + "AZURE_TENANT_ID", + "COMMUNICATION_SKIP_INT_PHONENUMBERS_TESTS", + "RECORDINGS_RELATIVE_PATH", + ], + + // test results reporter to use + // possible values: 'dots', 'progress' + // available reporters: https://npmjs.org/browse/keyword/karma-reporter + reporters: ["mocha", "coverage", "junit"], + + coverageReporter: { + // specify a common output directory + dir: "coverage-browser/", + reporters: [ + { type: "json", subdir: ".", file: "coverage.json" }, + { type: "lcovonly", subdir: ".", file: "lcov.info" }, + { type: "html", subdir: "html" }, + { type: "cobertura", subdir: ".", file: "cobertura-coverage.xml" }, + ], + }, + + junitReporter: { + outputDir: "", // results will be saved as $outputDir/$browserName.xml + outputFile: "test-results.browser.xml", // if included, results will be saved as $outputDir/$browserName/$outputFile + suite: "", // suite will become the package name attribute in xml testsuite element + useBrowserName: false, // add browser name to report and classes names + nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element + classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element + properties: {}, // key value pair of properties to add to the section of the report + }, + + // web server port + port: 9876, + + // enable / disable colors in the output (reporters and logs) + colors: true, + + // level of logging + // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG + logLevel: config.LOG_INFO, + + // enable / disable watching file and executing tests whenever any file changes + autoWatch: false, + + // start these browsers + // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher + // 'ChromeHeadless', 'Chrome', 'Firefox', 'Edge', 'IE' + browsers: ["HeadlessChrome"], + + customLaunchers: { + HeadlessChrome: { + base: "ChromeHeadless", + flags: ["--no-sandbox", "--disable-web-security"], + }, + }, + + // Continuous Integration mode + // if true, Karma captures browsers, runs the tests and exits + singleRun: true, + + // Concurrency level + // how many browser should be started simultaneous + concurrency: 1, + + browserNoActivityTimeout: 600000, + browserDisconnectTimeout: 10000, + browserDisconnectTolerance: 3, + + client: { + mocha: { + // change Karma's debug.html to the mocha web reporter + reporter: "html", + timeout: "600000", + }, + }, + }); +}; diff --git a/sdk/communication/communication-tiering/package.json b/sdk/communication/communication-tiering/package.json new file mode 100644 index 000000000000..ea4271a25ccc --- /dev/null +++ b/sdk/communication/communication-tiering/package.json @@ -0,0 +1,139 @@ +{ + "name": "@azure-tools/communication-tiering", + "version": "1.0.0-beta.0", + "description": "Test", + "sdk-type": "client", + "main": "dist/index.js", + "module": "dist-esm/src/index.js", + "types": "types/communication-tiering.d.ts", + "scripts": { + "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", + "build": "npm run clean && tsc -p . && dev-tool run bundle && api-extractor run --local", + "build:autorest": "autorest --typescript ./swagger/README.md && rushx format", + "build:clean": "rush update --recheck && rush rebuild && npm run build", + "build:browser": "tsc -p . && dev-tool run bundle", + "build:node": "tsc -p . && dev-tool run bundle", + "build:samples": "dev-tool samples publish --force", + "build:test": "tsc -p . && dev-tool run bundle", + "check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"", + "clean": "rimraf dist dist-* types *.tgz *.log", + "execute:samples": "dev-tool samples run samples-dev", + "extract-api": "tsc -p . && api-extractor run --local", + "format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"", + "integration-test:browser": "dev-tool run test:browser", + "integration-test:node": "dev-tool run test:node-js-input -- --timeout 300000 'dist-esm/test/public/*.spec.js'", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "lint:fix": "eslint package.json api-extractor.json README.md src test --ext .ts,.javascript,.js --fix --fix-type [problem,suggestion]", + "lint": "eslint package.json api-extractor.json README.md src test --ext .ts,.javascript,.js", + "pack": "npm pack 2>&1", + "test": "rimraf dist-test && npm run build:test && npm run unit-test && npm run integration-test", + "test:browser": "npm run build:test && npm run unit-test:browser && npm run integration-test:browser", + "test:node": "npm run build:test && npm run unit-test:node && npm run integration-test:node", + "test:watch": "npm run test -- --watch --reporter min", + "unit-test:browser": "dev-tool run test:browser", + "unit-test:node": "dev-tool run test:node-ts-input -- --exclude 'test/**/browser/*.spec.ts' 'test/**/*.spec.ts'", + "unit-test": "npm run unit-test:node && npm run unit-test:browser" + }, + "files": [ + "dist/", + "dist-esm/src/", + "types/communication-tiering.d.ts", + "README.md", + "LICENSE" + ], + "keywords": [ + "azure", + "cloud", + "communication" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/communication/communication-tiering/", + "repository": "github:Azure/azure-sdk-for-js", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "sideEffects": false, + "prettier": "@azure/eslint-plugin-azure-sdk/prettier.json", + "dependencies": { + "@azure/abort-controller": "^1.0.0", + "@azure/communication-common": "^2.2.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-client": "^1.3.2", + "@azure/core-lro": "^2.2.0", + "@azure/core-paging": "^1.1.1", + "@azure/core-rest-pipeline": "^1.3.2", + "@azure/core-tracing": "^1.0.0", + "@azure/logger": "^1.0.0", + "events": "^3.0.0", + "tslib": "^2.2.0", + "uuid": "^8.3.2" + }, + "devDependencies": { + "@azure-tools/test-recorder": "^3.0.0", + "@azure/dev-tool": "^1.0.0", + "@azure/eslint-plugin-azure-sdk": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure/test-utils": "^1.0.0", + "@microsoft/api-extractor": "^7.31.1", + "@types/chai": "^4.1.6", + "@types/mocha": "^7.0.2", + "@types/node": "^14.0.0", + "@types/sinon": "^9.0.4", + "@types/uuid": "^8.3.2", + "chai": "^4.2.0", + "cross-env": "^7.0.2", + "dotenv": "^16.0.0", + "eslint": "^8.0.0", + "inherits": "^2.0.3", + "karma": "^6.2.0", + "karma-chrome-launcher": "^3.0.0", + "karma-coverage": "^2.0.0", + "karma-env-preprocessor": "^0.1.1", + "karma-firefox-launcher": "^1.1.0", + "karma-junit-reporter": "^2.0.1", + "karma-mocha": "^2.0.1", + "karma-mocha-reporter": "^2.2.5", + "karma-sourcemap-loader": "^0.3.8", + "mocha": "^7.1.1", + "mocha-junit-reporter": "^2.0.0", + "nyc": "^15.0.0", + "prettier": "^2.5.1", + "rimraf": "^3.0.0", + "sinon": "^9.0.2", + "typescript": "~5.0.0" + }, + "//metadata": { + "constantPaths": [ + { + "path": "src/generated/src/tieringClient.ts", + "prefix": "packageDetails" + }, + { + "path": "src/generated/src/tracing.ts", + "prefix": "packageVersion" + }, + { + "path": "src/utils/constants.ts", + "prefix": "SDK_VERSION" + }, + { + "path": "swagger/README.md", + "prefix": "package-version" + } + ] + }, + "//sampleConfiguration": { + "productName": "Azure Communication Services - Tiering", + "productSlugs": [ + "azure", + "azure-communication-services" + ], + "requiredResources": { + "Azure Communication Services account": "https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource" + } + } +} diff --git a/sdk/communication/communication-tiering/review/communication-tiering.api.md b/sdk/communication/communication-tiering/review/communication-tiering.api.md new file mode 100644 index 000000000000..570711a7bd99 --- /dev/null +++ b/sdk/communication/communication-tiering/review/communication-tiering.api.md @@ -0,0 +1,65 @@ +## API Report File for "@azure-tools/communication-tiering" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +/// + +import { CommonClientOptions } from '@azure/core-client'; +import * as coreClient from '@azure/core-client'; +import { KeyCredential } from '@azure/core-auth'; +import { TokenCredential } from '@azure/core-auth'; + +// @public +export interface AssetDetails { + aadTenantAcquiredCount?: number; + numberType?: string[]; + resourceAcquiredCount?: number; + subscriptionAcquiredCount?: number; + tierInfo?: AssetDetailsTierInfo; +} + +// @public (undocumented) +export const AssetDetailsMapper: coreClient.CompositeMapper; + +// @public +export interface AssetDetailsTierInfo { + acquired?: number; + allowed?: number; + balance?: number; + limit?: string; + scope?: string; +} + +// @public (undocumented) +export const AssetDetailsTierInfoMapper: coreClient.CompositeMapper; + +// @public +export interface NumberAllotmentGetAcquiredNumberLimitsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type NumberAllotmentGetAcquiredNumberLimitsResponse = AssetDetails[]; + +// @public +export class TieringClient { + constructor(connectionString: string, options?: TieringClientOptions); + constructor(endpoint: string, credential: KeyCredential, options?: TieringClientOptions); + constructor(endpoint: string, credential: TokenCredential, options?: TieringClientOptions); + getAcquiredNumberLimits(resourceId: string, options?: NumberAllotmentGetAcquiredNumberLimitsOptionalParams): Promise; +} + +// @public +export interface TieringClientOptionalParams extends coreClient.ServiceClientOptions { + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface TieringClientOptions extends CommonClientOptions { +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/communication/communication-tiering/sample.env b/sdk/communication/communication-tiering/sample.env new file mode 100644 index 000000000000..ecc5467f2006 --- /dev/null +++ b/sdk/communication/communication-tiering/sample.env @@ -0,0 +1,3 @@ +# Used in most samples. Retrieve these values from a Communication Services instance +# in the Azure Portal. +COMMUNICATION_SAMPLES_CONNECTION_STRING="endpoint=https://.communication.azure.net/;accessKey=" diff --git a/sdk/communication/communication-tiering/samples-dev/getAcquiredNumberLimits.ts b/sdk/communication/communication-tiering/samples-dev/getAcquiredNumberLimits.ts new file mode 100644 index 000000000000..ef13c7872de9 --- /dev/null +++ b/sdk/communication/communication-tiering/samples-dev/getAcquiredNumberLimits.ts @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Get acquired numbers and limits for a resource + */ + +import { TieringClient } from "@azure-tools/communication-tiering"; + +// Load the .env file if it exists +import * as dotenv from "dotenv"; +dotenv.config(); + +export async function main() { + console.log("\n== Get acquired numbers and limits for a resource ==\n"); + + // You will need to set this environment variable or edit the following values + const connectionString = + process.env.COMMUNICATION_SAMPLES_CONNECTION_STRING || + "endpoint=https://resourceName.communication.azure.net/;accessKey=test-key"; + + // create new client + const client = new TieringClient(connectionString); + + const resourceId = "5d41e908-de88-4bbf-94dc-fe9a1b51029b"; + + // Get acquired numbers and limits for a resource + var acquiredNumberLimits = await client.getAcquiredNumberLimits(resourceId); + + // print all number limits + for await (const limit of acquiredNumberLimits) { + console.log(limit); + } +} + +main().catch((error) => { + console.log("The sample getAcquiredNumberLimits encountered an error:", error); + process.exit(1); +}); diff --git a/sdk/communication/communication-tiering/samples/v1-beta/javascript/README.md b/sdk/communication/communication-tiering/samples/v1-beta/javascript/README.md new file mode 100644 index 000000000000..8005413a7e39 --- /dev/null +++ b/sdk/communication/communication-tiering/samples/v1-beta/javascript/README.md @@ -0,0 +1,63 @@ +--- +page_type: sample +languages: + - javascript +products: + - azure + - azure-communication-services +urlFragment: communication-tiering-javascript-beta +--- + +# Azure Communication Services - Tiering client library samples for JavaScript (Beta) + +These sample programs show how to use the JavaScript client libraries for Azure Communication Services - Tiering in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------- | ---------------------------------------------- | +| [getAcquiredNumberLimits.js][getacquirednumberlimits] | Get acquired numbers and limits for a resource | + +## 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] and the following Azure resources to run these sample programs: + +- [Azure Communication Services account][createinstance_azurecommunicationservicesaccount] + +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 getAcquiredNumberLimits.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 cross-env COMMUNICATION_SAMPLES_CONNECTION_STRING="" node getAcquiredNumberLimits.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[getacquirednumberlimits]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/communication/communication-tiering/samples/v1-beta/javascript/getAcquiredNumberLimits.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/communication-tiering +[freesub]: https://azure.microsoft.com/free/ +[createinstance_azurecommunicationservicesaccount]: https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/communication/communication-tiering/README.md diff --git a/sdk/communication/communication-tiering/samples/v1-beta/javascript/getAcquiredNumberLimits.js b/sdk/communication/communication-tiering/samples/v1-beta/javascript/getAcquiredNumberLimits.js new file mode 100644 index 000000000000..11523219c740 --- /dev/null +++ b/sdk/communication/communication-tiering/samples/v1-beta/javascript/getAcquiredNumberLimits.js @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Get acquired numbers and limits for a resource + */ + +const { TieringClient } = require("@azure-tools/communication-tiering"); + +// Load the .env file if it exists +require("dotenv").config(); + +async function main() { + console.log("\n== Get acquired numbers and limits for a resource ==\n"); + + // You will need to set this environment variable or edit the following values + const connectionString = + process.env.COMMUNICATION_SAMPLES_CONNECTION_STRING || + "endpoint=https://resourceName.communication.azure.net/;accessKey=test-key"; + + // create new client + const client = new TieringClient(connectionString); + + const resourceId = "5d41e908-de88-4bbf-94dc-fe9a1b51029b"; + + // Get acquired numbers and limits for a resource + var acquiredNumberLimits = await client.getAcquiredNumberLimits(resourceId); + + // print all number limits + for await (const limit of acquiredNumberLimits) { + console.log(limit); + } +} + +main().catch((error) => { + console.log("The sample getAcquiredNumberLimits encountered an error:", error); + process.exit(1); +}); + +module.exports = { main }; diff --git a/sdk/communication/communication-tiering/samples/v1-beta/javascript/package.json b/sdk/communication/communication-tiering/samples/v1-beta/javascript/package.json new file mode 100644 index 000000000000..679d3a30ba9c --- /dev/null +++ b/sdk/communication/communication-tiering/samples/v1-beta/javascript/package.json @@ -0,0 +1,29 @@ +{ + "name": "@azure-samples/communication-tiering-js-beta", + "private": true, + "version": "1.0.0", + "description": "Azure Communication Services - Tiering client library samples for JavaScript (Beta)", + "engines": { + "node": ">=14.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/communication/communication-tiering" + }, + "keywords": [ + "azure", + "cloud", + "communication" + ], + "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/communication/communication-tiering", + "dependencies": { + "@azure-tools/communication-tiering": "next", + "dotenv": "latest" + } +} diff --git a/sdk/communication/communication-tiering/samples/v1-beta/javascript/sample.env b/sdk/communication/communication-tiering/samples/v1-beta/javascript/sample.env new file mode 100644 index 000000000000..ecc5467f2006 --- /dev/null +++ b/sdk/communication/communication-tiering/samples/v1-beta/javascript/sample.env @@ -0,0 +1,3 @@ +# Used in most samples. Retrieve these values from a Communication Services instance +# in the Azure Portal. +COMMUNICATION_SAMPLES_CONNECTION_STRING="endpoint=https://.communication.azure.net/;accessKey=" diff --git a/sdk/communication/communication-tiering/samples/v1-beta/typescript/README.md b/sdk/communication/communication-tiering/samples/v1-beta/typescript/README.md new file mode 100644 index 000000000000..d4b0c7141645 --- /dev/null +++ b/sdk/communication/communication-tiering/samples/v1-beta/typescript/README.md @@ -0,0 +1,76 @@ +--- +page_type: sample +languages: + - typescript +products: + - azure + - azure-communication-services +urlFragment: communication-tiering-typescript-beta +--- + +# Azure Communication Services - Tiering client library samples for TypeScript (Beta) + +These sample programs show how to use the TypeScript client libraries for Azure Communication Services - Tiering in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------- | ---------------------------------------------- | +| [getAcquiredNumberLimits.ts][getacquirednumberlimits] | Get acquired numbers and limits for a resource | + +## 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] and the following Azure resources to run these sample programs: + +- [Azure Communication Services account][createinstance_azurecommunicationservicesaccount] + +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/getAcquiredNumberLimits.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 cross-env COMMUNICATION_SAMPLES_CONNECTION_STRING="" node dist/getAcquiredNumberLimits.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[getacquirednumberlimits]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/communication/communication-tiering/samples/v1-beta/typescript/src/getAcquiredNumberLimits.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/communication-tiering +[freesub]: https://azure.microsoft.com/free/ +[createinstance_azurecommunicationservicesaccount]: https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/communication/communication-tiering/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/communication/communication-tiering/samples/v1-beta/typescript/package.json b/sdk/communication/communication-tiering/samples/v1-beta/typescript/package.json new file mode 100644 index 000000000000..f85a2c56c316 --- /dev/null +++ b/sdk/communication/communication-tiering/samples/v1-beta/typescript/package.json @@ -0,0 +1,38 @@ +{ + "name": "@azure-samples/communication-tiering-ts-beta", + "private": true, + "version": "1.0.0", + "description": "Azure Communication Services - Tiering client library samples for TypeScript (Beta)", + "engines": { + "node": ">=14.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/communication/communication-tiering" + }, + "keywords": [ + "azure", + "cloud", + "communication" + ], + "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/communication/communication-tiering", + "dependencies": { + "@azure-tools/communication-tiering": "next", + "dotenv": "latest" + }, + "devDependencies": { + "@types/node": "^14.0.0", + "typescript": "~5.0.0", + "rimraf": "latest" + } +} diff --git a/sdk/communication/communication-tiering/samples/v1-beta/typescript/sample.env b/sdk/communication/communication-tiering/samples/v1-beta/typescript/sample.env new file mode 100644 index 000000000000..ecc5467f2006 --- /dev/null +++ b/sdk/communication/communication-tiering/samples/v1-beta/typescript/sample.env @@ -0,0 +1,3 @@ +# Used in most samples. Retrieve these values from a Communication Services instance +# in the Azure Portal. +COMMUNICATION_SAMPLES_CONNECTION_STRING="endpoint=https://.communication.azure.net/;accessKey=" diff --git a/sdk/communication/communication-tiering/samples/v1-beta/typescript/src/getAcquiredNumberLimits.ts b/sdk/communication/communication-tiering/samples/v1-beta/typescript/src/getAcquiredNumberLimits.ts new file mode 100644 index 000000000000..ef13c7872de9 --- /dev/null +++ b/sdk/communication/communication-tiering/samples/v1-beta/typescript/src/getAcquiredNumberLimits.ts @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Get acquired numbers and limits for a resource + */ + +import { TieringClient } from "@azure-tools/communication-tiering"; + +// Load the .env file if it exists +import * as dotenv from "dotenv"; +dotenv.config(); + +export async function main() { + console.log("\n== Get acquired numbers and limits for a resource ==\n"); + + // You will need to set this environment variable or edit the following values + const connectionString = + process.env.COMMUNICATION_SAMPLES_CONNECTION_STRING || + "endpoint=https://resourceName.communication.azure.net/;accessKey=test-key"; + + // create new client + const client = new TieringClient(connectionString); + + const resourceId = "5d41e908-de88-4bbf-94dc-fe9a1b51029b"; + + // Get acquired numbers and limits for a resource + var acquiredNumberLimits = await client.getAcquiredNumberLimits(resourceId); + + // print all number limits + for await (const limit of acquiredNumberLimits) { + console.log(limit); + } +} + +main().catch((error) => { + console.log("The sample getAcquiredNumberLimits encountered an error:", error); + process.exit(1); +}); diff --git a/sdk/communication/communication-tiering/samples/v1-beta/typescript/tsconfig.json b/sdk/communication/communication-tiering/samples/v1-beta/typescript/tsconfig.json new file mode 100644 index 000000000000..e26ce2a6d8f7 --- /dev/null +++ b/sdk/communication/communication-tiering/samples/v1-beta/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "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/communication/communication-tiering/src/generated/src/index.ts b/sdk/communication/communication-tiering/src/generated/src/index.ts new file mode 100644 index 000000000000..8302fcac886c --- /dev/null +++ b/sdk/communication/communication-tiering/src/generated/src/index.ts @@ -0,0 +1,11 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./models"; +export { TieringClient } from "./tieringClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/communication/communication-tiering/src/generated/src/models/index.ts b/sdk/communication/communication-tiering/src/generated/src/models/index.ts new file mode 100644 index 000000000000..1c3f37223473 --- /dev/null +++ b/sdk/communication/communication-tiering/src/generated/src/models/index.ts @@ -0,0 +1,82 @@ +/* + * 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 * as coreClient from "@azure/core-client"; + +/** Model response for acquired number and limits. */ +export interface AssetDetails { + /** Array defining the number type of the phone number. */ + numberType?: string[]; + /** Number of phone numbers that the resource has. */ + resourceAcquiredCount?: number; + /** Number of phone numbers that the subscription that the resource belongs to has. */ + subscriptionAcquiredCount?: number; + /** Number of phone numbers that the AAD tenant that the resource belongs to has. */ + aadTenantAcquiredCount?: number; + /** Tier specific info. */ + tierInfo?: AssetDetailsTierInfo; +} + +/** Tier specific info. */ +export interface AssetDetailsTierInfo { + /** The level at which the tiering properties in the TierInfo are for */ + scope?: string; + /** Number of phone numbers allowed that can change based on scope where scope can be (resource, subscription or tenant). */ + allowed?: number; + /** Number of phone numbers acquired that can change based on scope where scope can be (resource, subscription or tenant). */ + acquired?: number; + /** Difference between allowed and acquired amount. */ + balance?: number; + /** The standing of a customer to determine if they able to purchase more phone numbers. */ + limit?: string; +} + +/** The Communication Services error. */ +export interface CommunicationErrorResponse { + /** The Communication Services error. */ + error: CommunicationError; +} + +/** The Communication Services error. */ +export interface CommunicationError { + /** The error code. */ + code: string; + /** The error message. */ + message: string; + /** + * The error target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; + /** + * Further details about specific errors that led to this error. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: CommunicationError[]; + /** + * The inner error if any. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly innerError?: CommunicationError; +} + +/** Optional parameters. */ +export interface NumberAllotmentGetAcquiredNumberLimitsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getAcquiredNumberLimits operation. */ +export type NumberAllotmentGetAcquiredNumberLimitsResponse = AssetDetails[]; + +/** Optional parameters. */ +export interface TieringClientOptionalParams + extends coreClient.ServiceClientOptions { + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/communication/communication-tiering/src/generated/src/models/mappers.ts b/sdk/communication/communication-tiering/src/generated/src/models/mappers.ts new file mode 100644 index 000000000000..b979b8da40f7 --- /dev/null +++ b/sdk/communication/communication-tiering/src/generated/src/models/mappers.ts @@ -0,0 +1,159 @@ +/* + * 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 * as coreClient from "@azure/core-client"; + +export const AssetDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AssetDetails", + modelProperties: { + numberType: { + serializedName: "NumberType", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + resourceAcquiredCount: { + serializedName: "ResourceAcquiredCount", + type: { + name: "Number" + } + }, + subscriptionAcquiredCount: { + serializedName: "SubscriptionAcquiredCount", + type: { + name: "Number" + } + }, + aadTenantAcquiredCount: { + serializedName: "AadTenantAcquiredCount", + type: { + name: "Number" + } + }, + tierInfo: { + serializedName: "TierInfo", + type: { + name: "Composite", + className: "AssetDetailsTierInfo" + } + } + } + } +}; + +export const AssetDetailsTierInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AssetDetailsTierInfo", + modelProperties: { + scope: { + serializedName: "Scope", + type: { + name: "String" + } + }, + allowed: { + serializedName: "Allowed", + type: { + name: "Number" + } + }, + acquired: { + serializedName: "Acquired", + type: { + name: "Number" + } + }, + balance: { + serializedName: "Balance", + type: { + name: "Number" + } + }, + limit: { + serializedName: "Limit", + type: { + name: "String" + } + } + } + } +}; + +export const CommunicationErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CommunicationErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "CommunicationError" + } + } + } + } +}; + +export const CommunicationError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CommunicationError", + modelProperties: { + code: { + serializedName: "code", + required: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + required: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CommunicationError" + } + } + } + }, + innerError: { + serializedName: "innererror", + type: { + name: "Composite", + className: "CommunicationError" + } + } + } + } +}; diff --git a/sdk/communication/communication-tiering/src/generated/src/models/parameters.ts b/sdk/communication/communication-tiering/src/generated/src/models/parameters.ts new file mode 100644 index 000000000000..9f4ab0033912 --- /dev/null +++ b/sdk/communication/communication-tiering/src/generated/src/models/parameters.ts @@ -0,0 +1,60 @@ +/* + * 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 { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String" + } + } +}; + +export const endpoint: OperationURLParameter = { + parameterPath: "endpoint", + mapper: { + serializedName: "endpoint", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const resourceId: OperationURLParameter = { + parameterPath: "resourceId", + mapper: { + serializedName: "resourceId", + required: true, + type: { + name: "Uuid" + } + } +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2022-11-15", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; diff --git a/sdk/communication/communication-tiering/src/generated/src/operations/index.ts b/sdk/communication/communication-tiering/src/generated/src/operations/index.ts new file mode 100644 index 000000000000..96de47da7ca4 --- /dev/null +++ b/sdk/communication/communication-tiering/src/generated/src/operations/index.ts @@ -0,0 +1,9 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./numberAllotment"; diff --git a/sdk/communication/communication-tiering/src/generated/src/operations/numberAllotment.ts b/sdk/communication/communication-tiering/src/generated/src/operations/numberAllotment.ts new file mode 100644 index 000000000000..e7ca33415f08 --- /dev/null +++ b/sdk/communication/communication-tiering/src/generated/src/operations/numberAllotment.ts @@ -0,0 +1,76 @@ +/* + * 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 { tracingClient } from "../tracing"; +import { NumberAllotment } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { TieringClient } from "../tieringClient"; +import { + NumberAllotmentGetAcquiredNumberLimitsOptionalParams, + NumberAllotmentGetAcquiredNumberLimitsResponse +} from "../models"; + +/** Class containing NumberAllotment operations. */ +export class NumberAllotmentImpl implements NumberAllotment { + private readonly client: TieringClient; + + /** + * Initialize a new instance of the class NumberAllotment class. + * @param client Reference to the service client + */ + constructor(client: TieringClient) { + this.client = client; + } + + /** + * Get acquired numbers and limits for a resource. + * @param resourceId Resource Id. Must be a valid GUID + * @param options The options parameters. + */ + async getAcquiredNumberLimits( + resourceId: string, + options?: NumberAllotmentGetAcquiredNumberLimitsOptionalParams + ): Promise { + return tracingClient.withSpan( + "TieringClient.getAcquiredNumberLimits", + options ?? {}, + async (options) => { + return this.client.sendOperationRequest( + { resourceId, options }, + getAcquiredNumberLimitsOperationSpec + ) as Promise; + } + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getAcquiredNumberLimitsOperationSpec: coreClient.OperationSpec = { + path: "/administration/resources/{resourceId}/telephone-number-summary", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: { + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "AssetDetails" } } + } + } + }, + default: { + bodyMapper: Mappers.CommunicationErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.endpoint, Parameters.resourceId], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/communication/communication-tiering/src/generated/src/operationsInterfaces/index.ts b/sdk/communication/communication-tiering/src/generated/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..96de47da7ca4 --- /dev/null +++ b/sdk/communication/communication-tiering/src/generated/src/operationsInterfaces/index.ts @@ -0,0 +1,9 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./numberAllotment"; diff --git a/sdk/communication/communication-tiering/src/generated/src/operationsInterfaces/numberAllotment.ts b/sdk/communication/communication-tiering/src/generated/src/operationsInterfaces/numberAllotment.ts new file mode 100644 index 000000000000..a4928b1575e2 --- /dev/null +++ b/sdk/communication/communication-tiering/src/generated/src/operationsInterfaces/numberAllotment.ts @@ -0,0 +1,25 @@ +/* + * 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 { + NumberAllotmentGetAcquiredNumberLimitsOptionalParams, + NumberAllotmentGetAcquiredNumberLimitsResponse +} from "../models"; + +/** Interface representing a NumberAllotment. */ +export interface NumberAllotment { + /** + * Get acquired numbers and limits for a resource. + * @param resourceId Resource Id. Must be a valid GUID + * @param options The options parameters. + */ + getAcquiredNumberLimits( + resourceId: string, + options?: NumberAllotmentGetAcquiredNumberLimitsOptionalParams + ): Promise; +} diff --git a/sdk/communication/communication-tiering/src/generated/src/tieringClient.ts b/sdk/communication/communication-tiering/src/generated/src/tieringClient.ts new file mode 100644 index 000000000000..1b7e610bc1af --- /dev/null +++ b/sdk/communication/communication-tiering/src/generated/src/tieringClient.ts @@ -0,0 +1,118 @@ +/* + * 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 * as coreClient from "@azure/core-client"; +import * as coreRestPipeline from "@azure/core-rest-pipeline"; +import { + PipelineRequest, + PipelineResponse, + SendRequest +} from "@azure/core-rest-pipeline"; +import { NumberAllotmentImpl } from "./operations"; +import { NumberAllotment } from "./operationsInterfaces"; +import { TieringClientOptionalParams } from "./models"; + +export class TieringClient extends coreClient.ServiceClient { + endpoint: string; + apiVersion: string; + + /** + * Initializes a new instance of the TieringClient class. + * @param endpoint The communication resource, for example https://resourcename.communication.azure.com + * @param options The parameter options + */ + constructor(endpoint: string, options?: TieringClientOptionalParams) { + if (endpoint === undefined) { + throw new Error("'endpoint' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: TieringClientOptionalParams = { + requestContentType: "application/json; charset=utf-8" + }; + + const packageDetails = `azsdk-js-communication-tiering/1.0.0-beta.0`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: options.endpoint ?? options.baseUri ?? "{endpoint}" + }; + super(optionsWithDefaults); + + if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { + const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); + const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( + (pipelinePolicy) => + pipelinePolicy.name === + coreRestPipeline.bearerTokenAuthenticationPolicyName + ); + if (!bearerTokenAuthenticationPolicyFound) { + this.pipeline.removePolicy({ + name: coreRestPipeline.bearerTokenAuthenticationPolicyName + }); + this.pipeline.addPolicy( + coreRestPipeline.bearerTokenAuthenticationPolicy({ + scopes: `${optionsWithDefaults.baseUri}/.default`, + challengeCallbacks: { + authorizeRequestOnChallenge: + coreClient.authorizeRequestOnClaimChallenge + } + }) + ); + } + } + // Parameter assignments + this.endpoint = endpoint; + + // Assigning values to Constant parameters + this.apiVersion = options.apiVersion || "2022-11-15"; + this.numberAllotment = new NumberAllotmentImpl(this); + this.addCustomApiVersionPolicy(options.apiVersion); + } + + /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */ + private addCustomApiVersionPolicy(apiVersion?: string) { + if (!apiVersion) { + return; + } + const apiVersionPolicy = { + name: "CustomApiVersionPolicy", + async sendRequest( + request: PipelineRequest, + next: SendRequest + ): Promise { + const param = request.url.split("?"); + if (param.length > 1) { + const newParams = param[1].split("&").map((item) => { + if (item.indexOf("api-version") > -1) { + return "api-version=" + apiVersion; + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); + } + + numberAllotment: NumberAllotment; +} diff --git a/sdk/communication/communication-tiering/src/generated/src/tracing.ts b/sdk/communication/communication-tiering/src/generated/src/tracing.ts new file mode 100644 index 000000000000..9cf36bd7b260 --- /dev/null +++ b/sdk/communication/communication-tiering/src/generated/src/tracing.ts @@ -0,0 +1,15 @@ +/* + * 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 { createTracingClient } from "@azure/core-tracing"; + +export const tracingClient = createTracingClient({ + namespace: "Microsoft.Communication", + packageName: "@azure/communication-tiering", + packageVersion: "1.0.0-beta.0" +}); diff --git a/sdk/communication/communication-tiering/src/index.ts b/sdk/communication/communication-tiering/src/index.ts new file mode 100644 index 000000000000..c8a689646caf --- /dev/null +++ b/sdk/communication/communication-tiering/src/index.ts @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export * from "./models"; +export * from "./mapper"; +export * from "./tieringClient"; diff --git a/sdk/communication/communication-tiering/src/mapper.ts b/sdk/communication/communication-tiering/src/mapper.ts new file mode 100644 index 000000000000..cb97100b4920 --- /dev/null +++ b/sdk/communication/communication-tiering/src/mapper.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { AssetDetails as AssetDetailsMapper } from "./generated/src/models/mappers"; +export { AssetDetailsTierInfo as AssetDetailsTierInfoMapper } from "./generated/src/models/mappers"; diff --git a/sdk/communication/communication-tiering/src/models.ts b/sdk/communication/communication-tiering/src/models.ts new file mode 100644 index 000000000000..115feea9ece9 --- /dev/null +++ b/sdk/communication/communication-tiering/src/models.ts @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export { + NumberAllotmentGetAcquiredNumberLimitsOptionalParams, + NumberAllotmentGetAcquiredNumberLimitsResponse, + AssetDetails, + AssetDetailsTierInfo, + TieringClientOptionalParams, +} from "./generated/src/models"; diff --git a/sdk/communication/communication-tiering/src/tieringClient.ts b/sdk/communication/communication-tiering/src/tieringClient.ts new file mode 100644 index 000000000000..00351fb75622 --- /dev/null +++ b/sdk/communication/communication-tiering/src/tieringClient.ts @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +/// + +import { + NumberAllotmentGetAcquiredNumberLimitsOptionalParams, + NumberAllotmentGetAcquiredNumberLimitsResponse, +} from "./models"; +import { CommonClientOptions, InternalClientPipelineOptions } from "@azure/core-client"; +import { KeyCredential, TokenCredential, isTokenCredential } from "@azure/core-auth"; +import { createCommunicationAuthPolicy } from "@azure/communication-common"; +import { isKeyCredential, parseClientArguments } from "@azure/communication-common"; +import { TieringClient as TieringGeneratedClient } from "./generated/src"; +import { logger } from "./utils"; +import { tracingClient } from "./generated/src/tracing"; + +/** + * Client options used to configure the TieringGeneratedClient API requests. + */ +export interface TieringClientOptions extends CommonClientOptions {} + +const isTieringClientOptions = (options: any): options is TieringClientOptions => + options && !isKeyCredential(options) && !isTokenCredential(options); + +/** + * Client class for interacting with Azure Communication Services Tiering. + */ +export class TieringClient { + /** + * A reference to the auto-generated TieringClient HTTP client. + */ + private readonly client: TieringGeneratedClient; + + /** + * Initializes a new instance of the TieringClient class using a connection string. + * + * @param connectionString - Connection string to connect to an Azure Communication Service resource. (eg: endpoint=https://contoso.eastus.communications.azure.net/;accesskey=secret) + * @param options - Optional. Options to configure the HTTP pipeline. + */ + public constructor(connectionString: string, options?: TieringClientOptions); + + /** + * Initializes a new instance of the TieringClient class using an Azure KeyCredential. + * + * @param endpoint - The endpoint of the service (eg: https://contoso.eastus.communications.azure.net) + * @param credential - An object that is used to authenticate requests to the service. Use the Azure KeyCredential or `@azure/identity` to create a credential. + * @param options - Optional. Options to configure the HTTP pipeline. + */ + public constructor(endpoint: string, credential: KeyCredential, options?: TieringClientOptions); + + /** + * Initializes a new instance of the TieringClient class using an Azure KeyCredential. + * + * @param endpoint - The endpoint of the service (eg: https://contoso.eastus.communications.azure.net) + * @param credential - An object that is used to authenticate requests to the service. Use the Azure KeyCredential or `@azure/identity` to create a credential. + * @param options - Optional. Options to configure the HTTP pipeline. + */ + public constructor(endpoint: string, credential: TokenCredential, options?: TieringClientOptions); + + public constructor( + connectionStringOrUrl: string, + credentialOrOptions?: KeyCredential | TokenCredential | TieringClientOptions, + maybeOptions: TieringClientOptions = {} + ) { + const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions); + const options = isTieringClientOptions(credentialOrOptions) + ? credentialOrOptions + : maybeOptions; + + const internalPipelineOptions: InternalClientPipelineOptions = { + ...options, + ...{ + loggingOptions: { + logger: logger.info, + }, + }, + }; + + this.client = new TieringGeneratedClient(url, internalPipelineOptions); + const authPolicy = createCommunicationAuthPolicy(credential); + this.client.pipeline.addPolicy(authPolicy); + } + + /** + * Get acquired numbers and limits for a resource. + * + * @param options - Additional request options. + */ + public getAcquiredNumberLimits( + resourceId: string, + options: NumberAllotmentGetAcquiredNumberLimitsOptionalParams = {} + ): Promise { + return tracingClient.withSpan( + "numberAllotment.getAcquiredNumberLimits", + options, + (updatedOptions) => { + return this.client.numberAllotment.getAcquiredNumberLimits(resourceId, updatedOptions); + } + ); + } +} diff --git a/sdk/communication/communication-tiering/src/utils/constants.ts b/sdk/communication/communication-tiering/src/utils/constants.ts new file mode 100644 index 000000000000..cb3ec97d1326 --- /dev/null +++ b/sdk/communication/communication-tiering/src/utils/constants.ts @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export const SDK_VERSION: string = "1.0.0-beta.0"; diff --git a/sdk/communication/communication-tiering/src/utils/index.ts b/sdk/communication/communication-tiering/src/utils/index.ts new file mode 100644 index 000000000000..996de929a1d3 --- /dev/null +++ b/sdk/communication/communication-tiering/src/utils/index.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +export * from "./logger"; +export * from "./constants"; diff --git a/sdk/communication/communication-tiering/src/utils/logger.ts b/sdk/communication/communication-tiering/src/utils/logger.ts new file mode 100644 index 000000000000..91298ea93e50 --- /dev/null +++ b/sdk/communication/communication-tiering/src/utils/logger.ts @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { createClientLogger } from "@azure/logger"; + +/** + * The \@azure\/logger configuration for this package. + */ +export const logger = createClientLogger("communication-tiering"); diff --git a/sdk/communication/communication-tiering/swagger/README.md b/sdk/communication/communication-tiering/swagger/README.md new file mode 100644 index 000000000000..23c791e6184f --- /dev/null +++ b/sdk/communication/communication-tiering/swagger/README.md @@ -0,0 +1,50 @@ +# Azure Communication Services Tiering Module + +> see https://aka.ms/autorest + +## Configuration + +```yaml +package-name: "@azure/communication-tiering" +description: The tiering client library retrieves limits for each capability (SMS/PSTN Calling/Phone Number purchase) for a specific resource/tier. +package-version: 1.0.0-beta.0 +license-header: MICROSOFT_MIT_NO_VERSION +output-folder: ../src/generated +input-file: ./swagger.json +model-date-time-as-string: false +optional-response-headers: true +payload-flattening-threshold: 10 +add-credentials: false +skip-enum-validation: true +v3: true +title: Tiering Client +use-extension: + "@autorest/typescript": "6.0.0-rc.1" +tracing-info: + namespace: "Microsoft.Communication" + packagePrefix: "Azure.Communication" + +typescript: + generate-metadata: false + azure-arm: false +``` + +## Customizations + +### Disable extensible enums + +```yaml +directive: + - from: swagger-document + where: $.definitions[*].properties[*]["x-ms-enum"] + transform: > + if ($.modelAsString) { + $.modelAsString = false + } + - from: swagger-document + where: $.definitions[*].properties[*].items["x-ms-enum"] + transform: > + if ($.modelAsString) { + $.modelAsString = false + } +``` diff --git a/sdk/communication/communication-tiering/swagger/swagger.json b/sdk/communication/communication-tiering/swagger/swagger.json new file mode 100644 index 000000000000..dd58ab54c241 --- /dev/null +++ b/sdk/communication/communication-tiering/swagger/swagger.json @@ -0,0 +1,198 @@ +{ + "swagger": "2.0", + "info": { + "title": "TieringClient", + "description": "The tiering client library retrieves limits for each capability (SMS/PSTN Calling/Phone Number purchase) for a specific resource/tier.", + "version": "2022-11-15" + }, + "paths": { + "/administration/resources/{resourceId}/telephone-number-summary": { + "get": { + "tags": [ + "ACS Tiering" + ], + "summary": "Get acquired numbers and limits for a resource.", + "operationId": "NumberAllotment_GetAcquiredNumberLimits", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "path", + "name": "resourceId", + "description": "Resource Id. Must be a valid GUID", + "required": true, + "type": "string", + "format": "uuid" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/AssetDetails" + } + } + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/CommunicationErrorResponse" + } + } + }, + "x-ms-examples": { + "Get acquired numbers and limits for a resource": { + "$ref": "./examples/GetAcquiredNumberLimits.json" + } + } + } + } + }, + "definitions": { + "AssetDetails": { + "description": "Model response for acquired number and limits.", + "type": "object", + "properties": { + "NumberType": { + "description": "Array defining the number type of the phone number.", + "type": "array", + "items": { + "type": "string" + } + }, + "ResourceAcquiredCount": { + "description": "Number of phone numbers that the resource has.", + "type": "integer" + }, + "SubscriptionAcquiredCount": { + "description": "Number of phone numbers that the subscription that the resource belongs to has.", + "type": "integer" + }, + "AadTenantAcquiredCount": { + "description": "Number of phone numbers that the AAD tenant that the resource belongs to has.", + "type": "integer" + }, + "TierInfo": { + "description": "Tier specific info.", + "type": "object", + "properties": { + "Scope": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "string" + }, + "Allowed": { + "description": "Number of phone numbers allowed that can change based on scope where scope can be (resource, subscription or tenant).", + "type": "integer" + }, + "Acquired": { + "description": "Number of phone numbers acquired that can change based on scope where scope can be (resource, subscription or tenant).", + "type": "integer" + }, + "Balance": { + "description": "Difference between allowed and acquired amount.", + "type": "integer" + }, + "Limit": { + "description": "The standing of a customer to determine if they able to purchase more phone numbers.", + "type": "string" + } + } + } + } + }, + "CommunicationErrorResponse": { + "description": "The Communication Services error.", + "type": "object", + "required": [ + "error" + ], + "properties": { + "error": { + "description": "The Communication Services error.", + "$ref": "#/definitions/CommunicationError" + } + } + }, + "CommunicationError": { + "description": "The Communication Services error.", + "type": "object", + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "string", + "description": "The error code." + }, + "message": { + "type": "string", + "description": "The error message." + }, + "target": { + "type": "string", + "readOnly": true, + "description": "The error target." + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/CommunicationError" + }, + "readOnly": true, + "description": "Further details about specific errors that led to this error." + }, + "innererror": { + "x-ms-client-name": "innerError", + "readOnly": true, + "$ref": "#/definitions/CommunicationError", + "description": "The inner error if any." + } + } + } + }, + "parameters": { + "ApiVersionParameter": { + "in": "query", + "name": "api-version", + "description": "Version of API to invoke", + "required": true, + "type": "string" + }, + "Endpoint": { + "in": "path", + "name": "endpoint", + "description": "The communication resource, for example https://resourcename.communication.azure.com", + "required": true, + "type": "string", + "x-ms-skip-url-encoding": true, + "x-ms-parameter-location": "client" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + }, + "description": "Azure Active Directory OAuth2 Flow" + } + }, + "x-ms-parameterized-host": { + "hostTemplate": "{endpoint}", + "useSchemePrefix": false, + "parameters": [ + { + "$ref": "#/parameters/Endpoint" + } + ] + } +} diff --git a/sdk/communication/communication-tiering/tests.yml b/sdk/communication/communication-tiering/tests.yml new file mode 100644 index 000000000000..9a0f31550477 --- /dev/null +++ b/sdk/communication/communication-tiering/tests.yml @@ -0,0 +1,22 @@ +trigger: none + +stages: + - template: /eng/pipelines/templates/stages/archetype-sdk-tests.yml + parameters: + PackageName: "@azure-tools/communication-tiering" + ServiceDirectory: communication + CloudConfig: + Public: + SubscriptionConfigurations: + - $(sub-config-azure-cloud-test-resources) + - $(sub-config-communication-services-cloud-test-resources-common) + - $(sub-config-communication-services-cloud-test-resources-js) + Int: + SubscriptionConfigurations: + - $(sub-config-communication-int-test-resources-common) + - $(sub-config-communication-int-test-resources-js) + MatrixFilters: + - TestType=^(?!(browser|sample)).* + Clouds: Public,Int + TestResourceDirectories: + - communication/test-resources/ diff --git a/sdk/communication/communication-tiering/tsconfig.json b/sdk/communication/communication-tiering/tsconfig.json new file mode 100644 index 000000000000..0c646b07da44 --- /dev/null +++ b/sdk/communication/communication-tiering/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../../tsconfig.package", + "compilerOptions": { + "outDir": "./dist-esm", + "declarationDir": "./types", + "paths": { + "@azure-tools/communication-tiering": ["./src/index"] + } + }, + "include": ["src/**/*.ts", "test/**/*.ts", "samples-dev/**/*.ts"] +} From e2f8099d207ac9231c36fa23a5a568329ffdacdf Mon Sep 17 00:00:00 2001 From: Babacar Ndoye Date: Fri, 26 May 2023 08:37:20 -0500 Subject: [PATCH 03/21] autorest code for tiering --- .../review/communication-tiering.api.md | 131 +++++ .../src/generated/src/models/index.ts | 169 ++++++ .../src/generated/src/models/mappers.ts | 522 ++++++++++++++++++ .../src/generated/src/operations/index.ts | 1 + .../src/generated/src/operations/tiering.ts | 76 +++ .../src/operationsInterfaces/index.ts | 1 + .../src/operationsInterfaces/tiering.ts | 25 + .../src/generated/src/tieringClient.ts | 6 +- .../communication-tiering/src/mapper.ts | 4 + .../communication-tiering/src/models.ts | 17 + .../src/tieringClient.ts | 16 + .../swagger/swagger.json | 360 ++++++++++++ 12 files changed, 1326 insertions(+), 2 deletions(-) create mode 100644 sdk/communication/communication-tiering/src/generated/src/operations/tiering.ts create mode 100644 sdk/communication/communication-tiering/src/generated/src/operationsInterfaces/tiering.ts diff --git a/sdk/communication/communication-tiering/review/communication-tiering.api.md b/sdk/communication/communication-tiering/review/communication-tiering.api.md index 570711a7bd99..2ab4ad3e339b 100644 --- a/sdk/communication/communication-tiering/review/communication-tiering.api.md +++ b/sdk/communication/communication-tiering/review/communication-tiering.api.md @@ -11,6 +11,47 @@ import * as coreClient from '@azure/core-client'; import { KeyCredential } from '@azure/core-auth'; import { TokenCredential } from '@azure/core-auth'; +// @public +export interface AcsTier { + capabilities?: AcsTierCapabilities; + correlationId?: string; + tierId?: string; + tierType?: string; +} + +// @public +export interface AcsTierCapabilities { + calling?: AcsTierCapabilitiesCalling; + phoneNumberPurchase?: PhoneNumberPurchase[]; + sms?: AcsTierCapabilitiesSMS; + trialPhoneNumberPurchase?: TrialPhoneNumberPurchase[]; + trialPhoneNumberUsage?: TrialPhoneNumberUsage[]; +} + +// @public +export interface AcsTierCapabilitiesCalling { + inbound?: CallingInbound[]; + outbound?: CallingOutbound[]; +} + +// @public (undocumented) +export const AcsTierCapabilitiesCallingMapper: coreClient.CompositeMapper; + +// @public (undocumented) +export const AcsTierCapabilitiesMappers: coreClient.CompositeMapper; + +// @public +export interface AcsTierCapabilitiesSMS { + inbound?: SMSInbound[]; + outbound?: SMSOutbound[]; +} + +// @public (undocumented) +export const AcsTierCapabilitiesSMSMapper: coreClient.CompositeMapper; + +// @public (undocumented) +export const AcsTierMapper: coreClient.CompositeMapper; + // @public export interface AssetDetails { aadTenantAcquiredCount?: number; @@ -35,6 +76,22 @@ export interface AssetDetailsTierInfo { // @public (undocumented) export const AssetDetailsTierInfoMapper: coreClient.CompositeMapper; +// @public +export interface CallingInbound { + geographicLimitations?: string; + scope?: string; + smsPerMin?: number; + type?: string; +} + +// @public +export interface CallingOutbound { + geographicLimitations?: string; + scope?: string; + smsPerMin?: number; + type?: string; +} + // @public export interface NumberAllotmentGetAcquiredNumberLimitsOptionalParams extends coreClient.OperationOptions { } @@ -42,12 +99,36 @@ export interface NumberAllotmentGetAcquiredNumberLimitsOptionalParams extends co // @public export type NumberAllotmentGetAcquiredNumberLimitsResponse = AssetDetails[]; +// @public +export interface PhoneNumberPurchase { + numberType?: string[]; + scope?: string; + totalNumbers?: number; +} + +// @public +export interface SMSInbound { + geographicLimitations?: string; + scope?: string; + smsPerMin?: number; + type?: string; +} + +// @public +export interface SMSOutbound { + geographicLimitations?: string; + scope?: string; + smsPerMin?: number; + type?: string; +} + // @public export class TieringClient { constructor(connectionString: string, options?: TieringClientOptions); constructor(endpoint: string, credential: KeyCredential, options?: TieringClientOptions); constructor(endpoint: string, credential: TokenCredential, options?: TieringClientOptions); getAcquiredNumberLimits(resourceId: string, options?: NumberAllotmentGetAcquiredNumberLimitsOptionalParams): Promise; + getByResourceId(resourceId: string, options?: TieringGetByResourceIdOptionalParams): Promise; } // @public @@ -60,6 +141,56 @@ export interface TieringClientOptionalParams extends coreClient.ServiceClientOpt export interface TieringClientOptions extends CommonClientOptions { } +// @public +export interface TieringGetByResourceIdOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type TieringGetByResourceIdResponse = AcsTier[]; + +// @public +export interface TrialPhoneNumberPurchase { + numberType?: string[]; + scope?: string; + totalNumbers?: number; + trialPeriodDays?: number; +} + +// @public +export interface TrialPhoneNumberUsage { + calling?: TrialPhoneNumberUsageCalling; + numberType?: string; + sms?: TrialPhoneNumberUsageSms; +} + +// @public +export interface TrialPhoneNumberUsageCalling { + inbound?: TrialPhoneNumberUsageCallingBounds[]; + outbound?: TrialPhoneNumberUsageCallingBounds[]; +} + +// @public +export interface TrialPhoneNumberUsageCallingBounds { + maximumCallDurationMinutes?: number; + scope?: string; + totalMinutes?: number; + type?: string; +} + +// @public +export interface TrialPhoneNumberUsageSms { + inbound?: TrialPhoneNumberUsageSmsBounds[]; + outbound?: TrialPhoneNumberUsageSmsBounds[]; +} + +// @public +export interface TrialPhoneNumberUsageSmsBounds { + scope?: string; + smsPerMin?: number; + total?: number; + type?: string; +} + // (No @packageDocumentation comment for this package) ``` diff --git a/sdk/communication/communication-tiering/src/generated/src/models/index.ts b/sdk/communication/communication-tiering/src/generated/src/models/index.ts index 1c3f37223473..6e4f4269c225 100644 --- a/sdk/communication/communication-tiering/src/generated/src/models/index.ts +++ b/sdk/communication/communication-tiering/src/generated/src/models/index.ts @@ -65,6 +65,168 @@ export interface CommunicationError { readonly innerError?: CommunicationError; } +/** Represents an ACS Tier resource. */ +export interface AcsTier { + /** Tier Id. */ + tierId?: string; + /** Correlation Id */ + correlationId?: string; + /** Tier Type */ + tierType?: string; + /** Capabilities for the resource */ + capabilities?: AcsTierCapabilities; +} + +/** Capabilities for the resource */ +export interface AcsTierCapabilities { + /** The level at which the tiering properties in the TierInfo are for */ + phoneNumberPurchase?: PhoneNumberPurchase[]; + /** The level at which the tiering properties in the TierInfo are for */ + sms?: AcsTierCapabilitiesSMS; + /** The level at which the tiering properties in the TierInfo are for */ + calling?: AcsTierCapabilitiesCalling; + /** The level at which the tiering properties in the TierInfo are for */ + trialPhoneNumberPurchase?: TrialPhoneNumberPurchase[]; + /** The level at which the tiering properties in the TierInfo are for */ + trialPhoneNumberUsage?: TrialPhoneNumberUsage[]; +} + +/** Model response for acquired number and limits. */ +export interface PhoneNumberPurchase { + /** Array defining the number type of the phone number. */ + numberType?: string[]; + /** The level at which the tiering properties in the TierInfo are for */ + scope?: string; + /** Total Numbers */ + totalNumbers?: number; +} + +/** The level at which the tiering properties in the TierInfo are for */ +export interface AcsTierCapabilitiesSMS { + /** The level at which the tiering properties in the TierInfo are for */ + outbound?: SMSOutbound[]; + /** The level at which the tiering properties in the TierInfo are for */ + inbound?: SMSInbound[]; +} + +/** Model response for acquired number and limits. */ +export interface SMSOutbound { + /** The level at which the tiering properties in the TierInfo are for */ + type?: string; + /** Total Numbers */ + scope?: string; + /** Total Numbers */ + smsPerMin?: number; + /** Total Numbers */ + geographicLimitations?: string; +} + +/** Model response for acquired number and limits. */ +export interface SMSInbound { + /** The level at which the tiering properties in the TierInfo are for */ + type?: string; + /** Total Numbers */ + scope?: string; + /** Total Numbers */ + smsPerMin?: number; + /** Total Numbers */ + geographicLimitations?: string; +} + +/** The level at which the tiering properties in the TierInfo are for */ +export interface AcsTierCapabilitiesCalling { + /** The level at which the tiering properties in the TierInfo are for */ + outbound?: CallingOutbound[]; + /** The level at which the tiering properties in the TierInfo are for */ + inbound?: CallingInbound[]; +} + +/** Model response for acquired number and limits. */ +export interface CallingOutbound { + /** The level at which the tiering properties in the TierInfo are for */ + type?: string; + /** Total Numbers */ + scope?: string; + /** Total Numbers */ + smsPerMin?: number; + /** Total Numbers */ + geographicLimitations?: string; +} + +/** Model response for acquired number and limits. */ +export interface CallingInbound { + /** The level at which the tiering properties in the TierInfo are for */ + type?: string; + /** Total Numbers */ + scope?: string; + /** Total Numbers */ + smsPerMin?: number; + /** Total Numbers */ + geographicLimitations?: string; +} + +/** Model response for acquired number and limits. */ +export interface TrialPhoneNumberPurchase { + /** Array defining the number type of the phone number. */ + numberType?: string[]; + /** The level at which the tiering properties in the TierInfo are for */ + scope?: string; + /** Total Numbers */ + totalNumbers?: number; + /** Total Numbers */ + trialPeriodDays?: number; +} + +/** Model response for acquired number and limits. */ +export interface TrialPhoneNumberUsage { + /** Total Numbers */ + numberType?: string; + /** The level at which the tiering properties in the TierInfo are for */ + calling?: TrialPhoneNumberUsageCalling; + /** The level at which the tiering properties in the TierInfo are for */ + sms?: TrialPhoneNumberUsageSms; +} + +/** The level at which the tiering properties in the TierInfo are for */ +export interface TrialPhoneNumberUsageCalling { + /** The level at which the tiering properties in the TierInfo are for */ + outbound?: TrialPhoneNumberUsageCallingBounds[]; + /** The level at which the tiering properties in the TierInfo are for */ + inbound?: TrialPhoneNumberUsageCallingBounds[]; +} + +/** Model response for acquired number and limits. */ +export interface TrialPhoneNumberUsageCallingBounds { + /** The level at which the tiering properties in the TierInfo are for */ + type?: string; + /** Total Numbers */ + scope?: string; + /** Total Numbers */ + totalMinutes?: number; + /** Total Numbers */ + maximumCallDurationMinutes?: number; +} + +/** The level at which the tiering properties in the TierInfo are for */ +export interface TrialPhoneNumberUsageSms { + /** The level at which the tiering properties in the TierInfo are for */ + outbound?: TrialPhoneNumberUsageSmsBounds[]; + /** The level at which the tiering properties in the TierInfo are for */ + inbound?: TrialPhoneNumberUsageSmsBounds[]; +} + +/** Model response for acquired number and limits. */ +export interface TrialPhoneNumberUsageSmsBounds { + /** The level at which the tiering properties in the TierInfo are for */ + type?: string; + /** Total Numbers */ + scope?: string; + /** Total Numbers */ + total?: number; + /** Total Numbers */ + smsPerMin?: number; +} + /** Optional parameters. */ export interface NumberAllotmentGetAcquiredNumberLimitsOptionalParams extends coreClient.OperationOptions {} @@ -72,6 +234,13 @@ export interface NumberAllotmentGetAcquiredNumberLimitsOptionalParams /** Contains response data for the getAcquiredNumberLimits operation. */ export type NumberAllotmentGetAcquiredNumberLimitsResponse = AssetDetails[]; +/** Optional parameters. */ +export interface TieringGetByResourceIdOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getByResourceId operation. */ +export type TieringGetByResourceIdResponse = AcsTier[]; + /** Optional parameters. */ export interface TieringClientOptionalParams extends coreClient.ServiceClientOptions { diff --git a/sdk/communication/communication-tiering/src/generated/src/models/mappers.ts b/sdk/communication/communication-tiering/src/generated/src/models/mappers.ts index b979b8da40f7..b0bef835aa3b 100644 --- a/sdk/communication/communication-tiering/src/generated/src/models/mappers.ts +++ b/sdk/communication/communication-tiering/src/generated/src/models/mappers.ts @@ -157,3 +157,525 @@ export const CommunicationError: coreClient.CompositeMapper = { } } }; + +export const AcsTier: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AcsTier", + modelProperties: { + tierId: { + serializedName: "TierId", + type: { + name: "String" + } + }, + correlationId: { + serializedName: "CorrelationId", + type: { + name: "String" + } + }, + tierType: { + serializedName: "TierType", + type: { + name: "String" + } + }, + capabilities: { + serializedName: "Capabilities", + type: { + name: "Composite", + className: "AcsTierCapabilities" + } + } + } + } +}; + +export const AcsTierCapabilities: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AcsTierCapabilities", + modelProperties: { + phoneNumberPurchase: { + serializedName: "PhoneNumberPurchase", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PhoneNumberPurchase" + } + } + } + }, + sms: { + serializedName: "SMS", + type: { + name: "Composite", + className: "AcsTierCapabilitiesSMS" + } + }, + calling: { + serializedName: "Calling", + type: { + name: "Composite", + className: "AcsTierCapabilitiesCalling" + } + }, + trialPhoneNumberPurchase: { + serializedName: "TrialPhoneNumberPurchase", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "TrialPhoneNumberPurchase" + } + } + } + }, + trialPhoneNumberUsage: { + serializedName: "TrialPhoneNumberUsage", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "TrialPhoneNumberUsage" + } + } + } + } + } + } +}; + +export const PhoneNumberPurchase: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PhoneNumberPurchase", + modelProperties: { + numberType: { + serializedName: "NumberType", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + scope: { + serializedName: "Scope", + type: { + name: "String" + } + }, + totalNumbers: { + serializedName: "TotalNumbers", + type: { + name: "Number" + } + } + } + } +}; + +export const AcsTierCapabilitiesSMS: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AcsTierCapabilitiesSMS", + modelProperties: { + outbound: { + serializedName: "Outbound", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SMSOutbound" + } + } + } + }, + inbound: { + serializedName: "Inbound", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SMSInbound" + } + } + } + } + } + } +}; + +export const SMSOutbound: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SMSOutbound", + modelProperties: { + type: { + serializedName: "Type", + type: { + name: "String" + } + }, + scope: { + serializedName: "Scope", + type: { + name: "String" + } + }, + smsPerMin: { + serializedName: "SmsPerMin", + type: { + name: "Number" + } + }, + geographicLimitations: { + serializedName: "GeographicLimitations", + type: { + name: "String" + } + } + } + } +}; + +export const SMSInbound: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SMSInbound", + modelProperties: { + type: { + serializedName: "Type", + type: { + name: "String" + } + }, + scope: { + serializedName: "Scope", + type: { + name: "String" + } + }, + smsPerMin: { + serializedName: "SmsPerMin", + type: { + name: "Number" + } + }, + geographicLimitations: { + serializedName: "GeographicLimitations", + type: { + name: "String" + } + } + } + } +}; + +export const AcsTierCapabilitiesCalling: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AcsTierCapabilitiesCalling", + modelProperties: { + outbound: { + serializedName: "Outbound", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CallingOutbound" + } + } + } + }, + inbound: { + serializedName: "Inbound", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CallingInbound" + } + } + } + } + } + } +}; + +export const CallingOutbound: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CallingOutbound", + modelProperties: { + type: { + serializedName: "Type", + type: { + name: "String" + } + }, + scope: { + serializedName: "Scope", + type: { + name: "String" + } + }, + smsPerMin: { + serializedName: "SmsPerMin", + type: { + name: "Number" + } + }, + geographicLimitations: { + serializedName: "GeographicLimitations", + type: { + name: "String" + } + } + } + } +}; + +export const CallingInbound: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CallingInbound", + modelProperties: { + type: { + serializedName: "Type", + type: { + name: "String" + } + }, + scope: { + serializedName: "Scope", + type: { + name: "String" + } + }, + smsPerMin: { + serializedName: "SmsPerMin", + type: { + name: "Number" + } + }, + geographicLimitations: { + serializedName: "GeographicLimitations", + type: { + name: "String" + } + } + } + } +}; + +export const TrialPhoneNumberPurchase: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrialPhoneNumberPurchase", + modelProperties: { + numberType: { + serializedName: "NumberType", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + scope: { + serializedName: "Scope", + type: { + name: "String" + } + }, + totalNumbers: { + serializedName: "TotalNumbers", + type: { + name: "Number" + } + }, + trialPeriodDays: { + serializedName: "TrialPeriodDays", + type: { + name: "Number" + } + } + } + } +}; + +export const TrialPhoneNumberUsage: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrialPhoneNumberUsage", + modelProperties: { + numberType: { + serializedName: "NumberType", + type: { + name: "String" + } + }, + calling: { + serializedName: "Calling", + type: { + name: "Composite", + className: "TrialPhoneNumberUsageCalling" + } + }, + sms: { + serializedName: "Sms", + type: { + name: "Composite", + className: "TrialPhoneNumberUsageSms" + } + } + } + } +}; + +export const TrialPhoneNumberUsageCalling: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrialPhoneNumberUsageCalling", + modelProperties: { + outbound: { + serializedName: "Outbound", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "TrialPhoneNumberUsageCallingBounds" + } + } + } + }, + inbound: { + serializedName: "Inbound", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "TrialPhoneNumberUsageCallingBounds" + } + } + } + } + } + } +}; + +export const TrialPhoneNumberUsageCallingBounds: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrialPhoneNumberUsageCallingBounds", + modelProperties: { + type: { + serializedName: "Type", + type: { + name: "String" + } + }, + scope: { + serializedName: "Scope", + type: { + name: "String" + } + }, + totalMinutes: { + serializedName: "TotalMinutes", + type: { + name: "Number" + } + }, + maximumCallDurationMinutes: { + serializedName: "MaximumCallDurationMinutes", + type: { + name: "Number" + } + } + } + } +}; + +export const TrialPhoneNumberUsageSms: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrialPhoneNumberUsageSms", + modelProperties: { + outbound: { + serializedName: "Outbound", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "TrialPhoneNumberUsageSmsBounds" + } + } + } + }, + inbound: { + serializedName: "Inbound", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "TrialPhoneNumberUsageSmsBounds" + } + } + } + } + } + } +}; + +export const TrialPhoneNumberUsageSmsBounds: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrialPhoneNumberUsageSmsBounds", + modelProperties: { + type: { + serializedName: "Type", + type: { + name: "String" + } + }, + scope: { + serializedName: "Scope", + type: { + name: "String" + } + }, + total: { + serializedName: "Total", + type: { + name: "Number" + } + }, + smsPerMin: { + serializedName: "SmsPerMin", + type: { + name: "Number" + } + } + } + } +}; diff --git a/sdk/communication/communication-tiering/src/generated/src/operations/index.ts b/sdk/communication/communication-tiering/src/generated/src/operations/index.ts index 96de47da7ca4..6e187b6a22c2 100644 --- a/sdk/communication/communication-tiering/src/generated/src/operations/index.ts +++ b/sdk/communication/communication-tiering/src/generated/src/operations/index.ts @@ -7,3 +7,4 @@ */ export * from "./numberAllotment"; +export * from "./tiering"; diff --git a/sdk/communication/communication-tiering/src/generated/src/operations/tiering.ts b/sdk/communication/communication-tiering/src/generated/src/operations/tiering.ts new file mode 100644 index 000000000000..1ee6a9b4b7cb --- /dev/null +++ b/sdk/communication/communication-tiering/src/generated/src/operations/tiering.ts @@ -0,0 +1,76 @@ +/* + * 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 { tracingClient } from "../tracing"; +import { Tiering } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { TieringClient } from "../tieringClient"; +import { + TieringGetByResourceIdOptionalParams, + TieringGetByResourceIdResponse +} from "../models"; + +/** Class containing Tiering operations. */ +export class TieringImpl implements Tiering { + private readonly client: TieringClient; + + /** + * Initialize a new instance of the class Tiering class. + * @param client Reference to the service client + */ + constructor(client: TieringClient) { + this.client = client; + } + + /** + * Get the tiering data for a given resource + * @param resourceId Resource Id. Must be a valid GUID + * @param options The options parameters. + */ + async getByResourceId( + resourceId: string, + options?: TieringGetByResourceIdOptionalParams + ): Promise { + return tracingClient.withSpan( + "TieringClient.getByResourceId", + options ?? {}, + async (options) => { + return this.client.sendOperationRequest( + { resourceId, options }, + getByResourceIdOperationSpec + ) as Promise; + } + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getByResourceIdOperationSpec: coreClient.OperationSpec = { + path: "/administration/tiers/resources/{resourceId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: { + type: { + name: "Sequence", + element: { type: { name: "Composite", className: "AcsTier" } } + } + } + }, + default: { + bodyMapper: Mappers.CommunicationErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.endpoint, Parameters.resourceId], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/communication/communication-tiering/src/generated/src/operationsInterfaces/index.ts b/sdk/communication/communication-tiering/src/generated/src/operationsInterfaces/index.ts index 96de47da7ca4..6e187b6a22c2 100644 --- a/sdk/communication/communication-tiering/src/generated/src/operationsInterfaces/index.ts +++ b/sdk/communication/communication-tiering/src/generated/src/operationsInterfaces/index.ts @@ -7,3 +7,4 @@ */ export * from "./numberAllotment"; +export * from "./tiering"; diff --git a/sdk/communication/communication-tiering/src/generated/src/operationsInterfaces/tiering.ts b/sdk/communication/communication-tiering/src/generated/src/operationsInterfaces/tiering.ts new file mode 100644 index 000000000000..24f017e78404 --- /dev/null +++ b/sdk/communication/communication-tiering/src/generated/src/operationsInterfaces/tiering.ts @@ -0,0 +1,25 @@ +/* + * 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 { + TieringGetByResourceIdOptionalParams, + TieringGetByResourceIdResponse +} from "../models"; + +/** Interface representing a Tiering. */ +export interface Tiering { + /** + * Get the tiering data for a given resource + * @param resourceId Resource Id. Must be a valid GUID + * @param options The options parameters. + */ + getByResourceId( + resourceId: string, + options?: TieringGetByResourceIdOptionalParams + ): Promise; +} diff --git a/sdk/communication/communication-tiering/src/generated/src/tieringClient.ts b/sdk/communication/communication-tiering/src/generated/src/tieringClient.ts index 1b7e610bc1af..77e9353cec9a 100644 --- a/sdk/communication/communication-tiering/src/generated/src/tieringClient.ts +++ b/sdk/communication/communication-tiering/src/generated/src/tieringClient.ts @@ -13,8 +13,8 @@ import { PipelineResponse, SendRequest } from "@azure/core-rest-pipeline"; -import { NumberAllotmentImpl } from "./operations"; -import { NumberAllotment } from "./operationsInterfaces"; +import { NumberAllotmentImpl, TieringImpl } from "./operations"; +import { NumberAllotment, Tiering } from "./operationsInterfaces"; import { TieringClientOptionalParams } from "./models"; export class TieringClient extends coreClient.ServiceClient { @@ -83,6 +83,7 @@ export class TieringClient extends coreClient.ServiceClient { // Assigning values to Constant parameters this.apiVersion = options.apiVersion || "2022-11-15"; this.numberAllotment = new NumberAllotmentImpl(this); + this.tiering = new TieringImpl(this); this.addCustomApiVersionPolicy(options.apiVersion); } @@ -115,4 +116,5 @@ export class TieringClient extends coreClient.ServiceClient { } numberAllotment: NumberAllotment; + tiering: Tiering; } diff --git a/sdk/communication/communication-tiering/src/mapper.ts b/sdk/communication/communication-tiering/src/mapper.ts index cb97100b4920..7b0184de6d7e 100644 --- a/sdk/communication/communication-tiering/src/mapper.ts +++ b/sdk/communication/communication-tiering/src/mapper.ts @@ -3,3 +3,7 @@ export { AssetDetails as AssetDetailsMapper } from "./generated/src/models/mappers"; export { AssetDetailsTierInfo as AssetDetailsTierInfoMapper } from "./generated/src/models/mappers"; +export { AcsTier as AcsTierMapper } from "./generated/src/models/mappers"; +export { AcsTierCapabilities as AcsTierCapabilitiesMappers } from "./generated/src/models/mappers"; +export { AcsTierCapabilitiesCalling as AcsTierCapabilitiesCallingMapper } from "./generated/src/models/mappers"; +export { AcsTierCapabilitiesSMS as AcsTierCapabilitiesSMSMapper } from "./generated/src/models/mappers"; diff --git a/sdk/communication/communication-tiering/src/models.ts b/sdk/communication/communication-tiering/src/models.ts index 115feea9ece9..ef47540edc25 100644 --- a/sdk/communication/communication-tiering/src/models.ts +++ b/sdk/communication/communication-tiering/src/models.ts @@ -7,4 +7,21 @@ export { AssetDetails, AssetDetailsTierInfo, TieringClientOptionalParams, + AcsTier, + AcsTierCapabilities, + AcsTierCapabilitiesCalling, + AcsTierCapabilitiesSMS, + TieringGetByResourceIdOptionalParams, + TieringGetByResourceIdResponse, + TrialPhoneNumberUsage, + TrialPhoneNumberPurchase, + TrialPhoneNumberUsageSms, + PhoneNumberPurchase, + SMSInbound, + SMSOutbound, + CallingInbound, + CallingOutbound, + TrialPhoneNumberUsageCalling, + TrialPhoneNumberUsageSmsBounds, + TrialPhoneNumberUsageCallingBounds, } from "./generated/src/models"; diff --git a/sdk/communication/communication-tiering/src/tieringClient.ts b/sdk/communication/communication-tiering/src/tieringClient.ts index 00351fb75622..21145e6e6e67 100644 --- a/sdk/communication/communication-tiering/src/tieringClient.ts +++ b/sdk/communication/communication-tiering/src/tieringClient.ts @@ -5,6 +5,8 @@ import { NumberAllotmentGetAcquiredNumberLimitsOptionalParams, NumberAllotmentGetAcquiredNumberLimitsResponse, + TieringGetByResourceIdResponse, + TieringGetByResourceIdOptionalParams, } from "./models"; import { CommonClientOptions, InternalClientPipelineOptions } from "@azure/core-client"; import { KeyCredential, TokenCredential, isTokenCredential } from "@azure/core-auth"; @@ -98,4 +100,18 @@ export class TieringClient { } ); } + + /** + * Get tiering info for a resource. + * + * @param options - Additional request options. + */ + public getByResourceId( + resourceId: string, + options: TieringGetByResourceIdOptionalParams = {} + ): Promise { + return tracingClient.withSpan("tiering.getByResourceId", options, (updatedOptions) => { + return this.client.tiering.getByResourceId(resourceId, updatedOptions); + }); + } } diff --git a/sdk/communication/communication-tiering/swagger/swagger.json b/sdk/communication/communication-tiering/swagger/swagger.json index dd58ab54c241..8d470d3e2e94 100644 --- a/sdk/communication/communication-tiering/swagger/swagger.json +++ b/sdk/communication/communication-tiering/swagger/swagger.json @@ -52,6 +52,53 @@ } } } + }, + "/administration/tiers/resources/{resourceId}": { + "get": { + "tags": [ + "ACS Tiering" + ], + "summary": " Get the tiering data for a given resource", + "operationId": "Tiering_GetByResourceId", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "path", + "name": "resourceId", + "description": "Resource Id. Must be a valid GUID", + "required": true, + "type": "string", + "format": "uuid" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/AcsTier" + } + } + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/CommunicationErrorResponse" + } + } + }, + "x-ms-examples": { + "Get acquired numbers and limits for a resource": { + "$ref": "./examples/GetAcquiredNumberLimits.json" + } + } + } } }, "definitions": { @@ -106,6 +153,319 @@ } } }, + "AcsTier": { + "description": "Represents an ACS Tier resource.", + "type": "object", + "properties": { + "TierId": { + "description": "Tier Id.", + "type": "string" + }, + "CorrelationId": { + "description": "Correlation Id", + "type": "string" + }, + "TierType": { + "description": "Tier Type", + "type": "string" + }, + "Capabilities": { + "description": "Capabilities for the resource", + "type": "object", + "properties": { + "PhoneNumberPurchase": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "array", + "items": { + "$ref": "#/definitions/PhoneNumberPurchase" + } + }, + "SMS": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "object", + "properties": { + "Outbound": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "array", + "items": { + "$ref": "#/definitions/SMSOutbound" + } + }, + "Inbound": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "array", + "items": { + "$ref": "#/definitions/SMSInbound" + } + } + } + }, + "Calling": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "object", + "properties": { + "Outbound": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "array", + "items": { + "$ref": "#/definitions/CallingOutbound" + } + }, + "Inbound": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "array", + "items": { + "$ref": "#/definitions/CallingInbound" + } + } + } + }, + "TrialPhoneNumberPurchase": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "array", + "items": { + "$ref": "#/definitions/TrialPhoneNumberPurchase" + } + }, + "TrialPhoneNumberUsage": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "array", + "items": { + "$ref": "#/definitions/TrialPhoneNumberUsage" + } + } + } + } + } + }, + "PhoneNumberPurchase":{ + "description": "Model response for acquired number and limits.", + "type":"object", + "properties": { + "NumberType": { + "description": "Array defining the number type of the phone number.", + "type": "array", + "items": { + "type": "string" + } + }, + "Scope": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "string" + }, + "TotalNumbers": { + "description": "Total Numbers", + "type": "integer" + } + } + }, + "SMSOutbound":{ + "description": "Model response for acquired number and limits.", + "type":"object", + "properties": { + "Type": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "string" + }, + "Scope": { + "description": "Total Numbers", + "type": "string" + }, + "SmsPerMin": { + "description": "Total Numbers", + "type": "integer" + }, + "GeographicLimitations": { + "description": "Total Numbers", + "type": "string" + } + } + }, + "SMSInbound":{ + "description": "Model response for acquired number and limits.", + "type":"object", + "properties": { + "Type": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "string" + }, + "Scope": { + "description": "Total Numbers", + "type": "string" + }, + "SmsPerMin": { + "description": "Total Numbers", + "type": "integer" + }, + "GeographicLimitations": { + "description": "Total Numbers", + "type": "string" + } + } + }, + "CallingOutbound":{ + "description": "Model response for acquired number and limits.", + "type":"object", + "properties": { + "Type": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "string" + }, + "Scope": { + "description": "Total Numbers", + "type": "string" + }, + "SmsPerMin": { + "description": "Total Numbers", + "type": "integer" + }, + "GeographicLimitations": { + "description": "Total Numbers", + "type": "string" + } + } + }, + "CallingInbound":{ + "description": "Model response for acquired number and limits.", + "type":"object", + "properties": { + "Type": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "string" + }, + "Scope": { + "description": "Total Numbers", + "type": "string" + }, + "SmsPerMin": { + "description": "Total Numbers", + "type": "integer" + }, + "GeographicLimitations": { + "description": "Total Numbers", + "type": "string" + } + } + }, + "TrialPhoneNumberUsageCallingBounds":{ + "description": "Model response for acquired number and limits.", + "type":"object", + "properties": { + "Type": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "string" + }, + "Scope": { + "description": "Total Numbers", + "type": "string" + }, + "TotalMinutes": { + "description": "Total Numbers", + "type": "integer" + }, + "MaximumCallDurationMinutes": { + "description": "Total Numbers", + "type": "integer" + } + } + }, + "TrialPhoneNumberUsageSmsBounds":{ + "description": "Model response for acquired number and limits.", + "type":"object", + "properties": { + "Type": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "string" + }, + "Scope": { + "description": "Total Numbers", + "type": "string" + }, + "Total": { + "description": "Total Numbers", + "type": "integer" + }, + "SmsPerMin": { + "description": "Total Numbers", + "type": "integer" + } + } + }, + "TrialPhoneNumberPurchase":{ + "description": "Model response for acquired number and limits.", + "type":"object", + "properties": { + "NumberType": { + "description": "Array defining the number type of the phone number.", + "type": "array", + "items": { + "type": "string" + } + }, + "Scope": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "string" + }, + "TotalNumbers": { + "description": "Total Numbers", + "type": "integer" + }, + "TrialPeriodDays": { + "description": "Total Numbers", + "type": "integer" + } + } + }, + "TrialPhoneNumberUsage":{ + "description": "Model response for acquired number and limits.", + "type":"object", + "properties": { + "NumberType": { + "description": "Total Numbers", + "type": "string" + }, + "Calling": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "object", + "properties": { + "Outbound": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "array", + "items": { + "$ref": "#/definitions/TrialPhoneNumberUsageCallingBounds" + } + }, + "Inbound": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "array", + "items": { + "$ref": "#/definitions/TrialPhoneNumberUsageCallingBounds" + } + } + } + }, + "Sms": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "object", + "properties": { + "Outbound": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "array", + "items": { + "$ref": "#/definitions/TrialPhoneNumberUsageSmsBounds" + } + }, + "Inbound": { + "description": "The level at which the tiering properties in the TierInfo are for", + "type": "array", + "items": { + "$ref": "#/definitions/TrialPhoneNumberUsageSmsBounds" + } + } + } + } + } + }, "CommunicationErrorResponse": { "description": "The Communication Services error.", "type": "object", From 4bf82ff41715390dd43bea830c524e2b5c835133 Mon Sep 17 00:00:00 2001 From: Babacar Ndoye Date: Fri, 26 May 2023 08:39:45 -0500 Subject: [PATCH 04/21] updating swagger --- sdk/communication/communication-tiering/swagger/swagger.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/communication/communication-tiering/swagger/swagger.json b/sdk/communication/communication-tiering/swagger/swagger.json index 8d470d3e2e94..e18eadc69b82 100644 --- a/sdk/communication/communication-tiering/swagger/swagger.json +++ b/sdk/communication/communication-tiering/swagger/swagger.json @@ -94,8 +94,8 @@ } }, "x-ms-examples": { - "Get acquired numbers and limits for a resource": { - "$ref": "./examples/GetAcquiredNumberLimits.json" + "Get tier info for a resource": { + "$ref": "./examples/GetTierInfo.json" } } } From 514f78188c264db5b50a232c71e124b1cbb2cedb Mon Sep 17 00:00:00 2001 From: Babacar Ndoye Date: Thu, 1 Jun 2023 13:08:40 -0500 Subject: [PATCH 05/21] updating swagger.json --- .../review/communication-tiering.api.md | 4 +- .../src/generated/src/models/index.ts | 124 +++++++++--------- .../src/generated/src/models/mappers.ts | 8 +- .../swagger/swagger.json | 116 ++++++++-------- 4 files changed, 126 insertions(+), 126 deletions(-) diff --git a/sdk/communication/communication-tiering/review/communication-tiering.api.md b/sdk/communication/communication-tiering/review/communication-tiering.api.md index 2ab4ad3e339b..fe45647a34bf 100644 --- a/sdk/communication/communication-tiering/review/communication-tiering.api.md +++ b/sdk/communication/communication-tiering/review/communication-tiering.api.md @@ -78,17 +78,17 @@ export const AssetDetailsTierInfoMapper: coreClient.CompositeMapper; // @public export interface CallingInbound { + concurrentCalls?: number; geographicLimitations?: string; scope?: string; - smsPerMin?: number; type?: string; } // @public export interface CallingOutbound { + concurrentCalls?: number; geographicLimitations?: string; scope?: string; - smsPerMin?: number; type?: string; } diff --git a/sdk/communication/communication-tiering/src/generated/src/models/index.ts b/sdk/communication/communication-tiering/src/generated/src/models/index.ts index 6e4f4269c225..9dd59ea6f25f 100644 --- a/sdk/communication/communication-tiering/src/generated/src/models/index.ts +++ b/sdk/communication/communication-tiering/src/generated/src/models/index.ts @@ -79,151 +79,151 @@ export interface AcsTier { /** Capabilities for the resource */ export interface AcsTierCapabilities { - /** The level at which the tiering properties in the TierInfo are for */ + /** Phone number purchase capabilities of the tier. */ phoneNumberPurchase?: PhoneNumberPurchase[]; - /** The level at which the tiering properties in the TierInfo are for */ + /** SMS capabilities of the tier. */ sms?: AcsTierCapabilitiesSMS; - /** The level at which the tiering properties in the TierInfo are for */ + /** Calling capabilities of the tier. */ calling?: AcsTierCapabilitiesCalling; - /** The level at which the tiering properties in the TierInfo are for */ + /** Trial phone number purchase capability details. */ trialPhoneNumberPurchase?: TrialPhoneNumberPurchase[]; - /** The level at which the tiering properties in the TierInfo are for */ + /** Trial phone number usage of the tier. */ trialPhoneNumberUsage?: TrialPhoneNumberUsage[]; } -/** Model response for acquired number and limits. */ +/** Phone number purchase capability details. */ export interface PhoneNumberPurchase { - /** Array defining the number type of the phone number. */ + /** Types to apply the limit to. */ numberType?: string[]; - /** The level at which the tiering properties in the TierInfo are for */ + /** The scope to apply the limits. */ scope?: string; - /** Total Numbers */ + /** The limit of numbers allowed for purchase for the number type. */ totalNumbers?: number; } -/** The level at which the tiering properties in the TierInfo are for */ +/** SMS capabilities of the tier. */ export interface AcsTierCapabilitiesSMS { - /** The level at which the tiering properties in the TierInfo are for */ + /** SMS Outbound capabilities of the tier. */ outbound?: SMSOutbound[]; - /** The level at which the tiering properties in the TierInfo are for */ + /** SMS Inbound capabilities of the tier. */ inbound?: SMSInbound[]; } -/** Model response for acquired number and limits. */ +/** Sms Outbound Capabilities for the tier. */ export interface SMSOutbound { - /** The level at which the tiering properties in the TierInfo are for */ + /** Type of number. */ type?: string; - /** Total Numbers */ + /** The scope to apply the limits. */ scope?: string; - /** Total Numbers */ + /** The limit of SMSs a customer can send per minute. */ smsPerMin?: number; - /** Total Numbers */ + /** The areas where an SMS is allowed to be sent. */ geographicLimitations?: string; } -/** Model response for acquired number and limits. */ +/** Sms Inbound Capabilities for the tier. */ export interface SMSInbound { - /** The level at which the tiering properties in the TierInfo are for */ + /** Type of number. */ type?: string; - /** Total Numbers */ + /** The scope to apply the limits. */ scope?: string; - /** Total Numbers */ + /** The limit of SMSs a customer can send per minute. */ smsPerMin?: number; - /** Total Numbers */ + /** The areas where an SMS is allowed to be sent. */ geographicLimitations?: string; } -/** The level at which the tiering properties in the TierInfo are for */ +/** Calling capabilities of the tier. */ export interface AcsTierCapabilitiesCalling { - /** The level at which the tiering properties in the TierInfo are for */ + /** Calling Outbound capabilities of the tier. */ outbound?: CallingOutbound[]; - /** The level at which the tiering properties in the TierInfo are for */ + /** Calling Inbound capabilities of the tier. */ inbound?: CallingInbound[]; } -/** Model response for acquired number and limits. */ +/** Calling Outbound Capabilities for the tier. */ export interface CallingOutbound { - /** The level at which the tiering properties in the TierInfo are for */ + /** Type of calling. */ type?: string; - /** Total Numbers */ + /** The scope to apply the limits. */ scope?: string; - /** Total Numbers */ - smsPerMin?: number; - /** Total Numbers */ + /** The number of concurrent calls allowed. */ + concurrentCalls?: number; + /** The areas where calls are allowed to take place. */ geographicLimitations?: string; } -/** Model response for acquired number and limits. */ +/** Calling Outbound Capabilities for the tier. */ export interface CallingInbound { - /** The level at which the tiering properties in the TierInfo are for */ + /** Type of calling. */ type?: string; - /** Total Numbers */ + /** The scope to apply the limits. */ scope?: string; - /** Total Numbers */ - smsPerMin?: number; - /** Total Numbers */ + /** The number of concurrent calls allowed. */ + concurrentCalls?: number; + /** The areas where calls are allowed to take place. */ geographicLimitations?: string; } -/** Model response for acquired number and limits. */ +/** Trial phone number purchase capability details. */ export interface TrialPhoneNumberPurchase { - /** Array defining the number type of the phone number. */ + /** Types to apply the limit to. */ numberType?: string[]; - /** The level at which the tiering properties in the TierInfo are for */ + /** The scope to apply the limits. */ scope?: string; - /** Total Numbers */ + /** The limit of numbers allowed for purchase for the number type. */ totalNumbers?: number; - /** Total Numbers */ + /** The number of days in the trial period for the number type. */ trialPeriodDays?: number; } -/** Model response for acquired number and limits. */ +/** Trial phone number usage capability details. */ export interface TrialPhoneNumberUsage { - /** Total Numbers */ + /** The number type. */ numberType?: string; - /** The level at which the tiering properties in the TierInfo are for */ + /** The capabilities for calling. */ calling?: TrialPhoneNumberUsageCalling; - /** The level at which the tiering properties in the TierInfo are for */ + /** The SMS capabilities for the trial phone number. */ sms?: TrialPhoneNumberUsageSms; } -/** The level at which the tiering properties in the TierInfo are for */ +/** The capabilities for calling. */ export interface TrialPhoneNumberUsageCalling { - /** The level at which the tiering properties in the TierInfo are for */ + /** The Outbound capabilities for calling. */ outbound?: TrialPhoneNumberUsageCallingBounds[]; - /** The level at which the tiering properties in the TierInfo are for */ + /** The Inbound capabilities for calling. */ inbound?: TrialPhoneNumberUsageCallingBounds[]; } -/** Model response for acquired number and limits. */ +/** Trial phone number capability details. */ export interface TrialPhoneNumberUsageCallingBounds { - /** The level at which the tiering properties in the TierInfo are for */ + /** Type of calling. */ type?: string; - /** Total Numbers */ + /** The scope to apply the limits to. */ scope?: string; - /** Total Numbers */ + /** The total calling minutes allowed for a tial number. */ totalMinutes?: number; - /** Total Numbers */ + /** The total call duration in minutes allowed for a trial number. */ maximumCallDurationMinutes?: number; } -/** The level at which the tiering properties in the TierInfo are for */ +/** The SMS capabilities for the trial phone number. */ export interface TrialPhoneNumberUsageSms { - /** The level at which the tiering properties in the TierInfo are for */ + /** Outbound trial phone number SMS capabilities. */ outbound?: TrialPhoneNumberUsageSmsBounds[]; - /** The level at which the tiering properties in the TierInfo are for */ + /** Inbound trial phone number SMS capabilities. */ inbound?: TrialPhoneNumberUsageSmsBounds[]; } -/** Model response for acquired number and limits. */ +/** Trial phone number SMS capability details. */ export interface TrialPhoneNumberUsageSmsBounds { - /** The level at which the tiering properties in the TierInfo are for */ + /** The type of SMS. */ type?: string; - /** Total Numbers */ + /** The scope to apply the limits to. */ scope?: string; - /** Total Numbers */ + /** Total */ total?: number; - /** Total Numbers */ + /** The total SMSs allowed to be sent in a minute. */ smsPerMin?: number; } diff --git a/sdk/communication/communication-tiering/src/generated/src/models/mappers.ts b/sdk/communication/communication-tiering/src/generated/src/models/mappers.ts index b0bef835aa3b..b189ca767977 100644 --- a/sdk/communication/communication-tiering/src/generated/src/models/mappers.ts +++ b/sdk/communication/communication-tiering/src/generated/src/models/mappers.ts @@ -432,8 +432,8 @@ export const CallingOutbound: coreClient.CompositeMapper = { name: "String" } }, - smsPerMin: { - serializedName: "SmsPerMin", + concurrentCalls: { + serializedName: "ConcurrentCalls", type: { name: "Number" } @@ -465,8 +465,8 @@ export const CallingInbound: coreClient.CompositeMapper = { name: "String" } }, - smsPerMin: { - serializedName: "SmsPerMin", + concurrentCalls: { + serializedName: "ConcurrentCalls", type: { name: "Number" } diff --git a/sdk/communication/communication-tiering/swagger/swagger.json b/sdk/communication/communication-tiering/swagger/swagger.json index e18eadc69b82..db048ded842d 100644 --- a/sdk/communication/communication-tiering/swagger/swagger.json +++ b/sdk/communication/communication-tiering/swagger/swagger.json @@ -174,25 +174,25 @@ "type": "object", "properties": { "PhoneNumberPurchase": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "Phone number purchase capabilities of the tier.", "type": "array", "items": { "$ref": "#/definitions/PhoneNumberPurchase" } }, "SMS": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "SMS capabilities of the tier.", "type": "object", "properties": { "Outbound": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "SMS Outbound capabilities of the tier.", "type": "array", "items": { "$ref": "#/definitions/SMSOutbound" } }, "Inbound": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "SMS Inbound capabilities of the tier.", "type": "array", "items": { "$ref": "#/definitions/SMSInbound" @@ -201,18 +201,18 @@ } }, "Calling": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "Calling capabilities of the tier.", "type": "object", "properties": { "Outbound": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "Calling Outbound capabilities of the tier.", "type": "array", "items": { "$ref": "#/definitions/CallingOutbound" } }, "Inbound": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "Calling Inbound capabilities of the tier.", "type": "array", "items": { "$ref": "#/definitions/CallingInbound" @@ -221,14 +221,14 @@ } }, "TrialPhoneNumberPurchase": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "Trial phone number purchase capability details.", "type": "array", "items": { "$ref": "#/definitions/TrialPhoneNumberPurchase" } }, "TrialPhoneNumberUsage": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "Trial phone number usage of the tier.", "type": "array", "items": { "$ref": "#/definitions/TrialPhoneNumberUsage" @@ -239,204 +239,204 @@ } }, "PhoneNumberPurchase":{ - "description": "Model response for acquired number and limits.", + "description": "Phone number purchase capability details.", "type":"object", "properties": { "NumberType": { - "description": "Array defining the number type of the phone number.", + "description": "Types to apply the limit to.", "type": "array", "items": { "type": "string" } }, "Scope": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "The scope to apply the limits.", "type": "string" }, "TotalNumbers": { - "description": "Total Numbers", + "description": "The limit of numbers allowed for purchase for the number type.", "type": "integer" } } }, "SMSOutbound":{ - "description": "Model response for acquired number and limits.", + "description": "Sms Outbound Capabilities for the tier.", "type":"object", "properties": { "Type": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "Type of number.", "type": "string" }, "Scope": { - "description": "Total Numbers", + "description": "The scope to apply the limits.", "type": "string" }, "SmsPerMin": { - "description": "Total Numbers", + "description": "The limit of SMSs a customer can send per minute.", "type": "integer" }, "GeographicLimitations": { - "description": "Total Numbers", + "description": "The areas where an SMS is allowed to be sent.", "type": "string" } } }, "SMSInbound":{ - "description": "Model response for acquired number and limits.", + "description": "Sms Inbound Capabilities for the tier.", "type":"object", "properties": { "Type": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "Type of number.", "type": "string" }, "Scope": { - "description": "Total Numbers", + "description": "The scope to apply the limits.", "type": "string" }, "SmsPerMin": { - "description": "Total Numbers", + "description": "The limit of SMSs a customer can send per minute.", "type": "integer" }, "GeographicLimitations": { - "description": "Total Numbers", + "description": "The areas where an SMS is allowed to be sent.", "type": "string" } } }, "CallingOutbound":{ - "description": "Model response for acquired number and limits.", + "description": "Calling Outbound Capabilities for the tier.", "type":"object", "properties": { "Type": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "Type of calling.", "type": "string" }, "Scope": { - "description": "Total Numbers", + "description": "The scope to apply the limits.", "type": "string" }, - "SmsPerMin": { - "description": "Total Numbers", + "ConcurrentCalls": { + "description": "The number of concurrent calls allowed.", "type": "integer" }, "GeographicLimitations": { - "description": "Total Numbers", + "description": "The areas where calls are allowed to take place.", "type": "string" } } }, "CallingInbound":{ - "description": "Model response for acquired number and limits.", + "description": "Calling Outbound Capabilities for the tier.", "type":"object", "properties": { "Type": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "Type of calling.", "type": "string" }, "Scope": { - "description": "Total Numbers", + "description": "The scope to apply the limits.", "type": "string" }, - "SmsPerMin": { - "description": "Total Numbers", + "ConcurrentCalls": { + "description": "The number of concurrent calls allowed.", "type": "integer" }, "GeographicLimitations": { - "description": "Total Numbers", + "description": "The areas where calls are allowed to take place.", "type": "string" } } }, "TrialPhoneNumberUsageCallingBounds":{ - "description": "Model response for acquired number and limits.", + "description": "Trial phone number capability details.", "type":"object", "properties": { "Type": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": " Type of calling.", "type": "string" }, "Scope": { - "description": "Total Numbers", + "description": "The scope to apply the limits to.", "type": "string" }, "TotalMinutes": { - "description": "Total Numbers", + "description": "The total calling minutes allowed for a tial number.", "type": "integer" }, "MaximumCallDurationMinutes": { - "description": "Total Numbers", + "description": "The total call duration in minutes allowed for a trial number.", "type": "integer" } } }, "TrialPhoneNumberUsageSmsBounds":{ - "description": "Model response for acquired number and limits.", + "description": "Trial phone number SMS capability details.", "type":"object", "properties": { "Type": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "The type of SMS.", "type": "string" }, "Scope": { - "description": "Total Numbers", + "description": "The scope to apply the limits to.", "type": "string" }, "Total": { - "description": "Total Numbers", + "description": "Total", "type": "integer" }, "SmsPerMin": { - "description": "Total Numbers", + "description": "The total SMSs allowed to be sent in a minute.", "type": "integer" } } }, "TrialPhoneNumberPurchase":{ - "description": "Model response for acquired number and limits.", + "description": "Trial phone number purchase capability details.", "type":"object", "properties": { "NumberType": { - "description": "Array defining the number type of the phone number.", + "description": "Types to apply the limit to.", "type": "array", "items": { "type": "string" } }, "Scope": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "The scope to apply the limits.", "type": "string" }, "TotalNumbers": { - "description": "Total Numbers", + "description": "The limit of numbers allowed for purchase for the number type.", "type": "integer" }, "TrialPeriodDays": { - "description": "Total Numbers", + "description": "The number of days in the trial period for the number type.", "type": "integer" } } }, "TrialPhoneNumberUsage":{ - "description": "Model response for acquired number and limits.", + "description": "Trial phone number usage capability details.", "type":"object", "properties": { "NumberType": { - "description": "Total Numbers", + "description": "The number type.", "type": "string" }, "Calling": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "The capabilities for calling.", "type": "object", "properties": { "Outbound": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "The Outbound capabilities for calling.", "type": "array", "items": { "$ref": "#/definitions/TrialPhoneNumberUsageCallingBounds" } }, "Inbound": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "The Inbound capabilities for calling.", "type": "array", "items": { "$ref": "#/definitions/TrialPhoneNumberUsageCallingBounds" @@ -445,18 +445,18 @@ } }, "Sms": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "The SMS capabilities for the trial phone number.", "type": "object", "properties": { "Outbound": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "Outbound trial phone number SMS capabilities.", "type": "array", "items": { "$ref": "#/definitions/TrialPhoneNumberUsageSmsBounds" } }, "Inbound": { - "description": "The level at which the tiering properties in the TierInfo are for", + "description": "Inbound trial phone number SMS capabilities.", "type": "array", "items": { "$ref": "#/definitions/TrialPhoneNumberUsageSmsBounds" From 5236e53c779ce52a530403cd080fc25c624ff3bc Mon Sep 17 00:00:00 2001 From: Babacar Ndoye Date: Thu, 1 Jun 2023 13:47:39 -0500 Subject: [PATCH 06/21] Changing function name in client --- .../review/communication-tiering.api.md | 2 +- .../samples-dev/getTierInfo.ts | 39 ++++++++++++++++++ .../samples/v1-beta/javascript/README.md | 2 + .../samples/v1-beta/javascript/getTierInfo.js | 40 +++++++++++++++++++ .../samples/v1-beta/typescript/README.md | 2 + .../v1-beta/typescript/src/getTierInfo.ts | 39 ++++++++++++++++++ .../src/tieringClient.ts | 4 +- 7 files changed, 125 insertions(+), 3 deletions(-) create mode 100644 sdk/communication/communication-tiering/samples-dev/getTierInfo.ts create mode 100644 sdk/communication/communication-tiering/samples/v1-beta/javascript/getTierInfo.js create mode 100644 sdk/communication/communication-tiering/samples/v1-beta/typescript/src/getTierInfo.ts diff --git a/sdk/communication/communication-tiering/review/communication-tiering.api.md b/sdk/communication/communication-tiering/review/communication-tiering.api.md index fe45647a34bf..0afa47575203 100644 --- a/sdk/communication/communication-tiering/review/communication-tiering.api.md +++ b/sdk/communication/communication-tiering/review/communication-tiering.api.md @@ -128,7 +128,7 @@ export class TieringClient { constructor(endpoint: string, credential: KeyCredential, options?: TieringClientOptions); constructor(endpoint: string, credential: TokenCredential, options?: TieringClientOptions); getAcquiredNumberLimits(resourceId: string, options?: NumberAllotmentGetAcquiredNumberLimitsOptionalParams): Promise; - getByResourceId(resourceId: string, options?: TieringGetByResourceIdOptionalParams): Promise; + getTierByResourceId(resourceId: string, options?: TieringGetByResourceIdOptionalParams): Promise; } // @public diff --git a/sdk/communication/communication-tiering/samples-dev/getTierInfo.ts b/sdk/communication/communication-tiering/samples-dev/getTierInfo.ts new file mode 100644 index 000000000000..635bcbffc470 --- /dev/null +++ b/sdk/communication/communication-tiering/samples-dev/getTierInfo.ts @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Get tiering info for a resource. + */ + +import { TieringClient } from "@azure-tools/communication-tiering"; + +// Load the .env file if it exists +import * as dotenv from "dotenv"; +dotenv.config(); + +export async function main() { + console.log("\n== Get tiering info for a resource ==\n"); + + // You will need to set this environment variable or edit the following values + const connectionString = + process.env.COMMUNICATION_SAMPLES_CONNECTION_STRING || + "endpoint=https://resourceName.communication.azure.net/;accessKey=test-key"; + + // create new client + const client = new TieringClient(connectionString); + + const resourceId = "5d41e908-de88-4bbf-94dc-fe9a1b51029b"; + + // Get tier info for a resource + var tiers = await client.getTierByResourceId(resourceId); + + // print all tier info + for await (const tier of tiers) { + console.log(tier); + } +} + +main().catch((error) => { + console.log("The sample getTierByResourceId encountered an error:", error); + process.exit(1); +}); diff --git a/sdk/communication/communication-tiering/samples/v1-beta/javascript/README.md b/sdk/communication/communication-tiering/samples/v1-beta/javascript/README.md index 8005413a7e39..2c2904d05e1f 100644 --- a/sdk/communication/communication-tiering/samples/v1-beta/javascript/README.md +++ b/sdk/communication/communication-tiering/samples/v1-beta/javascript/README.md @@ -15,6 +15,7 @@ These sample programs show how to use the JavaScript client libraries for Azure | **File Name** | **Description** | | ----------------------------------------------------- | ---------------------------------------------- | | [getAcquiredNumberLimits.js][getacquirednumberlimits] | Get acquired numbers and limits for a resource | +| [getTierInfo.js][gettierinfo] | Get tiering info for a resource. | ## Prerequisites @@ -57,6 +58,7 @@ npx cross-env COMMUNICATION_SAMPLES_CONNECTION_STRING=" { + console.log("The sample getTierByResourceId encountered an error:", error); + process.exit(1); +}); + +module.exports = { main }; diff --git a/sdk/communication/communication-tiering/samples/v1-beta/typescript/README.md b/sdk/communication/communication-tiering/samples/v1-beta/typescript/README.md index d4b0c7141645..18bf2e159b6c 100644 --- a/sdk/communication/communication-tiering/samples/v1-beta/typescript/README.md +++ b/sdk/communication/communication-tiering/samples/v1-beta/typescript/README.md @@ -15,6 +15,7 @@ These sample programs show how to use the TypeScript client libraries for Azure | **File Name** | **Description** | | ----------------------------------------------------- | ---------------------------------------------- | | [getAcquiredNumberLimits.ts][getacquirednumberlimits] | Get acquired numbers and limits for a resource | +| [getTierInfo.ts][gettierinfo] | Get tiering info for a resource. | ## Prerequisites @@ -69,6 +70,7 @@ npx cross-env COMMUNICATION_SAMPLES_CONNECTION_STRING=" { + console.log("The sample getTierByResourceId encountered an error:", error); + process.exit(1); +}); diff --git a/sdk/communication/communication-tiering/src/tieringClient.ts b/sdk/communication/communication-tiering/src/tieringClient.ts index 21145e6e6e67..507b1b6bf955 100644 --- a/sdk/communication/communication-tiering/src/tieringClient.ts +++ b/sdk/communication/communication-tiering/src/tieringClient.ts @@ -106,11 +106,11 @@ export class TieringClient { * * @param options - Additional request options. */ - public getByResourceId( + public getTierByResourceId( resourceId: string, options: TieringGetByResourceIdOptionalParams = {} ): Promise { - return tracingClient.withSpan("tiering.getByResourceId", options, (updatedOptions) => { + return tracingClient.withSpan("tiering.getTierByResourceId", options, (updatedOptions) => { return this.client.tiering.getByResourceId(resourceId, updatedOptions); }); } From 03bde071c450d327b4c96cf8769751505d5f7fff Mon Sep 17 00:00:00 2001 From: Babacar Ndoye Date: Mon, 5 Jun 2023 12:22:22 -0500 Subject: [PATCH 07/21] updating samples --- .../samples-dev/getAcquiredNumberLimits.ts | 4 +--- .../communication-tiering/samples-dev/getTierInfo.ts | 6 ++---- .../samples/v1-beta/javascript/getAcquiredNumberLimits.js | 4 +--- .../samples/v1-beta/javascript/getTierInfo.js | 6 ++---- .../v1-beta/typescript/src/getAcquiredNumberLimits.ts | 4 +--- .../samples/v1-beta/typescript/src/getTierInfo.ts | 6 ++---- 6 files changed, 9 insertions(+), 21 deletions(-) diff --git a/sdk/communication/communication-tiering/samples-dev/getAcquiredNumberLimits.ts b/sdk/communication/communication-tiering/samples-dev/getAcquiredNumberLimits.ts index ef13c7872de9..3515d60f7dcc 100644 --- a/sdk/communication/communication-tiering/samples-dev/getAcquiredNumberLimits.ts +++ b/sdk/communication/communication-tiering/samples-dev/getAcquiredNumberLimits.ts @@ -28,9 +28,7 @@ export async function main() { var acquiredNumberLimits = await client.getAcquiredNumberLimits(resourceId); // print all number limits - for await (const limit of acquiredNumberLimits) { - console.log(limit); - } + console.log(acquiredNumberLimits); } main().catch((error) => { diff --git a/sdk/communication/communication-tiering/samples-dev/getTierInfo.ts b/sdk/communication/communication-tiering/samples-dev/getTierInfo.ts index 635bcbffc470..d4f5bc2d578f 100644 --- a/sdk/communication/communication-tiering/samples-dev/getTierInfo.ts +++ b/sdk/communication/communication-tiering/samples-dev/getTierInfo.ts @@ -25,12 +25,10 @@ export async function main() { const resourceId = "5d41e908-de88-4bbf-94dc-fe9a1b51029b"; // Get tier info for a resource - var tiers = await client.getTierByResourceId(resourceId); + var tierInfo = await client.getTierByResourceId(resourceId); // print all tier info - for await (const tier of tiers) { - console.log(tier); - } + console.log(tierInfo); } main().catch((error) => { diff --git a/sdk/communication/communication-tiering/samples/v1-beta/javascript/getAcquiredNumberLimits.js b/sdk/communication/communication-tiering/samples/v1-beta/javascript/getAcquiredNumberLimits.js index 11523219c740..df497c33ec66 100644 --- a/sdk/communication/communication-tiering/samples/v1-beta/javascript/getAcquiredNumberLimits.js +++ b/sdk/communication/communication-tiering/samples/v1-beta/javascript/getAcquiredNumberLimits.js @@ -27,9 +27,7 @@ async function main() { var acquiredNumberLimits = await client.getAcquiredNumberLimits(resourceId); // print all number limits - for await (const limit of acquiredNumberLimits) { - console.log(limit); - } + console.log(acquiredNumberLimits); } main().catch((error) => { diff --git a/sdk/communication/communication-tiering/samples/v1-beta/javascript/getTierInfo.js b/sdk/communication/communication-tiering/samples/v1-beta/javascript/getTierInfo.js index e5cf52b604a9..340a16cece5d 100644 --- a/sdk/communication/communication-tiering/samples/v1-beta/javascript/getTierInfo.js +++ b/sdk/communication/communication-tiering/samples/v1-beta/javascript/getTierInfo.js @@ -24,12 +24,10 @@ async function main() { const resourceId = "5d41e908-de88-4bbf-94dc-fe9a1b51029b"; // Get tier info for a resource - var tiers = await client.getTierByResourceId(resourceId); + var tierInfo = await client.getTierByResourceId(resourceId); // print all tier info - for await (const tier of tiers) { - console.log(tier); - } + console.log(tierInfo); } main().catch((error) => { diff --git a/sdk/communication/communication-tiering/samples/v1-beta/typescript/src/getAcquiredNumberLimits.ts b/sdk/communication/communication-tiering/samples/v1-beta/typescript/src/getAcquiredNumberLimits.ts index ef13c7872de9..3515d60f7dcc 100644 --- a/sdk/communication/communication-tiering/samples/v1-beta/typescript/src/getAcquiredNumberLimits.ts +++ b/sdk/communication/communication-tiering/samples/v1-beta/typescript/src/getAcquiredNumberLimits.ts @@ -28,9 +28,7 @@ export async function main() { var acquiredNumberLimits = await client.getAcquiredNumberLimits(resourceId); // print all number limits - for await (const limit of acquiredNumberLimits) { - console.log(limit); - } + console.log(acquiredNumberLimits); } main().catch((error) => { diff --git a/sdk/communication/communication-tiering/samples/v1-beta/typescript/src/getTierInfo.ts b/sdk/communication/communication-tiering/samples/v1-beta/typescript/src/getTierInfo.ts index 635bcbffc470..d4f5bc2d578f 100644 --- a/sdk/communication/communication-tiering/samples/v1-beta/typescript/src/getTierInfo.ts +++ b/sdk/communication/communication-tiering/samples/v1-beta/typescript/src/getTierInfo.ts @@ -25,12 +25,10 @@ export async function main() { const resourceId = "5d41e908-de88-4bbf-94dc-fe9a1b51029b"; // Get tier info for a resource - var tiers = await client.getTierByResourceId(resourceId); + var tierInfo = await client.getTierByResourceId(resourceId); // print all tier info - for await (const tier of tiers) { - console.log(tier); - } + console.log(tierInfo); } main().catch((error) => { From bb256fc78072c7b9c6a08708f5f25690f5f18208 Mon Sep 17 00:00:00 2001 From: Babacar Ndoye Date: Mon, 5 Jun 2023 12:23:12 -0500 Subject: [PATCH 08/21] generated code --- .../src/generated/src/models/index.ts | 25 ++- .../src/generated/src/models/mappers.ts | 173 ++++++++++-------- .../src/generated/src/models/parameters.ts | 2 +- .../src/operations/numberAllotment.ts | 8 +- .../src/generated/src/operations/tiering.ts | 7 +- .../src/generated/src/tieringClient.ts | 2 +- .../communication-tiering/src/mapper.ts | 3 +- .../communication-tiering/src/models.ts | 7 +- 8 files changed, 124 insertions(+), 103 deletions(-) diff --git a/sdk/communication/communication-tiering/src/generated/src/models/index.ts b/sdk/communication/communication-tiering/src/generated/src/models/index.ts index 9dd59ea6f25f..9955b659a18a 100644 --- a/sdk/communication/communication-tiering/src/generated/src/models/index.ts +++ b/sdk/communication/communication-tiering/src/generated/src/models/index.ts @@ -8,6 +8,11 @@ import * as coreClient from "@azure/core-client"; +export interface Paths190FnhrAdministrationResourcesResourceidTelephoneNumberSummaryGetResponses200ContentApplicationJsonSchema { + /** AssetDetails Array */ + assetDetails: AssetDetails[]; +} + /** Model response for acquired number and limits. */ export interface AssetDetails { /** Array defining the number type of the phone number. */ @@ -69,8 +74,6 @@ export interface CommunicationError { export interface AcsTier { /** Tier Id. */ tierId?: string; - /** Correlation Id */ - correlationId?: string; /** Tier Type */ tierType?: string; /** Capabilities for the resource */ @@ -82,7 +85,7 @@ export interface AcsTierCapabilities { /** Phone number purchase capabilities of the tier. */ phoneNumberPurchase?: PhoneNumberPurchase[]; /** SMS capabilities of the tier. */ - sms?: AcsTierCapabilitiesSMS; + sms?: AcsTierCapabilitiesSms; /** Calling capabilities of the tier. */ calling?: AcsTierCapabilitiesCalling; /** Trial phone number purchase capability details. */ @@ -102,15 +105,15 @@ export interface PhoneNumberPurchase { } /** SMS capabilities of the tier. */ -export interface AcsTierCapabilitiesSMS { +export interface AcsTierCapabilitiesSms { /** SMS Outbound capabilities of the tier. */ - outbound?: SMSOutbound[]; + outbound?: SmsOutbound[]; /** SMS Inbound capabilities of the tier. */ - inbound?: SMSInbound[]; + inbound?: SmsInbound[]; } /** Sms Outbound Capabilities for the tier. */ -export interface SMSOutbound { +export interface SmsOutbound { /** Type of number. */ type?: string; /** The scope to apply the limits. */ @@ -122,7 +125,7 @@ export interface SMSOutbound { } /** Sms Inbound Capabilities for the tier. */ -export interface SMSInbound { +export interface SmsInbound { /** Type of number. */ type?: string; /** The scope to apply the limits. */ @@ -205,6 +208,8 @@ export interface TrialPhoneNumberUsageCallingBounds { totalMinutes?: number; /** The total call duration in minutes allowed for a trial number. */ maximumCallDurationMinutes?: number; + /** The number of concurrent calls allowed. */ + concurrentCalls?: number; } /** The SMS capabilities for the trial phone number. */ @@ -232,14 +237,14 @@ export interface NumberAllotmentGetAcquiredNumberLimitsOptionalParams extends coreClient.OperationOptions {} /** Contains response data for the getAcquiredNumberLimits operation. */ -export type NumberAllotmentGetAcquiredNumberLimitsResponse = AssetDetails[]; +export type NumberAllotmentGetAcquiredNumberLimitsResponse = Paths190FnhrAdministrationResourcesResourceidTelephoneNumberSummaryGetResponses200ContentApplicationJsonSchema; /** Optional parameters. */ export interface TieringGetByResourceIdOptionalParams extends coreClient.OperationOptions {} /** Contains response data for the getByResourceId operation. */ -export type TieringGetByResourceIdResponse = AcsTier[]; +export type TieringGetByResourceIdResponse = AcsTier; /** Optional parameters. */ export interface TieringClientOptionalParams diff --git a/sdk/communication/communication-tiering/src/generated/src/models/mappers.ts b/sdk/communication/communication-tiering/src/generated/src/models/mappers.ts index b189ca767977..eacaa6298fdf 100644 --- a/sdk/communication/communication-tiering/src/generated/src/models/mappers.ts +++ b/sdk/communication/communication-tiering/src/generated/src/models/mappers.ts @@ -8,13 +8,36 @@ import * as coreClient from "@azure/core-client"; +export const Paths190FnhrAdministrationResourcesResourceidTelephoneNumberSummaryGetResponses200ContentApplicationJsonSchema: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: + "Paths190FnhrAdministrationResourcesResourceidTelephoneNumberSummaryGetResponses200ContentApplicationJsonSchema", + modelProperties: { + assetDetails: { + serializedName: "assetDetails", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AssetDetails" + } + } + } + } + } + } +}; + export const AssetDetails: coreClient.CompositeMapper = { type: { name: "Composite", className: "AssetDetails", modelProperties: { numberType: { - serializedName: "NumberType", + serializedName: "numberType", type: { name: "Sequence", element: { @@ -25,25 +48,25 @@ export const AssetDetails: coreClient.CompositeMapper = { } }, resourceAcquiredCount: { - serializedName: "ResourceAcquiredCount", + serializedName: "resourceAcquiredCount", type: { name: "Number" } }, subscriptionAcquiredCount: { - serializedName: "SubscriptionAcquiredCount", + serializedName: "subscriptionAcquiredCount", type: { name: "Number" } }, aadTenantAcquiredCount: { - serializedName: "AadTenantAcquiredCount", + serializedName: "aadTenantAcquiredCount", type: { name: "Number" } }, tierInfo: { - serializedName: "TierInfo", + serializedName: "tierInfo", type: { name: "Composite", className: "AssetDetailsTierInfo" @@ -59,31 +82,31 @@ export const AssetDetailsTierInfo: coreClient.CompositeMapper = { className: "AssetDetailsTierInfo", modelProperties: { scope: { - serializedName: "Scope", + serializedName: "scope", type: { name: "String" } }, allowed: { - serializedName: "Allowed", + serializedName: "allowed", type: { name: "Number" } }, acquired: { - serializedName: "Acquired", + serializedName: "acquired", type: { name: "Number" } }, balance: { - serializedName: "Balance", + serializedName: "balance", type: { name: "Number" } }, limit: { - serializedName: "Limit", + serializedName: "limit", type: { name: "String" } @@ -164,25 +187,19 @@ export const AcsTier: coreClient.CompositeMapper = { className: "AcsTier", modelProperties: { tierId: { - serializedName: "TierId", - type: { - name: "String" - } - }, - correlationId: { - serializedName: "CorrelationId", + serializedName: "tierId", type: { name: "String" } }, tierType: { - serializedName: "TierType", + serializedName: "tierType", type: { name: "String" } }, capabilities: { - serializedName: "Capabilities", + serializedName: "capabilities", type: { name: "Composite", className: "AcsTierCapabilities" @@ -198,7 +215,7 @@ export const AcsTierCapabilities: coreClient.CompositeMapper = { className: "AcsTierCapabilities", modelProperties: { phoneNumberPurchase: { - serializedName: "PhoneNumberPurchase", + serializedName: "phoneNumberPurchase", type: { name: "Sequence", element: { @@ -210,21 +227,21 @@ export const AcsTierCapabilities: coreClient.CompositeMapper = { } }, sms: { - serializedName: "SMS", + serializedName: "sms", type: { name: "Composite", - className: "AcsTierCapabilitiesSMS" + className: "AcsTierCapabilitiesSms" } }, calling: { - serializedName: "Calling", + serializedName: "calling", type: { name: "Composite", className: "AcsTierCapabilitiesCalling" } }, trialPhoneNumberPurchase: { - serializedName: "TrialPhoneNumberPurchase", + serializedName: "trialPhoneNumberPurchase", type: { name: "Sequence", element: { @@ -236,7 +253,7 @@ export const AcsTierCapabilities: coreClient.CompositeMapper = { } }, trialPhoneNumberUsage: { - serializedName: "TrialPhoneNumberUsage", + serializedName: "trialPhoneNumberUsage", type: { name: "Sequence", element: { @@ -257,7 +274,7 @@ export const PhoneNumberPurchase: coreClient.CompositeMapper = { className: "PhoneNumberPurchase", modelProperties: { numberType: { - serializedName: "NumberType", + serializedName: "numberType", type: { name: "Sequence", element: { @@ -268,13 +285,13 @@ export const PhoneNumberPurchase: coreClient.CompositeMapper = { } }, scope: { - serializedName: "Scope", + serializedName: "scope", type: { name: "String" } }, totalNumbers: { - serializedName: "TotalNumbers", + serializedName: "totalNumbers", type: { name: "Number" } @@ -283,31 +300,31 @@ export const PhoneNumberPurchase: coreClient.CompositeMapper = { } }; -export const AcsTierCapabilitiesSMS: coreClient.CompositeMapper = { +export const AcsTierCapabilitiesSms: coreClient.CompositeMapper = { type: { name: "Composite", - className: "AcsTierCapabilitiesSMS", + className: "AcsTierCapabilitiesSms", modelProperties: { outbound: { - serializedName: "Outbound", + serializedName: "outbound", type: { name: "Sequence", element: { type: { name: "Composite", - className: "SMSOutbound" + className: "SmsOutbound" } } } }, inbound: { - serializedName: "Inbound", + serializedName: "inbound", type: { name: "Sequence", element: { type: { name: "Composite", - className: "SMSInbound" + className: "SmsInbound" } } } @@ -316,31 +333,31 @@ export const AcsTierCapabilitiesSMS: coreClient.CompositeMapper = { } }; -export const SMSOutbound: coreClient.CompositeMapper = { +export const SmsOutbound: coreClient.CompositeMapper = { type: { name: "Composite", - className: "SMSOutbound", + className: "SmsOutbound", modelProperties: { type: { - serializedName: "Type", + serializedName: "type", type: { name: "String" } }, scope: { - serializedName: "Scope", + serializedName: "scope", type: { name: "String" } }, smsPerMin: { - serializedName: "SmsPerMin", + serializedName: "smsPerMin", type: { name: "Number" } }, geographicLimitations: { - serializedName: "GeographicLimitations", + serializedName: "geographicLimitations", type: { name: "String" } @@ -349,31 +366,31 @@ export const SMSOutbound: coreClient.CompositeMapper = { } }; -export const SMSInbound: coreClient.CompositeMapper = { +export const SmsInbound: coreClient.CompositeMapper = { type: { name: "Composite", - className: "SMSInbound", + className: "SmsInbound", modelProperties: { type: { - serializedName: "Type", + serializedName: "type", type: { name: "String" } }, scope: { - serializedName: "Scope", + serializedName: "scope", type: { name: "String" } }, smsPerMin: { - serializedName: "SmsPerMin", + serializedName: "smsPerMin", type: { name: "Number" } }, geographicLimitations: { - serializedName: "GeographicLimitations", + serializedName: "geographicLimitations", type: { name: "String" } @@ -388,7 +405,7 @@ export const AcsTierCapabilitiesCalling: coreClient.CompositeMapper = { className: "AcsTierCapabilitiesCalling", modelProperties: { outbound: { - serializedName: "Outbound", + serializedName: "outbound", type: { name: "Sequence", element: { @@ -400,7 +417,7 @@ export const AcsTierCapabilitiesCalling: coreClient.CompositeMapper = { } }, inbound: { - serializedName: "Inbound", + serializedName: "inbound", type: { name: "Sequence", element: { @@ -421,25 +438,25 @@ export const CallingOutbound: coreClient.CompositeMapper = { className: "CallingOutbound", modelProperties: { type: { - serializedName: "Type", + serializedName: "type", type: { name: "String" } }, scope: { - serializedName: "Scope", + serializedName: "scope", type: { name: "String" } }, concurrentCalls: { - serializedName: "ConcurrentCalls", + serializedName: "concurrentCalls", type: { name: "Number" } }, geographicLimitations: { - serializedName: "GeographicLimitations", + serializedName: "geographicLimitations", type: { name: "String" } @@ -454,25 +471,25 @@ export const CallingInbound: coreClient.CompositeMapper = { className: "CallingInbound", modelProperties: { type: { - serializedName: "Type", + serializedName: "type", type: { name: "String" } }, scope: { - serializedName: "Scope", + serializedName: "scope", type: { name: "String" } }, concurrentCalls: { - serializedName: "ConcurrentCalls", + serializedName: "concurrentCalls", type: { name: "Number" } }, geographicLimitations: { - serializedName: "GeographicLimitations", + serializedName: "geographicLimitations", type: { name: "String" } @@ -487,7 +504,7 @@ export const TrialPhoneNumberPurchase: coreClient.CompositeMapper = { className: "TrialPhoneNumberPurchase", modelProperties: { numberType: { - serializedName: "NumberType", + serializedName: "numberType", type: { name: "Sequence", element: { @@ -498,19 +515,19 @@ export const TrialPhoneNumberPurchase: coreClient.CompositeMapper = { } }, scope: { - serializedName: "Scope", + serializedName: "scope", type: { name: "String" } }, totalNumbers: { - serializedName: "TotalNumbers", + serializedName: "totalNumbers", type: { name: "Number" } }, trialPeriodDays: { - serializedName: "TrialPeriodDays", + serializedName: "trialPeriodDays", type: { name: "Number" } @@ -525,20 +542,20 @@ export const TrialPhoneNumberUsage: coreClient.CompositeMapper = { className: "TrialPhoneNumberUsage", modelProperties: { numberType: { - serializedName: "NumberType", + serializedName: "numberType", type: { name: "String" } }, calling: { - serializedName: "Calling", + serializedName: "calling", type: { name: "Composite", className: "TrialPhoneNumberUsageCalling" } }, sms: { - serializedName: "Sms", + serializedName: "sms", type: { name: "Composite", className: "TrialPhoneNumberUsageSms" @@ -554,7 +571,7 @@ export const TrialPhoneNumberUsageCalling: coreClient.CompositeMapper = { className: "TrialPhoneNumberUsageCalling", modelProperties: { outbound: { - serializedName: "Outbound", + serializedName: "outbound", type: { name: "Sequence", element: { @@ -566,7 +583,7 @@ export const TrialPhoneNumberUsageCalling: coreClient.CompositeMapper = { } }, inbound: { - serializedName: "Inbound", + serializedName: "inbound", type: { name: "Sequence", element: { @@ -587,25 +604,31 @@ export const TrialPhoneNumberUsageCallingBounds: coreClient.CompositeMapper = { className: "TrialPhoneNumberUsageCallingBounds", modelProperties: { type: { - serializedName: "Type", + serializedName: "type", type: { name: "String" } }, scope: { - serializedName: "Scope", + serializedName: "scope", type: { name: "String" } }, totalMinutes: { - serializedName: "TotalMinutes", + serializedName: "totalMinutes", type: { name: "Number" } }, maximumCallDurationMinutes: { - serializedName: "MaximumCallDurationMinutes", + serializedName: "maximumCallDurationMinutes", + type: { + name: "Number" + } + }, + concurrentCalls: { + serializedName: "concurrentCalls", type: { name: "Number" } @@ -620,7 +643,7 @@ export const TrialPhoneNumberUsageSms: coreClient.CompositeMapper = { className: "TrialPhoneNumberUsageSms", modelProperties: { outbound: { - serializedName: "Outbound", + serializedName: "outbound", type: { name: "Sequence", element: { @@ -632,7 +655,7 @@ export const TrialPhoneNumberUsageSms: coreClient.CompositeMapper = { } }, inbound: { - serializedName: "Inbound", + serializedName: "inbound", type: { name: "Sequence", element: { @@ -653,25 +676,25 @@ export const TrialPhoneNumberUsageSmsBounds: coreClient.CompositeMapper = { className: "TrialPhoneNumberUsageSmsBounds", modelProperties: { type: { - serializedName: "Type", + serializedName: "type", type: { name: "String" } }, scope: { - serializedName: "Scope", + serializedName: "scope", type: { name: "String" } }, total: { - serializedName: "Total", + serializedName: "total", type: { name: "Number" } }, smsPerMin: { - serializedName: "SmsPerMin", + serializedName: "smsPerMin", type: { name: "Number" } diff --git a/sdk/communication/communication-tiering/src/generated/src/models/parameters.ts b/sdk/communication/communication-tiering/src/generated/src/models/parameters.ts index 9f4ab0033912..96d67aaabdb0 100644 --- a/sdk/communication/communication-tiering/src/generated/src/models/parameters.ts +++ b/sdk/communication/communication-tiering/src/generated/src/models/parameters.ts @@ -50,7 +50,7 @@ export const resourceId: OperationURLParameter = { export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - defaultValue: "2022-11-15", + defaultValue: "2023-06-15", isConstant: true, serializedName: "api-version", type: { diff --git a/sdk/communication/communication-tiering/src/generated/src/operations/numberAllotment.ts b/sdk/communication/communication-tiering/src/generated/src/operations/numberAllotment.ts index e7ca33415f08..026ca61ab667 100644 --- a/sdk/communication/communication-tiering/src/generated/src/operations/numberAllotment.ts +++ b/sdk/communication/communication-tiering/src/generated/src/operations/numberAllotment.ts @@ -58,12 +58,8 @@ const getAcquiredNumberLimitsOperationSpec: coreClient.OperationSpec = { httpMethod: "GET", responses: { 200: { - bodyMapper: { - type: { - name: "Sequence", - element: { type: { name: "Composite", className: "AssetDetails" } } - } - } + bodyMapper: + Mappers.Paths190FnhrAdministrationResourcesResourceidTelephoneNumberSummaryGetResponses200ContentApplicationJsonSchema }, default: { bodyMapper: Mappers.CommunicationErrorResponse diff --git a/sdk/communication/communication-tiering/src/generated/src/operations/tiering.ts b/sdk/communication/communication-tiering/src/generated/src/operations/tiering.ts index 1ee6a9b4b7cb..e5b5702162be 100644 --- a/sdk/communication/communication-tiering/src/generated/src/operations/tiering.ts +++ b/sdk/communication/communication-tiering/src/generated/src/operations/tiering.ts @@ -58,12 +58,7 @@ const getByResourceIdOperationSpec: coreClient.OperationSpec = { httpMethod: "GET", responses: { 200: { - bodyMapper: { - type: { - name: "Sequence", - element: { type: { name: "Composite", className: "AcsTier" } } - } - } + bodyMapper: Mappers.AcsTier }, default: { bodyMapper: Mappers.CommunicationErrorResponse diff --git a/sdk/communication/communication-tiering/src/generated/src/tieringClient.ts b/sdk/communication/communication-tiering/src/generated/src/tieringClient.ts index 77e9353cec9a..2b891ce9425b 100644 --- a/sdk/communication/communication-tiering/src/generated/src/tieringClient.ts +++ b/sdk/communication/communication-tiering/src/generated/src/tieringClient.ts @@ -81,7 +81,7 @@ export class TieringClient extends coreClient.ServiceClient { this.endpoint = endpoint; // Assigning values to Constant parameters - this.apiVersion = options.apiVersion || "2022-11-15"; + this.apiVersion = options.apiVersion || "2023-06-15"; this.numberAllotment = new NumberAllotmentImpl(this); this.tiering = new TieringImpl(this); this.addCustomApiVersionPolicy(options.apiVersion); diff --git a/sdk/communication/communication-tiering/src/mapper.ts b/sdk/communication/communication-tiering/src/mapper.ts index 7b0184de6d7e..2151ce81565b 100644 --- a/sdk/communication/communication-tiering/src/mapper.ts +++ b/sdk/communication/communication-tiering/src/mapper.ts @@ -6,4 +6,5 @@ export { AssetDetailsTierInfo as AssetDetailsTierInfoMapper } from "./generated/ export { AcsTier as AcsTierMapper } from "./generated/src/models/mappers"; export { AcsTierCapabilities as AcsTierCapabilitiesMappers } from "./generated/src/models/mappers"; export { AcsTierCapabilitiesCalling as AcsTierCapabilitiesCallingMapper } from "./generated/src/models/mappers"; -export { AcsTierCapabilitiesSMS as AcsTierCapabilitiesSMSMapper } from "./generated/src/models/mappers"; +export { AcsTierCapabilitiesSms as AcsTierCapabilitiesSMSMapper } from "./generated/src/models/mappers"; +export { Paths190FnhrAdministrationResourcesResourceidTelephoneNumberSummaryGetResponses200ContentApplicationJsonSchema as AssetDetailsResponseMapper } from "./generated/src/models/mappers"; diff --git a/sdk/communication/communication-tiering/src/models.ts b/sdk/communication/communication-tiering/src/models.ts index ef47540edc25..fbf91fdd212f 100644 --- a/sdk/communication/communication-tiering/src/models.ts +++ b/sdk/communication/communication-tiering/src/models.ts @@ -10,18 +10,19 @@ export { AcsTier, AcsTierCapabilities, AcsTierCapabilitiesCalling, - AcsTierCapabilitiesSMS, + AcsTierCapabilitiesSms, TieringGetByResourceIdOptionalParams, TieringGetByResourceIdResponse, TrialPhoneNumberUsage, TrialPhoneNumberPurchase, TrialPhoneNumberUsageSms, PhoneNumberPurchase, - SMSInbound, - SMSOutbound, + SmsInbound, + SmsOutbound, CallingInbound, CallingOutbound, TrialPhoneNumberUsageCalling, TrialPhoneNumberUsageSmsBounds, TrialPhoneNumberUsageCallingBounds, + Paths190FnhrAdministrationResourcesResourceidTelephoneNumberSummaryGetResponses200ContentApplicationJsonSchema, } from "./generated/src/models"; From 00711a12302f3c22f1ec43edbb427f80cbf8f88c Mon Sep 17 00:00:00 2001 From: Babacar Ndoye Date: Mon, 5 Jun 2023 12:24:51 -0500 Subject: [PATCH 09/21] api extractor --- .../review/communication-tiering.api.md | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/sdk/communication/communication-tiering/review/communication-tiering.api.md b/sdk/communication/communication-tiering/review/communication-tiering.api.md index 0afa47575203..d626e5079850 100644 --- a/sdk/communication/communication-tiering/review/communication-tiering.api.md +++ b/sdk/communication/communication-tiering/review/communication-tiering.api.md @@ -14,7 +14,6 @@ import { TokenCredential } from '@azure/core-auth'; // @public export interface AcsTier { capabilities?: AcsTierCapabilities; - correlationId?: string; tierId?: string; tierType?: string; } @@ -23,7 +22,7 @@ export interface AcsTier { export interface AcsTierCapabilities { calling?: AcsTierCapabilitiesCalling; phoneNumberPurchase?: PhoneNumberPurchase[]; - sms?: AcsTierCapabilitiesSMS; + sms?: AcsTierCapabilitiesSms; trialPhoneNumberPurchase?: TrialPhoneNumberPurchase[]; trialPhoneNumberUsage?: TrialPhoneNumberUsage[]; } @@ -41,9 +40,9 @@ export const AcsTierCapabilitiesCallingMapper: coreClient.CompositeMapper; export const AcsTierCapabilitiesMappers: coreClient.CompositeMapper; // @public -export interface AcsTierCapabilitiesSMS { - inbound?: SMSInbound[]; - outbound?: SMSOutbound[]; +export interface AcsTierCapabilitiesSms { + inbound?: SmsInbound[]; + outbound?: SmsOutbound[]; } // @public (undocumented) @@ -64,6 +63,9 @@ export interface AssetDetails { // @public (undocumented) export const AssetDetailsMapper: coreClient.CompositeMapper; +// @public (undocumented) +export const AssetDetailsResponseMapper: coreClient.CompositeMapper; + // @public export interface AssetDetailsTierInfo { acquired?: number; @@ -97,7 +99,12 @@ export interface NumberAllotmentGetAcquiredNumberLimitsOptionalParams extends co } // @public -export type NumberAllotmentGetAcquiredNumberLimitsResponse = AssetDetails[]; +export type NumberAllotmentGetAcquiredNumberLimitsResponse = Paths190FnhrAdministrationResourcesResourceidTelephoneNumberSummaryGetResponses200ContentApplicationJsonSchema; + +// @public (undocumented) +export interface Paths190FnhrAdministrationResourcesResourceidTelephoneNumberSummaryGetResponses200ContentApplicationJsonSchema { + assetDetails: AssetDetails[]; +} // @public export interface PhoneNumberPurchase { @@ -107,7 +114,7 @@ export interface PhoneNumberPurchase { } // @public -export interface SMSInbound { +export interface SmsInbound { geographicLimitations?: string; scope?: string; smsPerMin?: number; @@ -115,7 +122,7 @@ export interface SMSInbound { } // @public -export interface SMSOutbound { +export interface SmsOutbound { geographicLimitations?: string; scope?: string; smsPerMin?: number; @@ -146,7 +153,7 @@ export interface TieringGetByResourceIdOptionalParams extends coreClient.Operati } // @public -export type TieringGetByResourceIdResponse = AcsTier[]; +export type TieringGetByResourceIdResponse = AcsTier; // @public export interface TrialPhoneNumberPurchase { @@ -171,6 +178,7 @@ export interface TrialPhoneNumberUsageCalling { // @public export interface TrialPhoneNumberUsageCallingBounds { + concurrentCalls?: number; maximumCallDurationMinutes?: number; scope?: string; totalMinutes?: number; From ab99bc82e8e812a8e0d419c7da9e58d2c0bd9fcc Mon Sep 17 00:00:00 2001 From: Babacar Ndoye Date: Mon, 5 Jun 2023 12:33:42 -0500 Subject: [PATCH 10/21] updating the swagger --- .../swagger/swagger.json | 194 +++++++++--------- 1 file changed, 99 insertions(+), 95 deletions(-) diff --git a/sdk/communication/communication-tiering/swagger/swagger.json b/sdk/communication/communication-tiering/swagger/swagger.json index db048ded842d..887b536f2614 100644 --- a/sdk/communication/communication-tiering/swagger/swagger.json +++ b/sdk/communication/communication-tiering/swagger/swagger.json @@ -3,7 +3,7 @@ "info": { "title": "TieringClient", "description": "The tiering client library retrieves limits for each capability (SMS/PSTN Calling/Phone Number purchase) for a specific resource/tier.", - "version": "2022-11-15" + "version": "2023-06-15" }, "paths": { "/administration/resources/{resourceId}/telephone-number-summary": { @@ -33,10 +33,17 @@ "200": { "description": "Success", "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/AssetDetails" - } + "type": "object", + "properties": { + "assetDetails": { + "description": "AssetDetails Array", + "type": "array", + "items": { + "$ref": "#/definitions/assetDetails" + } + } + }, + "required":["assetDetails"] } }, "default": { @@ -80,10 +87,7 @@ "200": { "description": "Success", "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/AcsTier" - } + "$ref": "#/definitions/acsTier" } }, "default": { @@ -102,50 +106,50 @@ } }, "definitions": { - "AssetDetails": { + "assetDetails": { "description": "Model response for acquired number and limits.", "type": "object", "properties": { - "NumberType": { + "numberType": { "description": "Array defining the number type of the phone number.", "type": "array", "items": { "type": "string" } }, - "ResourceAcquiredCount": { + "resourceAcquiredCount": { "description": "Number of phone numbers that the resource has.", "type": "integer" }, - "SubscriptionAcquiredCount": { + "subscriptionAcquiredCount": { "description": "Number of phone numbers that the subscription that the resource belongs to has.", "type": "integer" }, - "AadTenantAcquiredCount": { + "aadTenantAcquiredCount": { "description": "Number of phone numbers that the AAD tenant that the resource belongs to has.", "type": "integer" }, - "TierInfo": { + "tierInfo": { "description": "Tier specific info.", "type": "object", "properties": { - "Scope": { + "scope": { "description": "The level at which the tiering properties in the TierInfo are for", "type": "string" }, - "Allowed": { + "allowed": { "description": "Number of phone numbers allowed that can change based on scope where scope can be (resource, subscription or tenant).", "type": "integer" }, - "Acquired": { + "acquired": { "description": "Number of phone numbers acquired that can change based on scope where scope can be (resource, subscription or tenant).", "type": "integer" }, - "Balance": { + "balance": { "description": "Difference between allowed and acquired amount.", "type": "integer" }, - "Limit": { + "limit": { "description": "The standing of a customer to determine if they able to purchase more phone numbers.", "type": "string" } @@ -153,313 +157,313 @@ } } }, - "AcsTier": { + "acsTier": { "description": "Represents an ACS Tier resource.", "type": "object", "properties": { - "TierId": { + "tierId": { "description": "Tier Id.", "type": "string" }, - "CorrelationId": { - "description": "Correlation Id", - "type": "string" - }, - "TierType": { + "tierType": { "description": "Tier Type", "type": "string" }, - "Capabilities": { + "capabilities": { "description": "Capabilities for the resource", "type": "object", "properties": { - "PhoneNumberPurchase": { + "phoneNumberPurchase": { "description": "Phone number purchase capabilities of the tier.", "type": "array", "items": { - "$ref": "#/definitions/PhoneNumberPurchase" + "$ref": "#/definitions/phoneNumberPurchase" } }, - "SMS": { + "sms": { "description": "SMS capabilities of the tier.", "type": "object", "properties": { - "Outbound": { + "outbound": { "description": "SMS Outbound capabilities of the tier.", "type": "array", "items": { - "$ref": "#/definitions/SMSOutbound" + "$ref": "#/definitions/smsOutbound" } }, - "Inbound": { + "inbound": { "description": "SMS Inbound capabilities of the tier.", "type": "array", "items": { - "$ref": "#/definitions/SMSInbound" + "$ref": "#/definitions/smsInbound" } } } }, - "Calling": { + "calling": { "description": "Calling capabilities of the tier.", "type": "object", "properties": { - "Outbound": { + "outbound": { "description": "Calling Outbound capabilities of the tier.", "type": "array", "items": { - "$ref": "#/definitions/CallingOutbound" + "$ref": "#/definitions/callingOutbound" } }, - "Inbound": { + "inbound": { "description": "Calling Inbound capabilities of the tier.", "type": "array", "items": { - "$ref": "#/definitions/CallingInbound" + "$ref": "#/definitions/callingInbound" } } } }, - "TrialPhoneNumberPurchase": { + "trialPhoneNumberPurchase": { "description": "Trial phone number purchase capability details.", "type": "array", "items": { - "$ref": "#/definitions/TrialPhoneNumberPurchase" + "$ref": "#/definitions/trialPhoneNumberPurchase" } }, - "TrialPhoneNumberUsage": { + "trialPhoneNumberUsage": { "description": "Trial phone number usage of the tier.", "type": "array", "items": { - "$ref": "#/definitions/TrialPhoneNumberUsage" + "$ref": "#/definitions/trialPhoneNumberUsage" } } } } } }, - "PhoneNumberPurchase":{ + "phoneNumberPurchase":{ "description": "Phone number purchase capability details.", "type":"object", "properties": { - "NumberType": { + "numberType": { "description": "Types to apply the limit to.", "type": "array", "items": { "type": "string" } }, - "Scope": { + "scope": { "description": "The scope to apply the limits.", "type": "string" }, - "TotalNumbers": { + "totalNumbers": { "description": "The limit of numbers allowed for purchase for the number type.", "type": "integer" } } }, - "SMSOutbound":{ + "smsOutbound":{ "description": "Sms Outbound Capabilities for the tier.", "type":"object", "properties": { - "Type": { + "type": { "description": "Type of number.", "type": "string" }, - "Scope": { + "scope": { "description": "The scope to apply the limits.", "type": "string" }, - "SmsPerMin": { + "smsPerMin": { "description": "The limit of SMSs a customer can send per minute.", "type": "integer" }, - "GeographicLimitations": { + "geographicLimitations": { "description": "The areas where an SMS is allowed to be sent.", "type": "string" } } }, - "SMSInbound":{ + "smsInbound":{ "description": "Sms Inbound Capabilities for the tier.", "type":"object", "properties": { - "Type": { + "type": { "description": "Type of number.", "type": "string" }, - "Scope": { + "scope": { "description": "The scope to apply the limits.", "type": "string" }, - "SmsPerMin": { + "smsPerMin": { "description": "The limit of SMSs a customer can send per minute.", "type": "integer" }, - "GeographicLimitations": { + "geographicLimitations": { "description": "The areas where an SMS is allowed to be sent.", "type": "string" } } }, - "CallingOutbound":{ + "callingOutbound":{ "description": "Calling Outbound Capabilities for the tier.", "type":"object", "properties": { - "Type": { + "type": { "description": "Type of calling.", "type": "string" }, - "Scope": { + "scope": { "description": "The scope to apply the limits.", "type": "string" }, - "ConcurrentCalls": { + "concurrentCalls": { "description": "The number of concurrent calls allowed.", "type": "integer" }, - "GeographicLimitations": { + "geographicLimitations": { "description": "The areas where calls are allowed to take place.", "type": "string" } } }, - "CallingInbound":{ + "callingInbound":{ "description": "Calling Outbound Capabilities for the tier.", "type":"object", "properties": { - "Type": { + "type": { "description": "Type of calling.", "type": "string" }, - "Scope": { + "scope": { "description": "The scope to apply the limits.", "type": "string" }, - "ConcurrentCalls": { + "concurrentCalls": { "description": "The number of concurrent calls allowed.", "type": "integer" }, - "GeographicLimitations": { + "geographicLimitations": { "description": "The areas where calls are allowed to take place.", "type": "string" } } }, - "TrialPhoneNumberUsageCallingBounds":{ + "trialPhoneNumberUsageCallingBounds":{ "description": "Trial phone number capability details.", "type":"object", "properties": { - "Type": { + "type": { "description": " Type of calling.", "type": "string" }, - "Scope": { + "scope": { "description": "The scope to apply the limits to.", "type": "string" }, - "TotalMinutes": { + "totalMinutes": { "description": "The total calling minutes allowed for a tial number.", "type": "integer" }, - "MaximumCallDurationMinutes": { + "maximumCallDurationMinutes": { "description": "The total call duration in minutes allowed for a trial number.", "type": "integer" + }, + "concurrentCalls": { + "description": "The number of concurrent calls allowed.", + "type": "integer" } } }, - "TrialPhoneNumberUsageSmsBounds":{ + "trialPhoneNumberUsageSmsBounds":{ "description": "Trial phone number SMS capability details.", "type":"object", "properties": { - "Type": { + "type": { "description": "The type of SMS.", "type": "string" }, - "Scope": { + "scope": { "description": "The scope to apply the limits to.", "type": "string" }, - "Total": { + "total": { "description": "Total", "type": "integer" }, - "SmsPerMin": { + "smsPerMin": { "description": "The total SMSs allowed to be sent in a minute.", "type": "integer" } } }, - "TrialPhoneNumberPurchase":{ + "trialPhoneNumberPurchase":{ "description": "Trial phone number purchase capability details.", "type":"object", "properties": { - "NumberType": { + "numberType": { "description": "Types to apply the limit to.", "type": "array", "items": { "type": "string" } }, - "Scope": { + "scope": { "description": "The scope to apply the limits.", "type": "string" }, - "TotalNumbers": { + "totalNumbers": { "description": "The limit of numbers allowed for purchase for the number type.", "type": "integer" }, - "TrialPeriodDays": { + "trialPeriodDays": { "description": "The number of days in the trial period for the number type.", "type": "integer" } } }, - "TrialPhoneNumberUsage":{ + "trialPhoneNumberUsage":{ "description": "Trial phone number usage capability details.", "type":"object", "properties": { - "NumberType": { + "numberType": { "description": "The number type.", "type": "string" }, - "Calling": { + "calling": { "description": "The capabilities for calling.", "type": "object", "properties": { - "Outbound": { + "outbound": { "description": "The Outbound capabilities for calling.", "type": "array", "items": { - "$ref": "#/definitions/TrialPhoneNumberUsageCallingBounds" + "$ref": "#/definitions/trialPhoneNumberUsageCallingBounds" } }, - "Inbound": { + "inbound": { "description": "The Inbound capabilities for calling.", "type": "array", "items": { - "$ref": "#/definitions/TrialPhoneNumberUsageCallingBounds" + "$ref": "#/definitions/trialPhoneNumberUsageCallingBounds" } } } }, - "Sms": { + "sms": { "description": "The SMS capabilities for the trial phone number.", "type": "object", "properties": { - "Outbound": { + "outbound": { "description": "Outbound trial phone number SMS capabilities.", "type": "array", "items": { - "$ref": "#/definitions/TrialPhoneNumberUsageSmsBounds" + "$ref": "#/definitions/trialPhoneNumberUsageSmsBounds" } }, - "Inbound": { + "inbound": { "description": "Inbound trial phone number SMS capabilities.", "type": "array", "items": { - "$ref": "#/definitions/TrialPhoneNumberUsageSmsBounds" + "$ref": "#/definitions/trialPhoneNumberUsageSmsBounds" } } } From 88021ffe1c1c288ab1cb4bd9a3c246be64f51ab1 Mon Sep 17 00:00:00 2001 From: Babacar Ndoye Date: Mon, 5 Jun 2023 12:44:10 -0500 Subject: [PATCH 11/21] tests --- .../recording_get_acquired_number_limits.json | 78 ++++++++ .../recording_get_tier_info.json | 176 ++++++++++++++++++ .../recording_get_acquired_number_limits.json | 69 +++++++ .../recording_get_tier_info.json | 167 +++++++++++++++++ .../test/public/ctor.spec.ts | 34 ++++ .../public/getAcquiredNumberLimit.spec.ts | 30 +++ .../test/public/getTierInfo.spec.ts | 30 +++ .../test/public/utils/recordedClient.ts | 125 +++++++++++++ 8 files changed, 709 insertions(+) create mode 100644 sdk/communication/communication-tiering/recordings/browsers/tieringclient__get_acquired_number_limits/recording_get_acquired_number_limits.json create mode 100644 sdk/communication/communication-tiering/recordings/browsers/tieringclient__get_tier_info/recording_get_tier_info.json create mode 100644 sdk/communication/communication-tiering/recordings/node/tieringclient__get_acquired_number_limits/recording_get_acquired_number_limits.json create mode 100644 sdk/communication/communication-tiering/recordings/node/tieringclient__get_tier_info/recording_get_tier_info.json create mode 100644 sdk/communication/communication-tiering/test/public/ctor.spec.ts create mode 100644 sdk/communication/communication-tiering/test/public/getAcquiredNumberLimit.spec.ts create mode 100644 sdk/communication/communication-tiering/test/public/getTierInfo.spec.ts create mode 100644 sdk/communication/communication-tiering/test/public/utils/recordedClient.ts diff --git a/sdk/communication/communication-tiering/recordings/browsers/tieringclient__get_acquired_number_limits/recording_get_acquired_number_limits.json b/sdk/communication/communication-tiering/recordings/browsers/tieringclient__get_acquired_number_limits/recording_get_acquired_number_limits.json new file mode 100644 index 000000000000..df6bc2f36616 --- /dev/null +++ b/sdk/communication/communication-tiering/recordings/browsers/tieringclient__get_acquired_number_limits/recording_get_acquired_number_limits.json @@ -0,0 +1,78 @@ +{ + "Entries": [ + { + "RequestUri": "https://endpoint/administration/resources/9d787bd6-07fc-4c7b-8e57-17f1fee41298/telephone-number-summary?api-version=2023-06-15", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate, br", + "Accept-Language": "en-US", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "Referer": "http://localhost:9876/", + "sec-ch-ua": "", + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": "\u0022\u0022", + "Sec-Fetch-Dest": "empty", + "Sec-Fetch-Mode": "cors", + "Sec-Fetch-Site": "same-site", + "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/112.0.5614.0 Safari/537.36", + "x-ms-client-request-id": "9d787bd6-07fc-4c7b-8e57-17f1fee41298", + "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", + "x-ms-date": "Mon, 05 Jun 2023 17:37:52 GMT", + "x-ms-useragent": "azsdk-js-communication-tiering/1.0.0-beta.0 core-rest-pipeline/1.10.4 OS" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Accept-Ranges": "bytes", + "Connection": "keep-alive", + "Content-Length": "464", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 05 Jun 2023 17:37:51 GMT", + "MS-CV": "cwBI4BflqkSis2czSHDs6w.0", + "Strict-Transport-Security": "max-age=2592000", + "x-azure-ref": "20230605T173749Z-knytndh8m91dh5apppub1spe1g00000007b000000000ff86", + "X-Cache": "CONFIG_NOCACHE", + "X-Processing-Time": "1679ms" + }, + "ResponseBody": { + "AssetDetails": [ + { + "NumberType": [ + "Geographic", + "TollFree", + "Mobile" + ], + "ResourceAcquiredCount": 0, + "SubscriptionAcquiredCount": 43, + "AadTenantAcquiredCount": 65, + "TierInfo": { + "Scope": "Tenant", + "Allowed": 1, + "Acquired": 65, + "Balance": 0, + "Limit": "AcquisitionAboveLimit" + } + }, + { + "NumberType": [ + "ShortCode" + ], + "ResourceAcquiredCount": 0, + "SubscriptionAcquiredCount": 2, + "AadTenantAcquiredCount": 2, + "TierInfo": { + "Scope": "Tenant", + "Allowed": 0, + "Acquired": 2, + "Balance": 0, + "Limit": "AcquisitionAboveLimit" + } + } + ] + } + } + ], + "Variables": {} +} diff --git a/sdk/communication/communication-tiering/recordings/browsers/tieringclient__get_tier_info/recording_get_tier_info.json b/sdk/communication/communication-tiering/recordings/browsers/tieringclient__get_tier_info/recording_get_tier_info.json new file mode 100644 index 000000000000..034e12c6ae9b --- /dev/null +++ b/sdk/communication/communication-tiering/recordings/browsers/tieringclient__get_tier_info/recording_get_tier_info.json @@ -0,0 +1,176 @@ +{ + "Entries": [ + { + "RequestUri": "https://endpoint/administration/tiers/resources/9d787bd6-07fc-4c7b-8e57-17f1fee41298?api-version=2023-06-15", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip, deflate, br", + "Accept-Language": "en-US", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "Referer": "http://localhost:9876/", + "sec-ch-ua": "", + "sec-ch-ua-mobile": "?0", + "sec-ch-ua-platform": "\u0022\u0022", + "Sec-Fetch-Dest": "empty", + "Sec-Fetch-Mode": "cors", + "Sec-Fetch-Site": "same-site", + "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/112.0.5614.0 Safari/537.36", + "x-ms-client-request-id": "9d787bd6-07fc-4c7b-8e57-17f1fee41298", + "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", + "x-ms-date": "Mon, 05 Jun 2023 17:37:55 GMT", + "x-ms-useragent": "azsdk-js-communication-tiering/1.0.0-beta.0 core-rest-pipeline/1.10.4 OS" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Accept-Ranges": "bytes", + "api-supported-versions": "2023-06-15", + "Connection": "keep-alive", + "Content-Length": "1516", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 05 Jun 2023 17:37:52 GMT", + "MS-CV": "Bj7tREFaCEmI9GYy/x9K7Q.0", + "Strict-Transport-Security": "max-age=2592000", + "x-azure-ref": "20230605T173752Z-knytndh8m91dh5apppub1spe1g00000007b000000000ffpd", + "X-Cache": "CONFIG_NOCACHE", + "X-Processing-Time": "225ms" + }, + "ResponseBody": { + "tierId": "9d787bd6-07fc-4c7b-8e57-17f1fee41298", + "tierType": "Basic", + "capabilities": { + "sms": { + "outbound": [ + { + "type": "SMS", + "scope": "PhoneNumber", + "smsPerMin": 200, + "geographicLimitations": "Domestic" + }, + { + "type": "ShortCode", + "scope": "PhoneNumber", + "smsPerMin": 0, + "geographicLimitations": "Domestic" + }, + { + "type": "AlphaDynamic", + "scope": "Resource", + "smsPerMin": 0, + "geographicLimitations": "Domestic" + } + ], + "inbound": [] + }, + "calling": { + "outbound": [ + { + "type": "Call", + "scope": "PhoneNumber", + "concurrentCalls": 2, + "geographicLimitations": "Domestic" + } + ], + "inbound": [ + { + "type": "Call", + "scope": "PhoneNumber", + "concurrentCalls": 2, + "geographicLimitations": "Domestic" + } + ] + }, + "phoneNumberPurchase": [ + { + "numberType": [ + "TollFree", + "Geographic", + "Mobile" + ], + "scope": "Tenant", + "totalNumbers": 1 + }, + { + "numberType": [ + "ShortCode" + ], + "scope": "Tenant", + "totalNumbers": 0 + }, + { + "numberType": [ + "AlphaDynamic" + ], + "scope": "Tenant", + "totalNumbers": 0 + } + ], + "trialPhoneNumberPurchase": [ + { + "numberType": [ + "TollFree" + ], + "scope": "Subscription", + "totalNumbers": 3, + "trialPeriodDays": 30 + }, + { + "numberType": [ + "TollFree" + ], + "scope": "Resource", + "totalNumbers": 1, + "trialPeriodDays": 30 + } + ], + "trialPhoneNumberUsage": [ + { + "numberType": "TollFree", + "calling": { + "outbound": [ + { + "type": "Call", + "scope": "PhoneNumber", + "totalMinutes": 60, + "maximumCallDurationMinutes": 5, + "concurrentCalls": 0 + } + ], + "inbound": [ + { + "type": "Call", + "scope": "PhoneNumber", + "totalMinutes": 60, + "maximumCallDurationMinutes": 5, + "concurrentCalls": 0 + } + ] + }, + "sms": { + "outbound": [ + { + "type": "SMS", + "scope": "PhoneNumber", + "total": 100, + "smsPerMin": 5 + } + ], + "inbound": [ + { + "type": "SMS", + "scope": "PhoneNumber", + "total": 100, + "smsPerMin": 5 + } + ] + } + } + ] + } + } + } + ], + "Variables": {} +} diff --git a/sdk/communication/communication-tiering/recordings/node/tieringclient__get_acquired_number_limits/recording_get_acquired_number_limits.json b/sdk/communication/communication-tiering/recordings/node/tieringclient__get_acquired_number_limits/recording_get_acquired_number_limits.json new file mode 100644 index 000000000000..7cfe78c14c23 --- /dev/null +++ b/sdk/communication/communication-tiering/recordings/node/tieringclient__get_acquired_number_limits/recording_get_acquired_number_limits.json @@ -0,0 +1,69 @@ +{ + "Entries": [ + { + "RequestUri": "https://endpoint/administration/resources/9d787bd6-07fc-4c7b-8e57-17f1fee41298/telephone-number-summary?api-version=2023-06-15", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-communication-tiering/1.0.0-beta.0 core-rest-pipeline/1.10.4 Node/v18.12.1 OS/(x64-Linux-5.15.90.1-microsoft-standard-WSL2)", + "x-ms-client-request-id": "9d787bd6-07fc-4c7b-8e57-17f1fee41298", + "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", + "x-ms-date": "Mon, 05 Jun 2023 17:37:38 GMT" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Accept-Ranges": "bytes", + "Connection": "keep-alive", + "Content-Length": "464", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 05 Jun 2023 17:37:37 GMT", + "MS-CV": "F/MpbJ2zlkOlFy16J/H14g.0", + "Strict-Transport-Security": "max-age=2592000", + "x-azure-ref": "20230605T173735Z-pbnsyacqb97s5787bax4emxtw800000001g0000000011vb8", + "X-Cache": "CONFIG_NOCACHE", + "X-Processing-Time": "1679ms" + }, + "ResponseBody": { + "AssetDetails": [ + { + "NumberType": [ + "Geographic", + "TollFree", + "Mobile" + ], + "ResourceAcquiredCount": 0, + "SubscriptionAcquiredCount": 43, + "AadTenantAcquiredCount": 65, + "TierInfo": { + "Scope": "Tenant", + "Allowed": 1, + "Acquired": 65, + "Balance": 0, + "Limit": "AcquisitionAboveLimit" + } + }, + { + "NumberType": [ + "ShortCode" + ], + "ResourceAcquiredCount": 0, + "SubscriptionAcquiredCount": 2, + "AadTenantAcquiredCount": 2, + "TierInfo": { + "Scope": "Tenant", + "Allowed": 0, + "Acquired": 2, + "Balance": 0, + "Limit": "AcquisitionAboveLimit" + } + } + ] + } + } + ], + "Variables": {} +} diff --git a/sdk/communication/communication-tiering/recordings/node/tieringclient__get_tier_info/recording_get_tier_info.json b/sdk/communication/communication-tiering/recordings/node/tieringclient__get_tier_info/recording_get_tier_info.json new file mode 100644 index 000000000000..5291dda86c1b --- /dev/null +++ b/sdk/communication/communication-tiering/recordings/node/tieringclient__get_tier_info/recording_get_tier_info.json @@ -0,0 +1,167 @@ +{ + "Entries": [ + { + "RequestUri": "https://endpoint/administration/tiers/resources/9d787bd6-07fc-4c7b-8e57-17f1fee41298?api-version=2023-06-15", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/json", + "Accept-Encoding": "gzip,deflate", + "Authorization": "Sanitized", + "Connection": "keep-alive", + "User-Agent": "azsdk-js-communication-tiering/1.0.0-beta.0 core-rest-pipeline/1.10.4 Node/v18.12.1 OS/(x64-Linux-5.15.90.1-microsoft-standard-WSL2)", + "x-ms-client-request-id": "9d787bd6-07fc-4c7b-8e57-17f1fee41298", + "x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=", + "x-ms-date": "Mon, 05 Jun 2023 17:37:40 GMT" + }, + "RequestBody": null, + "StatusCode": 200, + "ResponseHeaders": { + "Accept-Ranges": "bytes", + "api-supported-versions": "2023-06-15", + "Connection": "keep-alive", + "Content-Length": "1516", + "Content-Type": "application/json; charset=utf-8", + "Date": "Mon, 05 Jun 2023 17:37:38 GMT", + "MS-CV": "oATvkZ58LUySDvjom6xQUQ.0", + "Strict-Transport-Security": "max-age=2592000", + "x-azure-ref": "20230605T173737Z-pbnsyacqb97s5787bax4emxtw800000001g0000000011vp1", + "X-Cache": "CONFIG_NOCACHE", + "X-Processing-Time": "544ms" + }, + "ResponseBody": { + "tierId": "9d787bd6-07fc-4c7b-8e57-17f1fee41298", + "tierType": "Basic", + "capabilities": { + "sms": { + "outbound": [ + { + "type": "SMS", + "scope": "PhoneNumber", + "smsPerMin": 200, + "geographicLimitations": "Domestic" + }, + { + "type": "ShortCode", + "scope": "PhoneNumber", + "smsPerMin": 0, + "geographicLimitations": "Domestic" + }, + { + "type": "AlphaDynamic", + "scope": "Resource", + "smsPerMin": 0, + "geographicLimitations": "Domestic" + } + ], + "inbound": [] + }, + "calling": { + "outbound": [ + { + "type": "Call", + "scope": "PhoneNumber", + "concurrentCalls": 2, + "geographicLimitations": "Domestic" + } + ], + "inbound": [ + { + "type": "Call", + "scope": "PhoneNumber", + "concurrentCalls": 2, + "geographicLimitations": "Domestic" + } + ] + }, + "phoneNumberPurchase": [ + { + "numberType": [ + "TollFree", + "Geographic", + "Mobile" + ], + "scope": "Tenant", + "totalNumbers": 1 + }, + { + "numberType": [ + "ShortCode" + ], + "scope": "Tenant", + "totalNumbers": 0 + }, + { + "numberType": [ + "AlphaDynamic" + ], + "scope": "Tenant", + "totalNumbers": 0 + } + ], + "trialPhoneNumberPurchase": [ + { + "numberType": [ + "TollFree" + ], + "scope": "Subscription", + "totalNumbers": 3, + "trialPeriodDays": 30 + }, + { + "numberType": [ + "TollFree" + ], + "scope": "Resource", + "totalNumbers": 1, + "trialPeriodDays": 30 + } + ], + "trialPhoneNumberUsage": [ + { + "numberType": "TollFree", + "calling": { + "outbound": [ + { + "type": "Call", + "scope": "PhoneNumber", + "totalMinutes": 60, + "maximumCallDurationMinutes": 5, + "concurrentCalls": 0 + } + ], + "inbound": [ + { + "type": "Call", + "scope": "PhoneNumber", + "totalMinutes": 60, + "maximumCallDurationMinutes": 5, + "concurrentCalls": 0 + } + ] + }, + "sms": { + "outbound": [ + { + "type": "SMS", + "scope": "PhoneNumber", + "total": 100, + "smsPerMin": 5 + } + ], + "inbound": [ + { + "type": "SMS", + "scope": "PhoneNumber", + "total": 100, + "smsPerMin": 5 + } + ] + } + } + ] + } + } + } + ], + "Variables": {} +} diff --git a/sdk/communication/communication-tiering/test/public/ctor.spec.ts b/sdk/communication/communication-tiering/test/public/ctor.spec.ts new file mode 100644 index 000000000000..6e991b3071f6 --- /dev/null +++ b/sdk/communication/communication-tiering/test/public/ctor.spec.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { AzureKeyCredential } from "@azure/core-auth"; +import { Context } from "mocha"; +import { TieringClient } from "../../src"; +import { assert } from "chai"; +import { createMockToken } from "./utils/recordedClient"; + +describe("RecipientVerificationClient - constructor", function () { + const endpoint = "https://contoso.spool.azure.local"; + const accessKey = "banana"; + + it("successfully instantiates with valid connection string", function () { + const client = new TieringClient(`endpoint=${endpoint};accesskey=${accessKey}`); + assert.instanceOf(client, TieringClient); + }); + + it("throws with invalid connection string", function () { + assert.throws(() => { + new TieringClient(`endpoints=${endpoint};accesskey=${accessKey}`); + }); + }); + + it("successfully instantiates with with endpoint and access key", function () { + const client = new TieringClient(endpoint, new AzureKeyCredential(accessKey)); + assert.instanceOf(client, TieringClient); + }); + + it("successfully instantiates with with endpoint and managed identity", function (this: Context) { + const client = new TieringClient(endpoint, createMockToken()); + assert.instanceOf(client, TieringClient); + }); +}); diff --git a/sdk/communication/communication-tiering/test/public/getAcquiredNumberLimit.spec.ts b/sdk/communication/communication-tiering/test/public/getAcquiredNumberLimit.spec.ts new file mode 100644 index 000000000000..87f8fba101e8 --- /dev/null +++ b/sdk/communication/communication-tiering/test/public/getAcquiredNumberLimit.spec.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { Context } from "mocha"; +import { Recorder } from "@azure-tools/test-recorder"; +import { TieringClient } from "../../src"; +import { assert } from "chai"; +import { createRecordedClient } from "./utils/recordedClient"; + +describe(`TieringClient - Get Acquired Number Limits`, function () { + let recorder: Recorder; + let client: TieringClient; + + beforeEach(async function (this: Context) { + ({ client, recorder } = await createRecordedClient(this)); + }); + + afterEach(async function (this: Context) { + if (!this.currentTest?.isPending()) { + await recorder.stop(); + } + }); + + it("get acquired number limits", async function () { + // print all acquire number limits + const resourceId = "9d787bd6-07fc-4c7b-8e57-17f1fee41298"; + const acquiredNumberLimits = await client.getAcquiredNumberLimits(resourceId); + assert.isNotNull(acquiredNumberLimits); + }).timeout(10000); +}); diff --git a/sdk/communication/communication-tiering/test/public/getTierInfo.spec.ts b/sdk/communication/communication-tiering/test/public/getTierInfo.spec.ts new file mode 100644 index 000000000000..0796487cbacb --- /dev/null +++ b/sdk/communication/communication-tiering/test/public/getTierInfo.spec.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { Context } from "mocha"; +import { Recorder } from "@azure-tools/test-recorder"; +import { TieringClient } from "../../src"; +import { assert } from "chai"; +import { createRecordedClient } from "./utils/recordedClient"; + +describe(`TieringClient - Get Tier Info`, function () { + let recorder: Recorder; + let client: TieringClient; + + beforeEach(async function (this: Context) { + ({ client, recorder } = await createRecordedClient(this)); + }); + + afterEach(async function (this: Context) { + if (!this.currentTest?.isPending()) { + await recorder.stop(); + } + }); + + it("get tier info", async function () { + // print all tier info + const resourceId = "9d787bd6-07fc-4c7b-8e57-17f1fee41298"; + const tierInfo = await client.getTierByResourceId(resourceId); + assert.isNotNull(tierInfo); + }).timeout(10000); +}); diff --git a/sdk/communication/communication-tiering/test/public/utils/recordedClient.ts b/sdk/communication/communication-tiering/test/public/utils/recordedClient.ts new file mode 100644 index 000000000000..c214f2a0ea8e --- /dev/null +++ b/sdk/communication/communication-tiering/test/public/utils/recordedClient.ts @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. +import * as dotenv from "dotenv"; + +import { ClientSecretCredential, DefaultAzureCredential, TokenCredential } from "@azure/identity"; +import { + Recorder, + RecorderStartOptions, + assertEnvironmentVariable, + env, + isPlaybackMode, +} from "@azure-tools/test-recorder"; +import { Context } from "mocha"; +import { TieringClient } from "../../../src"; +import { isNode } from "@azure/test-utils"; +import { parseConnectionString } from "@azure/communication-common"; + +if (isNode) { + dotenv.config(); +} + +export interface RecordedClient { + client: T; + recorder: Recorder; +} + +const envSetupForPlayback: { [k: string]: string } = { + COMMUNICATION_LIVETEST_STATIC_CONNECTION_STRING: "endpoint=https://endpoint/;accesskey=banana", + AZURE_CLIENT_ID: "SomeClientId", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "SomeTenantId", +}; + +export const recorderOptions: RecorderStartOptions = { + envSetupForPlayback, + sanitizerOptions: { + connectionStringSanitizers: [ + { + actualConnString: env.COMMUNICATION_LIVETEST_STATIC_CONNECTION_STRING, + fakeConnString: envSetupForPlayback["COMMUNICATION_LIVETEST_STATIC_CONNECTION_STRING"], + }, + ], + generalSanitizers: [ + { + regex: true, + target: `[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}`, + value: "9d787bd6-07fc-4c7b-8e57-17f1fee41298", + }, + ], + }, +}; + +export async function createRecordedClient( + context: Context +): Promise> { + const recorder = new Recorder(context.currentTest); + await recorder.start(recorderOptions); + await recorder.setMatcher("CustomDefaultMatcher", { + excludedHeaders: [ + "Accept-Language", // This is env-dependent + "x-ms-content-sha256", // This is dependent on the current datetime + ], + }); + + // casting is a workaround to enable min-max testing + return { + client: new TieringClient( + assertEnvironmentVariable("COMMUNICATION_LIVETEST_STATIC_CONNECTION_STRING"), + recorder.configureClientOptions({}) + ), + recorder, + }; +} + +export function createMockToken(): { + getToken: (_scopes: string) => Promise<{ token: string; expiresOnTimestamp: number }>; +} { + return { + getToken: async (_scopes: string) => { + return { token: "testToken", expiresOnTimestamp: 11111 }; + }, + }; +} + +export async function createRecordedClientWithToken( + context: Context +): Promise | undefined> { + const recorder = new Recorder(context.currentTest); + await recorder.start(recorderOptions); + + let credential: TokenCredential; + const endpoint = parseConnectionString( + assertEnvironmentVariable("COMMUNICATION_LIVETEST_STATIC_CONNECTION_STRING") + ).endpoint; + + if (isPlaybackMode()) { + credential = createMockToken(); + + // casting is a workaround to enable min-max testing + return { + client: new TieringClient(endpoint, credential, recorder.configureClientOptions({})), + recorder, + }; + } + + if (isNode) { + credential = new DefaultAzureCredential(); + } else { + credential = new ClientSecretCredential( + assertEnvironmentVariable("AZURE_TENANT_ID"), + assertEnvironmentVariable("AZURE_CLIENT_ID"), + assertEnvironmentVariable("AZURE_CLIENT_SECRET") + ); + } + + // casting is a workaround to enable min-max testing + return { + client: new TieringClient(endpoint, credential, recorder.configureClientOptions({})), + recorder, + }; +} + +export const testPollerOptions = { + pollInterval: isPlaybackMode() ? 0 : undefined, +}; From aebd56f728239efaf7ab8f3c25d731b2af0f281e Mon Sep 17 00:00:00 2001 From: Babacar Ndoye Date: Mon, 5 Jun 2023 12:44:36 -0500 Subject: [PATCH 12/21] coverage generator --- sdk/communication/communication-tiering/.nycrc | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 sdk/communication/communication-tiering/.nycrc diff --git a/sdk/communication/communication-tiering/.nycrc b/sdk/communication/communication-tiering/.nycrc new file mode 100644 index 000000000000..29174b423579 --- /dev/null +++ b/sdk/communication/communication-tiering/.nycrc @@ -0,0 +1,10 @@ +{ + "include": ["dist-esm/src/**/*.js"], + "exclude": ["**/*.d.ts", "dist-esm/src/generated/*"], + "reporter": ["text-summary", "html", "cobertura"], + "exclude-after-remap": false, + "sourceMap": true, + "produce-source-map": true, + "instrument": true, + "all": true +} From ce6b226acc820ac3ee4c49505e8991e2f2def4f5 Mon Sep 17 00:00:00 2001 From: Babacar Ndoye Date: Mon, 5 Jun 2023 13:36:07 -0500 Subject: [PATCH 13/21] adding documentation --- .../communication-tiering/CHANGELOG.md | 8 + .../communication-tiering/README.md | 142 ++++++++++++++++++ 2 files changed, 150 insertions(+) create mode 100644 sdk/communication/communication-tiering/CHANGELOG.md create mode 100644 sdk/communication/communication-tiering/README.md diff --git a/sdk/communication/communication-tiering/CHANGELOG.md b/sdk/communication/communication-tiering/CHANGELOG.md new file mode 100644 index 000000000000..692f1fca3d92 --- /dev/null +++ b/sdk/communication/communication-tiering/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.0 (2023-06-05) + +The first preview of the Azure Communication Tiering client library has the following features: + +- Retrieving tiering info +- Retrieving telephone number summary diff --git a/sdk/communication/communication-tiering/README.md b/sdk/communication/communication-tiering/README.md new file mode 100644 index 000000000000..17b02e18c458 --- /dev/null +++ b/sdk/communication/communication-tiering/README.md @@ -0,0 +1,142 @@ +# Azure Communication Tiering client library for JavaScript + +The Tiering client library allows developers to retrieves limits for each capability (SMS/PSTN Calling/Phone Number purchasing) for a specific resource/tier. + +## Getting started + +### Prerequisites + +- An [Azure subscription][azure_sub]. +- An existing Communication Services resource. If you need to create the resource, you can use the [Azure Portal][azure_portal], the [Azure PowerShell][azure_powershell], or the [Azure CLI][azure_cli]. + +### Installing + +```bash +npm install @azure-tools/communication-tiering +``` + +### Browser support + +#### 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 + +## Examples + +## Authentication + +To create a client object to access the Communication Services API, you will need a `connection string` or the `endpoint` of your Communication Services resource and a `credential`. The Tiering client can use either Azure Active Directory credentials or an API key credential to authenticate. + +You can get a key and/or connection string from your Communication Services resource in the [Azure Portal][azure_portal]. You can also find the endpoint for your Communication Services resource in the [Azure Portal][azure_portal]. + +Once you have a key, you can authenticate the `TieringClient` with any of the following methods: + +### Using a connection string + +```javascript +const { TieringClient } = require("@azure-tools/communication-tiering"); +const connectionString = "endpoint=;accessKey="; +const client = new TieringClient(connectionString); +``` + +### Using an access key with `AzureKeyCredential` + +If you use a key to initialize the client you will also need to provide the appropriate endpoint. You can get this endpoint from your Communication Services resource in [Azure Portal][azure_portal]. Once you have a key and endpoint, you can authenticate with the following code: + +```javascript +const { AzureKeyCredential } = require("@azure/core-auth"); +const { TieringClient } = require("@azure-tools/communication-tiering"); +const credential = new AzureKeyCredential(""); +const client = new TieringClient("", credential); +``` + +### Using an Azure Active Directory Credential + +Connection string authentication is used in most of the examples, but you can also authenticate with Azure Active Directory using the [Azure Identity library][azure_identity]. To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the [`@azure/identity`][azure_identity] package: + +```bash +npm install @azure/identity +``` + +The [`@azure/identity`][azure_identity] package provides a variety of credential types that your application can use to do this. The [README for `@azure/identity`][azure_identity_readme] provides more details and samples to get you started. + +```javascript +const { DefaultAzureCredential } = require("@azure/identity"); +const { TieringClient } = require("@azure-tools/communication-tiering"); + +let credential = new DefaultAzureCredential(); +const client = new TieringClient("", credential); +``` + +## Usage + +The following sections provide code snippets that cover some of the common tasks using the Azure Communication Services Tiering Client. The scenarios that are covered here consist of: + +- [Get acquired number limits](#get-acquired-number-limits) +- [Get Tier Info](#get-tier-info) + +### Get acquired number limits + +```typescript +import { Tiering } from "@azure-tools/communication-tiering"; +const connectionString = "endpoint=;accessKey="; +const client = new Tiering(connectionString); + +async main function() { + const resourceId = "5d41e908-de88-4bbf-94dc-fe9a1b51029b"; + + // Get acquired numbers and limits for a resource + var acquiredNumberLimits = await client.getAcquiredNumberLimits(resourceId); + + // print all number limits + console.log(acquiredNumberLimits); +} + +main(); +``` + +### Get tier info + +```typescript +import { Tiering } from "@azure-tools/communication-tiering"; +const connectionString = "endpoint=;accessKey="; +const client = new Tiering(connectionString); + +async main function() { + const resourceId = "5d41e908-de88-4bbf-94dc-fe9a1b51029b"; + + // Get tier info for a resource + var tierInfo = await client.getTierByResourceId(resourceId); + + // print all tier info + console.log(tierInfo); +} + +main(); +``` + +## Troubleshooting + +## Next steps + +Please take a look at the samples directory for detailed examples on how to use this library. + +## 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_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_powershell]: https://docs.microsoft.com/powershell/module/az.communication/new-azcommunicationservice +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[azure_identity_readme]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/README.md + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fcommunication%2Fcommunication-toll-free-verification%2FREADME.png) From 8e4848b8028fdfcb15e2d00b5b4e605e2e2510d4 Mon Sep 17 00:00:00 2001 From: Babacar Ndoye Date: Mon, 5 Jun 2023 13:39:25 -0500 Subject: [PATCH 14/21] removing apiref --- .../communication-tiering/samples/v1-beta/javascript/README.md | 3 +-- .../communication-tiering/samples/v1-beta/typescript/README.md | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/sdk/communication/communication-tiering/samples/v1-beta/javascript/README.md b/sdk/communication/communication-tiering/samples/v1-beta/javascript/README.md index 2c2904d05e1f..a66e9dfee0b6 100644 --- a/sdk/communication/communication-tiering/samples/v1-beta/javascript/README.md +++ b/sdk/communication/communication-tiering/samples/v1-beta/javascript/README.md @@ -55,11 +55,10 @@ npx cross-env COMMUNICATION_SAMPLES_CONNECTION_STRING=" to look at. [getacquirednumberlimits]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/communication/communication-tiering/samples/v1-beta/javascript/getAcquiredNumberLimits.js [gettierinfo]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/communication/communication-tiering/samples/v1-beta/javascript/getTierInfo.js -[apiref]: https://docs.microsoft.com/javascript/api/@azure/communication-tiering [freesub]: https://azure.microsoft.com/free/ [createinstance_azurecommunicationservicesaccount]: https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource [package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/communication/communication-tiering/README.md diff --git a/sdk/communication/communication-tiering/samples/v1-beta/typescript/README.md b/sdk/communication/communication-tiering/samples/v1-beta/typescript/README.md index 18bf2e159b6c..2b9c74e37b17 100644 --- a/sdk/communication/communication-tiering/samples/v1-beta/typescript/README.md +++ b/sdk/communication/communication-tiering/samples/v1-beta/typescript/README.md @@ -67,11 +67,10 @@ npx cross-env COMMUNICATION_SAMPLES_CONNECTION_STRING=" to look at. [getacquirednumberlimits]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/communication/communication-tiering/samples/v1-beta/typescript/src/getAcquiredNumberLimits.ts [gettierinfo]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/communication/communication-tiering/samples/v1-beta/typescript/src/getTierInfo.ts -[apiref]: https://docs.microsoft.com/javascript/api/@azure/communication-tiering [freesub]: https://azure.microsoft.com/free/ [createinstance_azurecommunicationservicesaccount]: https://docs.microsoft.com/azure/communication-services/quickstarts/create-communication-resource [package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/communication/communication-tiering/README.md From 96581d0f2383e135998a755b2a2bbecb618df8a9 Mon Sep 17 00:00:00 2001 From: Babacar Ndoye Date: Wed, 7 Jun 2023 18:56:07 -0500 Subject: [PATCH 15/21] rush updating --- common/config/rush/pnpm-lock.yaml | 72 +++++++++++++++---------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 6b77244f30f5..85f639bb766a 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -2247,7 +2247,7 @@ packages: resolution: {integrity: sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==} dependencies: '@types/connect': 3.4.35 - '@types/node': 14.18.48 + '@types/node': 16.18.34 dev: false /@types/chai-as-promised/7.1.5: @@ -2269,7 +2269,7 @@ packages: /@types/connect/3.4.35: resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==} dependencies: - '@types/node': 14.18.48 + '@types/node': 16.18.34 dev: false /@types/cookie/0.4.1: @@ -2279,7 +2279,7 @@ packages: /@types/cors/2.8.13: resolution: {integrity: sha512-RG8AStHlUiV5ysZQKq97copd2UmVYw3/pRMLefISZ3S1hK104Cwm7iLQ3fTKx+lsUH2CE8FlLaYeEA2LSeqYUA==} dependencies: - '@types/node': 14.18.48 + '@types/node': 16.18.34 dev: false /@types/debug/4.1.8: @@ -2291,7 +2291,7 @@ packages: /@types/decompress/4.2.4: resolution: {integrity: sha512-/C8kTMRTNiNuWGl5nEyKbPiMv6HA+0RbEXzFhFBEzASM6+oa4tJro9b8nj7eRlOFfuLdzUU+DS/GPDlvvzMOhA==} dependencies: - '@types/node': 14.18.48 + '@types/node': 16.18.34 dev: false /@types/eslint/8.4.10: @@ -2312,7 +2312,7 @@ packages: /@types/express-serve-static-core/4.17.35: resolution: {integrity: sha512-wALWQwrgiB2AWTT91CB62b6Yt0sNHpznUXeZEcnPU3DRdlDIz74x8Qg1UUYKSVFi+va5vKOLYRBI1bRKiLLKIg==} dependencies: - '@types/node': 14.18.48 + '@types/node': 16.18.34 '@types/qs': 6.9.7 '@types/range-parser': 1.2.4 '@types/send': 0.17.1 @@ -2330,13 +2330,13 @@ packages: /@types/fs-extra/8.1.2: resolution: {integrity: sha512-SvSrYXfWSc7R4eqnOzbQF4TZmfpNSM9FrSWLU3EUnWBuyZqNBOrv1B1JA3byUDPUl9z4Ab3jeZG2eDdySlgNMg==} dependencies: - '@types/node': 14.18.48 + '@types/node': 16.18.34 dev: false /@types/fs-extra/9.0.13: resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==} dependencies: - '@types/node': 14.18.48 + '@types/node': 16.18.34 dev: false /@types/inquirer/8.2.6: @@ -2349,7 +2349,7 @@ packages: /@types/is-buffer/2.0.0: resolution: {integrity: sha512-0f7N/e3BAz32qDYvgB4d2cqv1DqUwvGxHkXsrucICn8la1Vb6Yl6Eg8mPScGwUiqHJeE7diXlzaK+QMA9m4Gxw==} dependencies: - '@types/node': 14.18.48 + '@types/node': 16.18.34 dev: false /@types/json-schema/7.0.12: @@ -2363,13 +2363,13 @@ packages: /@types/jsonwebtoken/9.0.2: resolution: {integrity: sha512-drE6uz7QBKq1fYqqoFKTDRdFCPHd5TCub75BM+D+cMx7NU9hUz7SESLfC2fSCXVFMO5Yj8sOWHuGqPgjc+fz0Q==} dependencies: - '@types/node': 14.18.48 + '@types/node': 16.18.34 dev: false /@types/jws/3.2.5: resolution: {integrity: sha512-xGTxZH34xOryaTN8CMsvhh9lfNqFuHiMoRvsLYWQdBJHqiECyfInXVl2eK8Jz2emxZWMIn5RBlmr3oDVPeWujw==} dependencies: - '@types/node': 14.18.48 + '@types/node': 16.18.34 dev: false /@types/linkify-it/3.0.2: @@ -2420,13 +2420,13 @@ packages: /@types/mysql/2.15.19: resolution: {integrity: sha512-wSRg2QZv14CWcZXkgdvHbbV2ACufNy5EgI8mBBxnJIptchv7DBy/h53VMa2jDhyo0C9MO4iowE6z9vF8Ja1DkQ==} dependencies: - '@types/node': 14.18.48 + '@types/node': 16.18.34 dev: false /@types/node-fetch/2.6.4: resolution: {integrity: sha512-1ZX9fcN4Rvkvgv4E6PAY5WXUFWFcRWxZa3EW83UjycOB9ljJCedb2CupIP4RZMEwF/M3eTcCihbBRgwtGbg5Rg==} dependencies: - '@types/node': 14.18.48 + '@types/node': 16.18.34 form-data: 3.0.1 dev: false @@ -2451,7 +2451,7 @@ packages: /@types/pg/8.6.1: resolution: {integrity: sha512-1Kc4oAGzAl7uqUStZCDvaLFqZrW9qWSjXOmBfdgyBP5La7Us6Mg4GBvRlSoaZMhQF/zSj1C8CtKMBkoiT8eL8w==} dependencies: - '@types/node': 14.18.48 + '@types/node': 16.18.34 pg-protocol: 1.6.0 pg-types: 2.2.0 dev: false @@ -2479,7 +2479,7 @@ packages: /@types/resolve/1.17.1: resolution: {integrity: sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==} dependencies: - '@types/node': 14.18.48 + '@types/node': 16.18.34 dev: false /@types/semaphore/1.1.1: @@ -2498,14 +2498,14 @@ packages: resolution: {integrity: sha512-Cwo8LE/0rnvX7kIIa3QHCkcuF21c05Ayb0ZfxPiv0W8VRiZiNW/WuRupHKpqqGVGf7SUA44QSOUKaEd9lIrd/Q==} dependencies: '@types/mime': 1.3.2 - '@types/node': 14.18.48 + '@types/node': 16.18.34 dev: false /@types/serve-static/1.15.1: resolution: {integrity: sha512-NUo5XNiAdULrJENtJXZZ3fHtfMolzZwczzBbnAeBbqBwG+LaG6YaJtuwzwGSQZ2wsCrxjEhNNjAkKigy3n8teQ==} dependencies: '@types/mime': 3.0.1 - '@types/node': 14.18.48 + '@types/node': 16.18.34 dev: false /@types/sinon/10.0.15: @@ -2527,13 +2527,13 @@ packages: /@types/stoppable/1.1.1: resolution: {integrity: sha512-b8N+fCADRIYYrGZOcmOR8ZNBOqhktWTB/bMUl5LvGtT201QKJZOOH5UsFyI3qtteM6ZAJbJqZoBcLqqxKIwjhw==} dependencies: - '@types/node': 14.18.48 + '@types/node': 16.18.34 dev: false /@types/through/0.0.30: resolution: {integrity: sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==} dependencies: - '@types/node': 14.18.48 + '@types/node': 16.18.34 dev: false /@types/tough-cookie/4.0.2: @@ -2547,7 +2547,7 @@ packages: /@types/tunnel/0.0.3: resolution: {integrity: sha512-sOUTGn6h1SfQ+gbgqC364jLFBw2lnFqkgF3q0WovEHRLMrVD1sd5aufqi/aJObLekJO+Aq5z646U4Oxy6shXMA==} dependencies: - '@types/node': 14.18.48 + '@types/node': 16.18.34 dev: false /@types/underscore/1.11.5: @@ -2565,19 +2565,19 @@ packages: /@types/ws/7.4.7: resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==} dependencies: - '@types/node': 14.18.48 + '@types/node': 16.18.34 dev: false /@types/ws/8.5.4: resolution: {integrity: sha512-zdQDHKUgcX/zBc4GrwsE/7dVdAD8JR4EuiAXiiUhhfyIJXXb2+PrGshFyeXWQPMmmZ2XxgaqclgpIC7eTXc1mg==} dependencies: - '@types/node': 14.18.48 + '@types/node': 16.18.34 dev: false /@types/xml2js/0.4.11: resolution: {integrity: sha512-JdigeAKmCyoJUiQljjr7tQG3if9NkqGUgwEUqBvV0N7LM4HyQk7UXCnusRa1lnvXAEYJ8mw8GtZWioagNztOwA==} dependencies: - '@types/node': 14.18.48 + '@types/node': 16.18.34 dev: false /@types/yargs-parser/21.0.0: @@ -2594,7 +2594,7 @@ packages: resolution: {integrity: sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==} requiresBuild: true dependencies: - '@types/node': 14.18.48 + '@types/node': 16.18.34 dev: false optional: true @@ -3603,7 +3603,7 @@ packages: resolution: {integrity: sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==} deprecated: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) dependencies: - ms: 2.1.1 + ms: 2.1.3 dev: false /debug/3.2.7: @@ -3834,7 +3834,7 @@ packages: dependencies: semver: 7.5.1 shelljs: 0.8.5 - typescript: 5.2.0-dev.20230605 + typescript: 5.2.0-dev.20230607 dev: false /ecdsa-sig-formatter/1.0.11: @@ -3885,7 +3885,7 @@ packages: dependencies: '@types/cookie': 0.4.1 '@types/cors': 2.8.13 - '@types/node': 14.18.48 + '@types/node': 16.18.34 accepts: 1.3.8 base64id: 2.0.0 cookie: 0.4.2 @@ -4809,7 +4809,7 @@ packages: fs.realpath: 1.0.0 inflight: 1.0.6 inherits: 2.0.4 - minimatch: 3.0.4 + minimatch: 3.1.2 once: 1.4.0 path-is-absolute: 1.0.1 dev: false @@ -7117,7 +7117,7 @@ packages: '@protobufjs/path': 1.1.2 '@protobufjs/pool': 1.1.0 '@protobufjs/utf8': 1.1.0 - '@types/node': 14.18.48 + '@types/node': 16.18.34 long: 5.2.3 dev: false @@ -8427,8 +8427,8 @@ packages: hasBin: true dev: false - /typescript/5.2.0-dev.20230605: - resolution: {integrity: sha512-xMeI7pFrOfxZTt1m4a2txN1E2Qh9IzLT9LNdc0DlEwJJKXjajj5j/nFLwWOUEnaFZBT6v35jlgLogG5HuSxUyA==} + /typescript/5.2.0-dev.20230607: + resolution: {integrity: sha512-7Lgk1sNuuYpMNvHuXIMczqhLbJ99RpX3VgokK+Ir4DgliycYNrNGM/daAO38fHkk8n3lg2rP/6U5I545xTJdKA==} engines: {node: '>=14.17'} hasBin: true dev: false @@ -15985,16 +15985,16 @@ packages: dependencies: '@azure/communication-common': 2.2.0 '@azure/identity': 2.1.0 - '@microsoft/api-extractor': 7.34.8_@types+node@14.18.46 + '@microsoft/api-extractor': 7.35.1_@types+node@14.18.48 '@types/chai': 4.3.5 '@types/mocha': 7.0.2 - '@types/node': 14.18.46 + '@types/node': 14.18.48 '@types/sinon': 9.0.11 '@types/uuid': 8.3.4 chai: 4.3.7 cross-env: 7.0.3 - dotenv: 16.0.3 - eslint: 8.40.0 + dotenv: 16.1.4 + eslint: 8.42.0 events: 3.3.0 inherits: 2.0.4 karma: 6.4.2 @@ -16012,7 +16012,7 @@ packages: prettier: 2.8.8 rimraf: 3.0.2 sinon: 9.2.4 - tslib: 2.5.0 + tslib: 2.5.3 typescript: 5.0.4 uuid: 8.3.2 transitivePeerDependencies: @@ -18072,7 +18072,7 @@ packages: dev: false file:projects/monitor-query.tgz: - resolution: {integrity: sha512-UTfrrypI9UvxkoW1o6zxcIzxJSxXeam5tEzF35ZFa+bJnIOgH45sUvzT2p4n/YA2/blGPYogtQPT81RcWiHgBg==, tarball: file:projects/monitor-query.tgz} + resolution: {integrity: sha512-bE/JTLjfj8HMmBTGfK1pTs4Kfsy9GJwXtrvbOjgDH8pYIvzzJ3LjUNRGjVhb3r+FOPkBRbb9fxniy5U3mmmLng==, tarball: file:projects/monitor-query.tgz} name: '@rush-temp/monitor-query' version: 0.0.0 dependencies: From 1dc9f70f06084047f04d9193293c4817708b5aac Mon Sep 17 00:00:00 2001 From: Babacar Ndoye Date: Thu, 8 Jun 2023 13:46:35 -0500 Subject: [PATCH 16/21] Adding unknown word and editing readme --- .vscode/cspell.json | 8 ++++++-- sdk/communication/communication-tiering/README.md | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.vscode/cspell.json b/.vscode/cspell.json index 229a9a11e407..e30eb6c3a7d1 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -74,6 +74,7 @@ "Eugps", "EUGPS", "Fhir", + "Fnhr", "Guids", "Hana", "Idrg", @@ -107,10 +108,11 @@ "prettierrc", "pwsh", "Rasterize", + "reoffer", + "Resourceid", "Rollup", "rrggbb", "Rtsp", - "reoffer", "rushx", "soundex", "southcentralus", @@ -246,7 +248,9 @@ }, { "filename": "sdk/formrecognizer/ai-form-recognizer/README.md", - "words": ["iddocument"] + "words": [ + "iddocument" + ] }, { "filename": "sdk/formrecognizer/ai-form-recognizer/review/**/*.md", diff --git a/sdk/communication/communication-tiering/README.md b/sdk/communication/communication-tiering/README.md index 17b02e18c458..74abcc7fac75 100644 --- a/sdk/communication/communication-tiering/README.md +++ b/sdk/communication/communication-tiering/README.md @@ -1,6 +1,6 @@ # Azure Communication Tiering client library for JavaScript -The Tiering client library allows developers to retrieves limits for each capability (SMS/PSTN Calling/Phone Number purchasing) for a specific resource/tier. +The Tiering client library allows developers to retrieve limits for each capability (SMS/PSTN Calling/Phone Number purchasing) for a specific resource/tier. ## Getting started From ab11c866e74f86e93c3b41c9ae6d4d032e93454e Mon Sep 17 00:00:00 2001 From: Babacar Ndoye Date: Wed, 14 Jun 2023 13:07:17 -0500 Subject: [PATCH 17/21] Addressing PR Comments --- .../review/communication-tiering.api.md | 33 ++++--------------- .../communication-tiering/src/index.ts | 1 - .../communication-tiering/src/mapper.ts | 10 ------ .../communication-tiering/src/models.ts | 2 +- .../src/tieringClient.ts | 8 ++--- 5 files changed, 11 insertions(+), 43 deletions(-) delete mode 100644 sdk/communication/communication-tiering/src/mapper.ts diff --git a/sdk/communication/communication-tiering/review/communication-tiering.api.md b/sdk/communication/communication-tiering/review/communication-tiering.api.md index d626e5079850..e87824782856 100644 --- a/sdk/communication/communication-tiering/review/communication-tiering.api.md +++ b/sdk/communication/communication-tiering/review/communication-tiering.api.md @@ -33,24 +33,12 @@ export interface AcsTierCapabilitiesCalling { outbound?: CallingOutbound[]; } -// @public (undocumented) -export const AcsTierCapabilitiesCallingMapper: coreClient.CompositeMapper; - -// @public (undocumented) -export const AcsTierCapabilitiesMappers: coreClient.CompositeMapper; - // @public export interface AcsTierCapabilitiesSms { inbound?: SmsInbound[]; outbound?: SmsOutbound[]; } -// @public (undocumented) -export const AcsTierCapabilitiesSMSMapper: coreClient.CompositeMapper; - -// @public (undocumented) -export const AcsTierMapper: coreClient.CompositeMapper; - // @public export interface AssetDetails { aadTenantAcquiredCount?: number; @@ -61,10 +49,9 @@ export interface AssetDetails { } // @public (undocumented) -export const AssetDetailsMapper: coreClient.CompositeMapper; - -// @public (undocumented) -export const AssetDetailsResponseMapper: coreClient.CompositeMapper; +export interface AssetDetailsModel { + assetDetails: AssetDetails[]; +} // @public export interface AssetDetailsTierInfo { @@ -75,9 +62,6 @@ export interface AssetDetailsTierInfo { scope?: string; } -// @public (undocumented) -export const AssetDetailsTierInfoMapper: coreClient.CompositeMapper; - // @public export interface CallingInbound { concurrentCalls?: number; @@ -99,12 +83,7 @@ export interface NumberAllotmentGetAcquiredNumberLimitsOptionalParams extends co } // @public -export type NumberAllotmentGetAcquiredNumberLimitsResponse = Paths190FnhrAdministrationResourcesResourceidTelephoneNumberSummaryGetResponses200ContentApplicationJsonSchema; - -// @public (undocumented) -export interface Paths190FnhrAdministrationResourcesResourceidTelephoneNumberSummaryGetResponses200ContentApplicationJsonSchema { - assetDetails: AssetDetails[]; -} +export type NumberAllotmentGetAcquiredNumberLimitsResponse = AssetDetailsModel; // @public export interface PhoneNumberPurchase { @@ -134,8 +113,8 @@ export class TieringClient { constructor(connectionString: string, options?: TieringClientOptions); constructor(endpoint: string, credential: KeyCredential, options?: TieringClientOptions); constructor(endpoint: string, credential: TokenCredential, options?: TieringClientOptions); - getAcquiredNumberLimits(resourceId: string, options?: NumberAllotmentGetAcquiredNumberLimitsOptionalParams): Promise; - getTierByResourceId(resourceId: string, options?: TieringGetByResourceIdOptionalParams): Promise; + getAcquiredNumberLimits(resourceId: string, options?: NumberAllotmentGetAcquiredNumberLimitsOptionalParams): Promise; + getTierByResourceId(resourceId: string, options?: TieringGetByResourceIdOptionalParams): Promise; } // @public diff --git a/sdk/communication/communication-tiering/src/index.ts b/sdk/communication/communication-tiering/src/index.ts index c8a689646caf..05cc6140f07c 100644 --- a/sdk/communication/communication-tiering/src/index.ts +++ b/sdk/communication/communication-tiering/src/index.ts @@ -2,5 +2,4 @@ // Licensed under the MIT license. export * from "./models"; -export * from "./mapper"; export * from "./tieringClient"; diff --git a/sdk/communication/communication-tiering/src/mapper.ts b/sdk/communication/communication-tiering/src/mapper.ts deleted file mode 100644 index 2151ce81565b..000000000000 --- a/sdk/communication/communication-tiering/src/mapper.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -export { AssetDetails as AssetDetailsMapper } from "./generated/src/models/mappers"; -export { AssetDetailsTierInfo as AssetDetailsTierInfoMapper } from "./generated/src/models/mappers"; -export { AcsTier as AcsTierMapper } from "./generated/src/models/mappers"; -export { AcsTierCapabilities as AcsTierCapabilitiesMappers } from "./generated/src/models/mappers"; -export { AcsTierCapabilitiesCalling as AcsTierCapabilitiesCallingMapper } from "./generated/src/models/mappers"; -export { AcsTierCapabilitiesSms as AcsTierCapabilitiesSMSMapper } from "./generated/src/models/mappers"; -export { Paths190FnhrAdministrationResourcesResourceidTelephoneNumberSummaryGetResponses200ContentApplicationJsonSchema as AssetDetailsResponseMapper } from "./generated/src/models/mappers"; diff --git a/sdk/communication/communication-tiering/src/models.ts b/sdk/communication/communication-tiering/src/models.ts index fbf91fdd212f..9efd727f5a8d 100644 --- a/sdk/communication/communication-tiering/src/models.ts +++ b/sdk/communication/communication-tiering/src/models.ts @@ -24,5 +24,5 @@ export { TrialPhoneNumberUsageCalling, TrialPhoneNumberUsageSmsBounds, TrialPhoneNumberUsageCallingBounds, - Paths190FnhrAdministrationResourcesResourceidTelephoneNumberSummaryGetResponses200ContentApplicationJsonSchema, + Paths190FnhrAdministrationResourcesResourceidTelephoneNumberSummaryGetResponses200ContentApplicationJsonSchema as AssetDetailsModel, } from "./generated/src/models"; diff --git a/sdk/communication/communication-tiering/src/tieringClient.ts b/sdk/communication/communication-tiering/src/tieringClient.ts index 507b1b6bf955..2da3b0f806c8 100644 --- a/sdk/communication/communication-tiering/src/tieringClient.ts +++ b/sdk/communication/communication-tiering/src/tieringClient.ts @@ -4,9 +4,9 @@ import { NumberAllotmentGetAcquiredNumberLimitsOptionalParams, - NumberAllotmentGetAcquiredNumberLimitsResponse, - TieringGetByResourceIdResponse, TieringGetByResourceIdOptionalParams, + AcsTier, + AssetDetailsModel } from "./models"; import { CommonClientOptions, InternalClientPipelineOptions } from "@azure/core-client"; import { KeyCredential, TokenCredential, isTokenCredential } from "@azure/core-auth"; @@ -91,7 +91,7 @@ export class TieringClient { public getAcquiredNumberLimits( resourceId: string, options: NumberAllotmentGetAcquiredNumberLimitsOptionalParams = {} - ): Promise { + ): Promise { return tracingClient.withSpan( "numberAllotment.getAcquiredNumberLimits", options, @@ -109,7 +109,7 @@ export class TieringClient { public getTierByResourceId( resourceId: string, options: TieringGetByResourceIdOptionalParams = {} - ): Promise { + ): Promise { return tracingClient.withSpan("tiering.getTierByResourceId", options, (updatedOptions) => { return this.client.tiering.getByResourceId(resourceId, updatedOptions); }); From 82ec663ac0db561d09bd55ec87504e852a9dec84 Mon Sep 17 00:00:00 2001 From: Babacar Ndoye Date: Wed, 14 Jun 2023 13:16:04 -0500 Subject: [PATCH 18/21] updating beta version --- .../communication-tiering/CHANGELOG.md | 2 +- .../src/generated/src/tieringClient.ts | 28 ++----------------- .../communication-tiering/swagger/README.md | 4 +-- 3 files changed, 5 insertions(+), 29 deletions(-) diff --git a/sdk/communication/communication-tiering/CHANGELOG.md b/sdk/communication/communication-tiering/CHANGELOG.md index 692f1fca3d92..11d85a6e2857 100644 --- a/sdk/communication/communication-tiering/CHANGELOG.md +++ b/sdk/communication/communication-tiering/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.0.0-beta.0 (2023-06-05) +## 1.0.0-beta.1 (2023-06-05) The first preview of the Azure Communication Tiering client library has the following features: diff --git a/sdk/communication/communication-tiering/src/generated/src/tieringClient.ts b/sdk/communication/communication-tiering/src/generated/src/tieringClient.ts index 2b891ce9425b..98c89d356085 100644 --- a/sdk/communication/communication-tiering/src/generated/src/tieringClient.ts +++ b/sdk/communication/communication-tiering/src/generated/src/tieringClient.ts @@ -7,7 +7,6 @@ */ import * as coreClient from "@azure/core-client"; -import * as coreRestPipeline from "@azure/core-rest-pipeline"; import { PipelineRequest, PipelineResponse, @@ -39,7 +38,7 @@ export class TieringClient extends coreClient.ServiceClient { requestContentType: "application/json; charset=utf-8" }; - const packageDetails = `azsdk-js-communication-tiering/1.0.0-beta.0`; + const packageDetails = `azsdk-js-communication-tiering/1.0.0-beta.1`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` @@ -51,32 +50,9 @@ export class TieringClient extends coreClient.ServiceClient { userAgentOptions: { userAgentPrefix }, - baseUri: options.endpoint ?? options.baseUri ?? "{endpoint}" + endpoint: options.endpoint ?? options.baseUri ?? "{endpoint}" }; super(optionsWithDefaults); - - if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) { - const pipelinePolicies: coreRestPipeline.PipelinePolicy[] = options.pipeline.getOrderedPolicies(); - const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some( - (pipelinePolicy) => - pipelinePolicy.name === - coreRestPipeline.bearerTokenAuthenticationPolicyName - ); - if (!bearerTokenAuthenticationPolicyFound) { - this.pipeline.removePolicy({ - name: coreRestPipeline.bearerTokenAuthenticationPolicyName - }); - this.pipeline.addPolicy( - coreRestPipeline.bearerTokenAuthenticationPolicy({ - scopes: `${optionsWithDefaults.baseUri}/.default`, - challengeCallbacks: { - authorizeRequestOnChallenge: - coreClient.authorizeRequestOnClaimChallenge - } - }) - ); - } - } // Parameter assignments this.endpoint = endpoint; diff --git a/sdk/communication/communication-tiering/swagger/README.md b/sdk/communication/communication-tiering/swagger/README.md index 23c791e6184f..7dd5c0e82f73 100644 --- a/sdk/communication/communication-tiering/swagger/README.md +++ b/sdk/communication/communication-tiering/swagger/README.md @@ -7,7 +7,7 @@ ```yaml package-name: "@azure/communication-tiering" description: The tiering client library retrieves limits for each capability (SMS/PSTN Calling/Phone Number purchase) for a specific resource/tier. -package-version: 1.0.0-beta.0 +package-version: 1.0.0-beta.1 license-header: MICROSOFT_MIT_NO_VERSION output-folder: ../src/generated input-file: ./swagger.json @@ -19,7 +19,7 @@ skip-enum-validation: true v3: true title: Tiering Client use-extension: - "@autorest/typescript": "6.0.0-rc.1" + "@autorest/typescript": "6.0.0" tracing-info: namespace: "Microsoft.Communication" packagePrefix: "Azure.Communication" From 3398babb7ba205be466dc12facc8232b8d9c63a6 Mon Sep 17 00:00:00 2001 From: Babacar Ndoye Date: Wed, 14 Jun 2023 13:16:32 -0500 Subject: [PATCH 19/21] versioning --- .../communication-tiering/src/generated/src/tracing.ts | 2 +- sdk/communication/communication-tiering/src/tieringClient.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/communication/communication-tiering/src/generated/src/tracing.ts b/sdk/communication/communication-tiering/src/generated/src/tracing.ts index 9cf36bd7b260..74dd2864a8f4 100644 --- a/sdk/communication/communication-tiering/src/generated/src/tracing.ts +++ b/sdk/communication/communication-tiering/src/generated/src/tracing.ts @@ -11,5 +11,5 @@ import { createTracingClient } from "@azure/core-tracing"; export const tracingClient = createTracingClient({ namespace: "Microsoft.Communication", packageName: "@azure/communication-tiering", - packageVersion: "1.0.0-beta.0" + packageVersion: "1.0.0-beta.1" }); diff --git a/sdk/communication/communication-tiering/src/tieringClient.ts b/sdk/communication/communication-tiering/src/tieringClient.ts index 2da3b0f806c8..6aceeca7f7bb 100644 --- a/sdk/communication/communication-tiering/src/tieringClient.ts +++ b/sdk/communication/communication-tiering/src/tieringClient.ts @@ -6,7 +6,7 @@ import { NumberAllotmentGetAcquiredNumberLimitsOptionalParams, TieringGetByResourceIdOptionalParams, AcsTier, - AssetDetailsModel + AssetDetailsModel, } from "./models"; import { CommonClientOptions, InternalClientPipelineOptions } from "@azure/core-client"; import { KeyCredential, TokenCredential, isTokenCredential } from "@azure/core-auth"; From 16e6e94056b85ec415c499a89f1a21b19f7dae4e Mon Sep 17 00:00:00 2001 From: Babacar Ndoye Date: Fri, 16 Jun 2023 15:08:34 -0500 Subject: [PATCH 20/21] Adding environment variables to test --- .../test/public/getAcquiredNumberLimit.spec.ts | 4 ++-- .../communication-tiering/test/public/getTierInfo.spec.ts | 4 ++-- .../communication-tiering/test/public/utils/recordedClient.ts | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sdk/communication/communication-tiering/test/public/getAcquiredNumberLimit.spec.ts b/sdk/communication/communication-tiering/test/public/getAcquiredNumberLimit.spec.ts index 87f8fba101e8..fd0db6a9d044 100644 --- a/sdk/communication/communication-tiering/test/public/getAcquiredNumberLimit.spec.ts +++ b/sdk/communication/communication-tiering/test/public/getAcquiredNumberLimit.spec.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { Context } from "mocha"; -import { Recorder } from "@azure-tools/test-recorder"; +import { Recorder, env } from "@azure-tools/test-recorder"; import { TieringClient } from "../../src"; import { assert } from "chai"; import { createRecordedClient } from "./utils/recordedClient"; @@ -23,7 +23,7 @@ describe(`TieringClient - Get Acquired Number Limits`, function () { it("get acquired number limits", async function () { // print all acquire number limits - const resourceId = "9d787bd6-07fc-4c7b-8e57-17f1fee41298"; + const resourceId = env.RESOURCE_ID || "9d787bd6-07fc-4c7b-8e57-17f1fee41298"; const acquiredNumberLimits = await client.getAcquiredNumberLimits(resourceId); assert.isNotNull(acquiredNumberLimits); }).timeout(10000); diff --git a/sdk/communication/communication-tiering/test/public/getTierInfo.spec.ts b/sdk/communication/communication-tiering/test/public/getTierInfo.spec.ts index 0796487cbacb..1bd61c23bc7d 100644 --- a/sdk/communication/communication-tiering/test/public/getTierInfo.spec.ts +++ b/sdk/communication/communication-tiering/test/public/getTierInfo.spec.ts @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { Context } from "mocha"; -import { Recorder } from "@azure-tools/test-recorder"; +import { Recorder, env } from "@azure-tools/test-recorder"; import { TieringClient } from "../../src"; import { assert } from "chai"; import { createRecordedClient } from "./utils/recordedClient"; @@ -23,7 +23,7 @@ describe(`TieringClient - Get Tier Info`, function () { it("get tier info", async function () { // print all tier info - const resourceId = "9d787bd6-07fc-4c7b-8e57-17f1fee41298"; + const resourceId = env.RESOURCE_ID || "9d787bd6-07fc-4c7b-8e57-17f1fee41298"; const tierInfo = await client.getTierByResourceId(resourceId); assert.isNotNull(tierInfo); }).timeout(10000); diff --git a/sdk/communication/communication-tiering/test/public/utils/recordedClient.ts b/sdk/communication/communication-tiering/test/public/utils/recordedClient.ts index c214f2a0ea8e..4860bde55b9b 100644 --- a/sdk/communication/communication-tiering/test/public/utils/recordedClient.ts +++ b/sdk/communication/communication-tiering/test/public/utils/recordedClient.ts @@ -29,6 +29,7 @@ const envSetupForPlayback: { [k: string]: string } = { AZURE_CLIENT_ID: "SomeClientId", AZURE_CLIENT_SECRET: "azure_client_secret", AZURE_TENANT_ID: "SomeTenantId", + RESOURCE_ID: "9d787bd6-07fc-4c7b-8e57-17f1fee41298" }; export const recorderOptions: RecorderStartOptions = { From 4130fc8d2b2098f319fbad53ab384f1f5f38667e Mon Sep 17 00:00:00 2001 From: Babacar Ndoye Date: Fri, 16 Jun 2023 15:58:25 -0500 Subject: [PATCH 21/21] Removing hardcoded environment variable for tests --- .../test/public/getAcquiredNumberLimit.spec.ts | 2 +- .../communication-tiering/test/public/getTierInfo.spec.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/communication/communication-tiering/test/public/getAcquiredNumberLimit.spec.ts b/sdk/communication/communication-tiering/test/public/getAcquiredNumberLimit.spec.ts index fd0db6a9d044..7be84e3eaa38 100644 --- a/sdk/communication/communication-tiering/test/public/getAcquiredNumberLimit.spec.ts +++ b/sdk/communication/communication-tiering/test/public/getAcquiredNumberLimit.spec.ts @@ -23,7 +23,7 @@ describe(`TieringClient - Get Acquired Number Limits`, function () { it("get acquired number limits", async function () { // print all acquire number limits - const resourceId = env.RESOURCE_ID || "9d787bd6-07fc-4c7b-8e57-17f1fee41298"; + const resourceId = env.RESOURCE_ID!; const acquiredNumberLimits = await client.getAcquiredNumberLimits(resourceId); assert.isNotNull(acquiredNumberLimits); }).timeout(10000); diff --git a/sdk/communication/communication-tiering/test/public/getTierInfo.spec.ts b/sdk/communication/communication-tiering/test/public/getTierInfo.spec.ts index 1bd61c23bc7d..c2958bdbcf75 100644 --- a/sdk/communication/communication-tiering/test/public/getTierInfo.spec.ts +++ b/sdk/communication/communication-tiering/test/public/getTierInfo.spec.ts @@ -23,7 +23,7 @@ describe(`TieringClient - Get Tier Info`, function () { it("get tier info", async function () { // print all tier info - const resourceId = env.RESOURCE_ID || "9d787bd6-07fc-4c7b-8e57-17f1fee41298"; + const resourceId = env.RESOURCE_ID!; const tierInfo = await client.getTierByResourceId(resourceId); assert.isNotNull(tierInfo); }).timeout(10000);