diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 5410f05207cf..442912058a8d 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -121,6 +121,7 @@ specifiers: '@rush-temp/arm-netapp': file:./projects/arm-netapp.tgz '@rush-temp/arm-network': file:./projects/arm-network.tgz '@rush-temp/arm-network-profile-2020-09-01-hybrid': file:./projects/arm-network-profile-2020-09-01-hybrid.tgz + '@rush-temp/arm-networkfunction': file:./projects/arm-networkfunction.tgz '@rush-temp/arm-notificationhubs': file:./projects/arm-notificationhubs.tgz '@rush-temp/arm-oep': file:./projects/arm-oep.tgz '@rush-temp/arm-operationalinsights': file:./projects/arm-operationalinsights.tgz @@ -410,6 +411,7 @@ dependencies: '@rush-temp/arm-netapp': file:projects/arm-netapp.tgz '@rush-temp/arm-network': file:projects/arm-network.tgz '@rush-temp/arm-network-profile-2020-09-01-hybrid': file:projects/arm-network-profile-2020-09-01-hybrid.tgz + '@rush-temp/arm-networkfunction': file:projects/arm-networkfunction.tgz '@rush-temp/arm-notificationhubs': file:projects/arm-notificationhubs.tgz '@rush-temp/arm-oep': file:projects/arm-oep.tgz '@rush-temp/arm-operationalinsights': file:projects/arm-operationalinsights.tgz @@ -3853,7 +3855,7 @@ packages: dependencies: semver: 7.3.7 shelljs: 0.8.5 - typescript: 4.8.0-dev.20220711 + typescript: 4.8.0-dev.20220712 dev: false /downlevel-dts/0.4.0: @@ -8663,8 +8665,8 @@ packages: hasBin: true dev: false - /typescript/4.8.0-dev.20220711: - resolution: {integrity: sha512-Nz1HlAkzZJ/OYZxqDEdoNV9GMq61xUss3JjveQqtdTiwhouLMa6D69C5K+P/fZD/hfrkMf/iqaF7xqVtX5KvPg==} + /typescript/4.8.0-dev.20220712: + resolution: {integrity: sha512-hYkF1Ja0C5ILf3+GZdvQLNxmSB1qUc60xrtKqKMvBzRHlew3CD/ZdDP+0J8rRzo33HxDP9kWL7d8SGrfx4QP1Q==} engines: {node: '>=4.2.0'} hasBin: true dev: false @@ -12547,6 +12549,30 @@ packages: - supports-color dev: false + file:projects/arm-networkfunction.tgz: + resolution: {integrity: sha512-b1M99fBJc82nGtex1Wvd9NIsg5fAAooxoHj4ryUriUEoHfufYi+oyGkUILwbsKoE3fEbguODqNAhOlBgDj3ohA==, tarball: file:projects/arm-networkfunction.tgz} + name: '@rush-temp/arm-networkfunction' + version: 0.0.0 + dependencies: + '@azure/core-lro': 2.2.4 + '@microsoft/api-extractor': 7.18.11 + '@rollup/plugin-commonjs': 21.1.0_rollup@2.76.0 + '@rollup/plugin-json': 4.1.0_rollup@2.76.0 + '@rollup/plugin-multi-entry': 4.1.0_rollup@2.76.0 + '@rollup/plugin-node-resolve': 13.3.0_rollup@2.76.0 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 2.76.0 + rollup-plugin-sourcemaps: 0.6.3_rollup@2.76.0 + tslib: 2.4.0 + typescript: 4.2.4 + uglify-js: 3.16.2 + transitivePeerDependencies: + - '@types/node' + dev: false + file:projects/arm-notificationhubs.tgz: resolution: {integrity: sha512-igzfDX+hUTmWr7b9jOHIoe/2mHl4zdsUU40LV2jYudTBnfsWLekFjSwlDVWZM5qhIznelrFZroiygp3tAk/BAw==, tarball: file:projects/arm-notificationhubs.tgz} name: '@rush-temp/arm-notificationhubs' @@ -15141,7 +15167,7 @@ packages: dev: false file:projects/core-rest-pipeline.tgz: - resolution: {integrity: sha512-IKe9R1HsE+DfwW/XeET5QryxhZhKTG0jKFe7nalx8fLRXvE0ZLSgFTekOXWlb0AdWid2fQ4QnK+kJc1hJWcrhw==, tarball: file:projects/core-rest-pipeline.tgz} + resolution: {integrity: sha512-ogCKDnbP8OQA8XUr8szudiw3+MbWGrNX5uHd0a3X3EZuzFBJ2HGWCn+ohVXDw1MZxZulZx3I1bDqXKJwD4oTIQ==, tarball: file:projects/core-rest-pipeline.tgz} name: '@rush-temp/core-rest-pipeline' version: 0.0.0 dependencies: @@ -17295,7 +17321,7 @@ packages: dev: false file:projects/service-bus.tgz: - resolution: {integrity: sha512-XL5lnV88QFKc60QcmhJ8F6n85FefahO8qO1Xz1afTYdOiBE8RZRI8i8Nh9EjeDA9iJ6zikztntX+PzuLJMAleA==, tarball: file:projects/service-bus.tgz} + resolution: {integrity: sha512-yHc+LXkOeCVnmfa7QywdQvjPGVqFdVOjbjIm2djWCm8u4phrb5anFLNG/AKGAi6hku28fqUY+iekUF5ajz62Kw==, tarball: file:projects/service-bus.tgz} name: '@rush-temp/service-bus' version: 0.0.0 dependencies: diff --git a/rush.json b/rush.json index 0a35e1d84e7b..a0cf5c383679 100644 --- a/rush.json +++ b/rush.json @@ -1755,6 +1755,11 @@ "packageName": "@azure/api-management-custom-widgets-scaffolder", "projectFolder": "sdk/apimanagement/api-management-custom-widgets-scaffolder", "versionPolicyName": "client" + }, + { + "packageName": "@azure/arm-networkfunction", + "projectFolder": "sdk/networkfunction/arm-networkfunction", + "versionPolicyName": "management" } ] } \ No newline at end of file diff --git a/sdk/networkfunction/arm-networkfunction/CHANGELOG.md b/sdk/networkfunction/arm-networkfunction/CHANGELOG.md new file mode 100644 index 000000000000..2dd4e1251cf4 --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0 (2022-07-13) + +The package of @azure/arm-networkfunction is using our next generation design principles. To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/networkfunction/arm-networkfunction/LICENSE b/sdk/networkfunction/arm-networkfunction/LICENSE new file mode 100644 index 000000000000..5d1d36e0af80 --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/networkfunction/arm-networkfunction/README.md b/sdk/networkfunction/arm-networkfunction/README.md new file mode 100644 index 000000000000..16866d5f9ebc --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/README.md @@ -0,0 +1,109 @@ +# AzureTrafficCollector client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for AzureTrafficCollector client. + +Azure Traffic Collector service + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/networkfunction/arm-networkfunction) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-networkfunction) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-networkfunction) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://nodejs.org/about/releases/) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-networkfunction` package + +Install the AzureTrafficCollector client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-networkfunction +``` + +### Create and authenticate a `AzureTrafficCollectorClient` + +To create a client object to access the AzureTrafficCollector API, you will need the `endpoint` of your AzureTrafficCollector resource and a `credential`. The AzureTrafficCollector client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your AzureTrafficCollector resource in the [Azure Portal][azure_portal]. + +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +npm install @azure/identity +``` + +You will also need to **register a new AAD application and grant access to AzureTrafficCollector** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. + +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). + +```javascript +const { AzureTrafficCollectorClient } = require("@azure/arm-networkfunction"); +const { DefaultAzureCredential } = require("@azure/identity"); +// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details. + +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new AzureTrafficCollectorClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new AzureTrafficCollectorClient(credential, subscriptionId); +``` + + +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). + +## Key concepts + +### AzureTrafficCollectorClient + +`AzureTrafficCollectorClient` is the primary interface for developers using the AzureTrafficCollector client library. Explore the methods on this client object to understand the different features of the AzureTrafficCollector service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); +``` + +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) 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) + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fnetworkfunction%2Farm-networkfunction%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/networkfunction/arm-networkfunction/_meta.json b/sdk/networkfunction/arm-networkfunction/_meta.json new file mode 100644 index 000000000000..fc87eebb1bbb --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/_meta.json @@ -0,0 +1,8 @@ +{ + "commit": "091e886e20f95241a190a319fbac3589889db3a7", + "readme": "specification/networkfunction/resource-manager/readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-js ../azure-rest-api-specs/specification/networkfunction/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.19.20220425.1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "release_tool": "@azure-tools/js-sdk-release-tools@2.4.0", + "use": "@autorest/typescript@6.0.0-alpha.19.20220425.1" +} \ No newline at end of file diff --git a/sdk/networkfunction/arm-networkfunction/api-extractor.json b/sdk/networkfunction/arm-networkfunction/api-extractor.json new file mode 100644 index 000000000000..6b40eed54b32 --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/api-extractor.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { + "enabled": true + }, + "apiReport": { + "enabled": true, + "reportFolder": "./review" + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-networkfunction.d.ts" + }, + "messages": { + "tsdocMessageReporting": { + "default": { + "logLevel": "none" + } + }, + "extractorMessageReporting": { + "ae-missing-release-tag": { + "logLevel": "none" + }, + "ae-unresolved-link": { + "logLevel": "none" + } + } + } +} \ No newline at end of file diff --git a/sdk/networkfunction/arm-networkfunction/package.json b/sdk/networkfunction/arm-networkfunction/package.json new file mode 100644 index 000000000000..77c576eb0449 --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/package.json @@ -0,0 +1,112 @@ +{ + "name": "@azure/arm-networkfunction", + "sdk-type": "mgmt", + "author": "Microsoft Corporation", + "description": "A generated SDK for AzureTrafficCollectorClient.", + "version": "1.0.0", + "engines": { + "node": ">=12.0.0" + }, + "dependencies": { + "@azure/core-lro": "^2.2.0", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.5.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.8.0", + "tslib": "^2.2.0" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "license": "MIT", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-networkfunction.d.ts", + "devDependencies": { + "@microsoft/api-extractor": "7.18.11", + "@rollup/plugin-commonjs": "^21.0.1", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-multi-entry": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.1.3", + "mkdirp": "^1.0.4", + "rollup": "^2.66.1", + "rollup-plugin-sourcemaps": "^0.6.3", + "typescript": "~4.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^2.0.0", + "@azure-tools/test-credential": "^1.0.0", + "mocha": "^7.1.1", + "cross-env": "^7.0.2", + "@azure/dev-tool": "^1.0.0" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/networkfunction/arm-networkfunction", + "repository": { + "type": "git", + "url": "https://github.com/Azure/azure-sdk-for-js.git" + }, + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "files": [ + "dist/**/*.js", + "dist/**/*.js.map", + "dist/**/*.d.ts", + "dist/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", + "src/**/*.ts", + "README.md", + "LICENSE", + "rollup.config.js", + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" + ], + "scripts": { + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/*.ts'", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" + }, + "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/azureTrafficCollectorClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true +} \ No newline at end of file diff --git a/sdk/networkfunction/arm-networkfunction/review/arm-networkfunction.api.md b/sdk/networkfunction/arm-networkfunction/review/arm-networkfunction.api.md new file mode 100644 index 000000000000..fa2edad499f7 --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/review/arm-networkfunction.api.md @@ -0,0 +1,385 @@ +## API Report File for "@azure/arm-networkfunction" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { PollOperationState } from '@azure/core-lro'; + +// @public +export type AzureTrafficCollector = TrackedResource & { + readonly etag?: string; + collectorPolicies?: CollectorPolicy[]; + virtualHub?: ResourceReference; + readonly provisioningState?: ProvisioningState; +}; + +// @public (undocumented) +export class AzureTrafficCollectorClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: AzureTrafficCollectorClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + azureTrafficCollectors: AzureTrafficCollectors; + // (undocumented) + azureTrafficCollectorsByResourceGroup: AzureTrafficCollectorsByResourceGroup; + // (undocumented) + azureTrafficCollectorsBySubscription: AzureTrafficCollectorsBySubscription; + // (undocumented) + collectorPolicies: CollectorPolicies; + // (undocumented) + networkFunction: NetworkFunction; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface AzureTrafficCollectorClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface AzureTrafficCollectorListResult { + readonly nextLink?: string; + value?: AzureTrafficCollector[]; +} + +// @public +export interface AzureTrafficCollectors { + beginCreateOrUpdate(resourceGroupName: string, azureTrafficCollectorName: string, options?: AzureTrafficCollectorsCreateOrUpdateOptionalParams): Promise, AzureTrafficCollectorsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, azureTrafficCollectorName: string, options?: AzureTrafficCollectorsCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, azureTrafficCollectorName: string, options?: AzureTrafficCollectorsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, azureTrafficCollectorName: string, options?: AzureTrafficCollectorsDeleteOptionalParams): Promise; + get(resourceGroupName: string, azureTrafficCollectorName: string, options?: AzureTrafficCollectorsGetOptionalParams): Promise; + updateTags(resourceGroupName: string, azureTrafficCollectorName: string, parameters: TagsObject, options?: AzureTrafficCollectorsUpdateTagsOptionalParams): Promise; +} + +// @public +export interface AzureTrafficCollectorsByResourceGroup { + list(resourceGroupName: string, options?: AzureTrafficCollectorsByResourceGroupListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface AzureTrafficCollectorsByResourceGroupListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AzureTrafficCollectorsByResourceGroupListNextResponse = AzureTrafficCollectorListResult; + +// @public +export interface AzureTrafficCollectorsByResourceGroupListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AzureTrafficCollectorsByResourceGroupListResponse = AzureTrafficCollectorListResult; + +// @public +export interface AzureTrafficCollectorsBySubscription { + list(options?: AzureTrafficCollectorsBySubscriptionListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface AzureTrafficCollectorsBySubscriptionListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AzureTrafficCollectorsBySubscriptionListNextResponse = AzureTrafficCollectorListResult; + +// @public +export interface AzureTrafficCollectorsBySubscriptionListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AzureTrafficCollectorsBySubscriptionListResponse = AzureTrafficCollectorListResult; + +// @public +export interface AzureTrafficCollectorsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + collectorPolicies?: CollectorPolicy[]; + location?: string; + resumeFrom?: string; + tags?: { + [propertyName: string]: string; + }; + updateIntervalInMs?: number; + virtualHub?: ResourceReference; +} + +// @public +export type AzureTrafficCollectorsCreateOrUpdateResponse = AzureTrafficCollector; + +// @public +export interface AzureTrafficCollectorsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface AzureTrafficCollectorsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AzureTrafficCollectorsGetResponse = AzureTrafficCollector; + +// @public +export interface AzureTrafficCollectorsUpdateTagsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AzureTrafficCollectorsUpdateTagsResponse = AzureTrafficCollector; + +// @public +export interface CloudError { + error?: CloudErrorBody; +} + +// @public +export interface CloudErrorBody { + code?: string; + details?: CloudErrorBody[]; + message?: string; + target?: string; +} + +// @public +export interface CollectorPolicies { + beginCreateOrUpdate(resourceGroupName: string, azureTrafficCollectorName: string, collectorPolicyName: string, options?: CollectorPoliciesCreateOrUpdateOptionalParams): Promise, CollectorPoliciesCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, azureTrafficCollectorName: string, collectorPolicyName: string, options?: CollectorPoliciesCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, azureTrafficCollectorName: string, collectorPolicyName: string, options?: CollectorPoliciesDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, azureTrafficCollectorName: string, collectorPolicyName: string, options?: CollectorPoliciesDeleteOptionalParams): Promise; + get(resourceGroupName: string, azureTrafficCollectorName: string, collectorPolicyName: string, options?: CollectorPoliciesGetOptionalParams): Promise; + list(resourceGroupName: string, azureTrafficCollectorName: string, options?: CollectorPoliciesListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface CollectorPoliciesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + emissionPolicies?: EmissionPoliciesPropertiesFormat[]; + ingestionPolicy?: IngestionPolicyPropertiesFormat; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type CollectorPoliciesCreateOrUpdateResponse = CollectorPolicy; + +// @public +export interface CollectorPoliciesDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface CollectorPoliciesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CollectorPoliciesGetResponse = CollectorPolicy; + +// @public +export interface CollectorPoliciesListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CollectorPoliciesListNextResponse = CollectorPolicyListResult; + +// @public +export interface CollectorPoliciesListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CollectorPoliciesListResponse = CollectorPolicyListResult; + +// @public +export type CollectorPolicy = ProxyResource & { + readonly etag?: string; + readonly systemData?: CollectorPolicySystemData; + ingestionPolicy?: IngestionPolicyPropertiesFormat; + emissionPolicies?: EmissionPoliciesPropertiesFormat[]; + readonly provisioningState?: ProvisioningState; +}; + +// @public +export interface CollectorPolicyListResult { + readonly nextLink?: string; + value?: CollectorPolicy[]; +} + +// @public +export type CollectorPolicySystemData = SystemData & {}; + +// @public +export type CreatedByType = string; + +// @public +export type DestinationType = string; + +// @public +export interface EmissionPoliciesPropertiesFormat { + emissionDestinations?: EmissionPolicyDestination[]; + emissionType?: EmissionType; +} + +// @public +export interface EmissionPolicyDestination { + destinationType?: DestinationType; +} + +// @public +export type EmissionType = string; + +// @public +export interface IngestionPolicyPropertiesFormat { + ingestionSources?: IngestionSourcesPropertiesFormat[]; + ingestionType?: IngestionType; +} + +// @public +export interface IngestionSourcesPropertiesFormat { + resourceId?: string; + sourceType?: SourceType; +} + +// @public +export type IngestionType = string; + +// @public +export enum KnownCreatedByType { + // (undocumented) + Application = "Application", + // (undocumented) + Key = "Key", + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + User = "User" +} + +// @public +export enum KnownDestinationType { + // (undocumented) + AzureMonitor = "AzureMonitor" +} + +// @public +export enum KnownEmissionType { + // (undocumented) + Ipfix = "IPFIX" +} + +// @public +export enum KnownIngestionType { + // (undocumented) + Ipfix = "IPFIX" +} + +// @public +export enum KnownProvisioningState { + // (undocumented) + Deleting = "Deleting", + // (undocumented) + Failed = "Failed", + // (undocumented) + Succeeded = "Succeeded", + // (undocumented) + Updating = "Updating" +} + +// @public +export enum KnownSourceType { + // (undocumented) + Resource = "Resource" +} + +// @public +export interface NetworkFunction { + listOperations(options?: NetworkFunctionListOperationsOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface NetworkFunctionListOperationsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type NetworkFunctionListOperationsResponse = OperationListResult; + +// @public +export interface Operation { + display?: OperationDisplay; + isDataAction?: boolean; + name?: string; + origin?: string; +} + +// @public +export interface OperationDisplay { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public +export interface OperationListResult { + nextLink?: string; + value?: Operation[]; +} + +// @public +export type ProvisioningState = string; + +// @public +export interface ProxyResource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +// @public +export interface ResourceReference { + readonly id?: string; +} + +// @public +export type SourceType = string; + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface TagsObject { + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export interface TrackedResource { + readonly id?: string; + location?: string; + readonly name?: string; + readonly systemData?: TrackedResourceSystemData; + tags?: { + [propertyName: string]: string; + }; + readonly type?: string; +} + +// @public +export type TrackedResourceSystemData = SystemData & {}; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/networkfunction/arm-networkfunction/rollup.config.js b/sdk/networkfunction/arm-networkfunction/rollup.config.js new file mode 100644 index 000000000000..3f89d7309da5 --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/rollup.config.js @@ -0,0 +1,122 @@ +/* + * 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 nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +// #region Warning Handler + +/** + * A function that can determine whether a rollup warning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEval(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependency(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"] + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"] + }), + cjs(), + json(), + sourcemaps() + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false +}; + +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}) + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies) + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/networkfunction/arm-networkfunction/src/azureTrafficCollectorClient.ts b/sdk/networkfunction/arm-networkfunction/src/azureTrafficCollectorClient.ts new file mode 100644 index 000000000000..02b8b1081eed --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/src/azureTrafficCollectorClient.ts @@ -0,0 +1,158 @@ +/* + * 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 * as coreAuth from "@azure/core-auth"; +import { + NetworkFunctionImpl, + AzureTrafficCollectorsBySubscriptionImpl, + AzureTrafficCollectorsByResourceGroupImpl, + AzureTrafficCollectorsImpl, + CollectorPoliciesImpl +} from "./operations"; +import { + NetworkFunction, + AzureTrafficCollectorsBySubscription, + AzureTrafficCollectorsByResourceGroup, + AzureTrafficCollectors, + CollectorPolicies +} from "./operationsInterfaces"; +import { AzureTrafficCollectorClientOptionalParams } from "./models"; + +export class AzureTrafficCollectorClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + + /** + * Initializes a new instance of the AzureTrafficCollectorClient class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId Azure Subscription ID. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: AzureTrafficCollectorClientOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (subscriptionId === undefined) { + throw new Error("'subscriptionId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: AzureTrafficCollectorClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-networkfunction/1.0.0`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + if (!options.credentialScopes) { + options.credentialScopes = ["https://management.azure.com/.default"]; + } + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: + options.endpoint ?? options.baseUri ?? "https://management.azure.com" + }; + 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.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2022-05-01"; + this.networkFunction = new NetworkFunctionImpl(this); + this.azureTrafficCollectorsBySubscription = new AzureTrafficCollectorsBySubscriptionImpl( + this + ); + this.azureTrafficCollectorsByResourceGroup = new AzureTrafficCollectorsByResourceGroupImpl( + this + ); + this.azureTrafficCollectors = new AzureTrafficCollectorsImpl(this); + this.collectorPolicies = new CollectorPoliciesImpl(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 item.replace(/(?<==).*$/, apiVersion); + } else { + return item; + } + }); + request.url = param[0] + "?" + newParams.join("&"); + } + return next(request); + } + }; + this.pipeline.addPolicy(apiVersionPolicy); + } + + networkFunction: NetworkFunction; + azureTrafficCollectorsBySubscription: AzureTrafficCollectorsBySubscription; + azureTrafficCollectorsByResourceGroup: AzureTrafficCollectorsByResourceGroup; + azureTrafficCollectors: AzureTrafficCollectors; + collectorPolicies: CollectorPolicies; +} diff --git a/sdk/networkfunction/arm-networkfunction/src/index.ts b/sdk/networkfunction/arm-networkfunction/src/index.ts new file mode 100644 index 000000000000..ed1432f03723 --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/src/index.ts @@ -0,0 +1,12 @@ +/* + * 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 { AzureTrafficCollectorClient } from "./azureTrafficCollectorClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/networkfunction/arm-networkfunction/src/lroImpl.ts b/sdk/networkfunction/arm-networkfunction/src/lroImpl.ts new file mode 100644 index 000000000000..518d5f053b4e --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/src/lroImpl.ts @@ -0,0 +1,34 @@ +/* + * 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 { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export class LroImpl implements LongRunningOperation { + constructor( + private sendOperationFn: (args: any, spec: any) => Promise>, + private args: Record, + private spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record, + public requestPath: string = spec.path!, + public requestMethod: string = spec.httpMethod + ) {} + public async sendInitialRequest(): Promise> { + return this.sendOperationFn(this.args, this.spec); + } + public async sendPollRequest(path: string): Promise> { + const { requestBody, ...restSpec } = this.spec; + return this.sendOperationFn(this.args, { + ...restSpec, + path, + httpMethod: "GET" + }); + } +} diff --git a/sdk/networkfunction/arm-networkfunction/src/models/index.ts b/sdk/networkfunction/arm-networkfunction/src/models/index.ts new file mode 100644 index 000000000000..9bedb02ac909 --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/src/models/index.ts @@ -0,0 +1,465 @@ +/* + * 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"; + +/** Result of the request to list Azure Traffic Collector operations. It contains a list of operations and a URL link to get the next set of results. */ +export interface OperationListResult { + /** List of operations supported by the Azure Traffic Collector resource provider. */ + value?: Operation[]; + /** URL to get the next set of operation list results if there are any. */ + nextLink?: string; +} + +/** Azure Traffic Collector REST API operation definition. */ +export interface Operation { + /** Operation name: {provider}/{resource}/{operation} */ + name?: string; + /** Indicates whether the operation is a data action */ + isDataAction?: boolean; + /** Display metadata associated with the operation. */ + display?: OperationDisplay; + /** Origin of the operation */ + origin?: string; +} + +/** Display metadata associated with the operation. */ +export interface OperationDisplay { + /** Service provider: Microsoft NetworkFunction. */ + provider?: string; + /** Resource on which the operation is performed etc. */ + resource?: string; + /** Type of operation: get, read, delete, etc. */ + operation?: string; + /** Description of the operation. */ + description?: string; +} + +/** An error response from the service. */ +export interface CloudError { + /** An error response from the service. */ + error?: CloudErrorBody; +} + +/** An error response from the service. */ +export interface CloudErrorBody { + /** An identifier for the error. Codes are invariant and are intended to be consumed programmatically. */ + code?: string; + /** A message describing the error, intended to be suitable for display in a user interface. */ + message?: string; + /** The target of the particular error. For example, the name of the property in error. */ + target?: string; + /** A list of additional details about the error. */ + details?: CloudErrorBody[]; +} + +/** Response for the ListTrafficCollectors API service call. */ +export interface AzureTrafficCollectorListResult { + /** A list of Traffic Collector resources. */ + value?: AzureTrafficCollector[]; + /** + * The URL to get the next set of results. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Ingestion Policy properties. */ +export interface IngestionPolicyPropertiesFormat { + /** The ingestion type. */ + ingestionType?: IngestionType; + /** Ingestion Sources. */ + ingestionSources?: IngestionSourcesPropertiesFormat[]; +} + +/** Ingestion policy properties. */ +export interface IngestionSourcesPropertiesFormat { + /** Ingestion source type. */ + sourceType?: SourceType; + /** Resource ID. */ + resourceId?: string; +} + +/** Emission policy properties. */ +export interface EmissionPoliciesPropertiesFormat { + /** Emission format type. */ + emissionType?: EmissionType; + /** Emission policy destinations. */ + emissionDestinations?: EmissionPolicyDestination[]; +} + +/** Emission policy destination properties. */ +export interface EmissionPolicyDestination { + /** Emission destination type. */ + destinationType?: DestinationType; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; +} + +/** An azure resource object */ +export interface ProxyResource { + /** + * Azure resource Id + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * Azure resource type + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * Azure resource name + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; +} + +/** Resource reference properties. */ +export interface ResourceReference { + /** + * Resource ID. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; +} + +/** Common resource representation. */ +export interface TrackedResource { + /** + * Resource ID. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * Resource name. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Resource type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** Resource location. */ + location?: string; + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** + * Metadata pertaining to creation and last modification of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: TrackedResourceSystemData; +} + +/** Tags object for patch operations. */ +export interface TagsObject { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; +} + +/** Response for the ListCollectorPolicies API service call. */ +export interface CollectorPolicyListResult { + /** A list of collection policies. */ + value?: CollectorPolicy[]; + /** + * The URL to get the next set of results. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export type CollectorPolicySystemData = SystemData & {}; + +/** Metadata pertaining to creation and last modification of the resource. */ +export type TrackedResourceSystemData = SystemData & {}; + +/** Collector policy resource. */ +export type CollectorPolicy = ProxyResource & { + /** + * A unique read-only string that changes whenever the resource is updated. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly etag?: string; + /** + * Metadata pertaining to creation and last modification of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: CollectorPolicySystemData; + /** Ingestion policies. */ + ingestionPolicy?: IngestionPolicyPropertiesFormat; + /** Emission policies. */ + emissionPolicies?: EmissionPoliciesPropertiesFormat[]; + /** + * The provisioning state. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; +}; + +/** Azure Traffic Collector resource. */ +export type AzureTrafficCollector = TrackedResource & { + /** + * A unique read-only string that changes whenever the resource is updated. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly etag?: string; + /** Collector Policies for Azure Traffic Collector. */ + collectorPolicies?: CollectorPolicy[]; + /** The virtualHub to which the Azure Traffic Collector belongs. */ + virtualHub?: ResourceReference; + /** + * The provisioning state of the application rule collection resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; +}; + +/** Known values of {@link IngestionType} that the service accepts. */ +export enum KnownIngestionType { + Ipfix = "IPFIX" +} + +/** + * Defines values for IngestionType. \ + * {@link KnownIngestionType} can be used interchangeably with IngestionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **IPFIX** + */ +export type IngestionType = string; + +/** Known values of {@link SourceType} that the service accepts. */ +export enum KnownSourceType { + Resource = "Resource" +} + +/** + * Defines values for SourceType. \ + * {@link KnownSourceType} can be used interchangeably with SourceType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Resource** + */ +export type SourceType = string; + +/** Known values of {@link EmissionType} that the service accepts. */ +export enum KnownEmissionType { + Ipfix = "IPFIX" +} + +/** + * Defines values for EmissionType. \ + * {@link KnownEmissionType} can be used interchangeably with EmissionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **IPFIX** + */ +export type EmissionType = string; + +/** Known values of {@link DestinationType} that the service accepts. */ +export enum KnownDestinationType { + AzureMonitor = "AzureMonitor" +} + +/** + * Defines values for DestinationType. \ + * {@link KnownDestinationType} can be used interchangeably with DestinationType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **AzureMonitor** + */ +export type DestinationType = string; + +/** Known values of {@link ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + Succeeded = "Succeeded", + Updating = "Updating", + Deleting = "Deleting", + Failed = "Failed" +} + +/** + * Defines values for ProvisioningState. \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Updating** \ + * **Deleting** \ + * **Failed** + */ +export type ProvisioningState = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + User = "User", + Application = "Application", + ManagedIdentity = "ManagedIdentity", + Key = "Key" +} + +/** + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type CreatedByType = string; + +/** Optional parameters. */ +export interface NetworkFunctionListOperationsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listOperations operation. */ +export type NetworkFunctionListOperationsResponse = OperationListResult; + +/** Optional parameters. */ +export interface AzureTrafficCollectorsBySubscriptionListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type AzureTrafficCollectorsBySubscriptionListResponse = AzureTrafficCollectorListResult; + +/** Optional parameters. */ +export interface AzureTrafficCollectorsBySubscriptionListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type AzureTrafficCollectorsBySubscriptionListNextResponse = AzureTrafficCollectorListResult; + +/** Optional parameters. */ +export interface AzureTrafficCollectorsByResourceGroupListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type AzureTrafficCollectorsByResourceGroupListResponse = AzureTrafficCollectorListResult; + +/** Optional parameters. */ +export interface AzureTrafficCollectorsByResourceGroupListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type AzureTrafficCollectorsByResourceGroupListNextResponse = AzureTrafficCollectorListResult; + +/** Optional parameters. */ +export interface AzureTrafficCollectorsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type AzureTrafficCollectorsGetResponse = AzureTrafficCollector; + +/** Optional parameters. */ +export interface AzureTrafficCollectorsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Resource location. */ + location?: string; + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** Collector Policies for Azure Traffic Collector. */ + collectorPolicies?: CollectorPolicy[]; + /** The virtualHub to which the Azure Traffic Collector belongs. */ + virtualHub?: ResourceReference; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type AzureTrafficCollectorsCreateOrUpdateResponse = AzureTrafficCollector; + +/** Optional parameters. */ +export interface AzureTrafficCollectorsDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface AzureTrafficCollectorsUpdateTagsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the updateTags operation. */ +export type AzureTrafficCollectorsUpdateTagsResponse = AzureTrafficCollector; + +/** Optional parameters. */ +export interface CollectorPoliciesListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type CollectorPoliciesListResponse = CollectorPolicyListResult; + +/** Optional parameters. */ +export interface CollectorPoliciesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type CollectorPoliciesGetResponse = CollectorPolicy; + +/** Optional parameters. */ +export interface CollectorPoliciesCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Ingestion policies. */ + ingestionPolicy?: IngestionPolicyPropertiesFormat; + /** Emission policies. */ + emissionPolicies?: EmissionPoliciesPropertiesFormat[]; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type CollectorPoliciesCreateOrUpdateResponse = CollectorPolicy; + +/** Optional parameters. */ +export interface CollectorPoliciesDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface CollectorPoliciesListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type CollectorPoliciesListNextResponse = CollectorPolicyListResult; + +/** Optional parameters. */ +export interface AzureTrafficCollectorClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/networkfunction/arm-networkfunction/src/models/mappers.ts b/sdk/networkfunction/arm-networkfunction/src/models/mappers.ts new file mode 100644 index 000000000000..0432d53758ed --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/src/models/mappers.ts @@ -0,0 +1,569 @@ +/* + * 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 OperationListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Operation" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const Operation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Operation", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + isDataAction: { + defaultValue: false, + serializedName: "isDataAction", + type: { + name: "Boolean" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + origin: { + serializedName: "origin", + type: { + name: "String" + } + } + } + } +}; + +export const OperationDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + } + } + } +}; + +export const CloudError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CloudError", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "CloudErrorBody" + } + } + } + } +}; + +export const CloudErrorBody: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CloudErrorBody", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + }, + target: { + serializedName: "target", + type: { + name: "String" + } + }, + details: { + serializedName: "details", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CloudErrorBody" + } + } + } + } + } + } +}; + +export const AzureTrafficCollectorListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AzureTrafficCollectorListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AzureTrafficCollector" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const IngestionPolicyPropertiesFormat: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "IngestionPolicyPropertiesFormat", + modelProperties: { + ingestionType: { + serializedName: "ingestionType", + type: { + name: "String" + } + }, + ingestionSources: { + serializedName: "ingestionSources", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "IngestionSourcesPropertiesFormat" + } + } + } + } + } + } +}; + +export const IngestionSourcesPropertiesFormat: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "IngestionSourcesPropertiesFormat", + modelProperties: { + sourceType: { + serializedName: "sourceType", + type: { + name: "String" + } + }, + resourceId: { + serializedName: "resourceId", + type: { + name: "String" + } + } + } + } +}; + +export const EmissionPoliciesPropertiesFormat: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EmissionPoliciesPropertiesFormat", + modelProperties: { + emissionType: { + serializedName: "emissionType", + type: { + name: "String" + } + }, + emissionDestinations: { + serializedName: "emissionDestinations", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "EmissionPolicyDestination" + } + } + } + } + } + } +}; + +export const EmissionPolicyDestination: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EmissionPolicyDestination", + modelProperties: { + destinationType: { + serializedName: "destinationType", + type: { + name: "String" + } + } + } + } +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String" + } + } + } + } +}; + +export const ProxyResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ResourceReference: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceReference", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const TrackedResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrackedResource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "TrackedResourceSystemData" + } + } + } + } +}; + +export const TagsObject: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TagsObject", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + } +}; + +export const CollectorPolicyListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CollectorPolicyListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CollectorPolicy" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const CollectorPolicySystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CollectorPolicySystemData", + modelProperties: { + ...SystemData.type.modelProperties + } + } +}; + +export const TrackedResourceSystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrackedResourceSystemData", + modelProperties: { + ...SystemData.type.modelProperties + } + } +}; + +export const CollectorPolicy: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CollectorPolicy", + modelProperties: { + ...ProxyResource.type.modelProperties, + etag: { + serializedName: "etag", + readOnly: true, + type: { + name: "String" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "CollectorPolicySystemData" + } + }, + ingestionPolicy: { + serializedName: "properties.ingestionPolicy", + type: { + name: "Composite", + className: "IngestionPolicyPropertiesFormat" + } + }, + emissionPolicies: { + serializedName: "properties.emissionPolicies", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "EmissionPoliciesPropertiesFormat" + } + } + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const AzureTrafficCollector: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AzureTrafficCollector", + modelProperties: { + ...TrackedResource.type.modelProperties, + etag: { + serializedName: "etag", + readOnly: true, + type: { + name: "String" + } + }, + collectorPolicies: { + serializedName: "properties.collectorPolicies", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CollectorPolicy" + } + } + } + }, + virtualHub: { + serializedName: "properties.virtualHub", + type: { + name: "Composite", + className: "ResourceReference" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; diff --git a/sdk/networkfunction/arm-networkfunction/src/models/parameters.ts b/sdk/networkfunction/arm-networkfunction/src/models/parameters.ts new file mode 100644 index 000000000000..026880fe15c2 --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/src/models/parameters.ts @@ -0,0 +1,157 @@ +/* + * 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"; +import { + AzureTrafficCollector as AzureTrafficCollectorMapper, + TagsObject as TagsObjectMapper, + CollectorPolicy as CollectorPolicyMapper +} from "../models/mappers"; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String" + } + } +}; + +export const $host: OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2022-05-01", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + serializedName: "subscriptionId", + required: true, + type: { + name: "String" + } + } +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + serializedName: "resourceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const azureTrafficCollectorName: OperationURLParameter = { + parameterPath: "azureTrafficCollectorName", + mapper: { + serializedName: "azureTrafficCollectorName", + required: true, + type: { + name: "String" + } + } +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const location: OperationParameter = { + parameterPath: ["options", "location"], + mapper: AzureTrafficCollectorMapper +}; + +export const tags: OperationParameter = { + parameterPath: ["options", "tags"], + mapper: AzureTrafficCollectorMapper +}; + +export const collectorPolicies: OperationParameter = { + parameterPath: ["options", "collectorPolicies"], + mapper: AzureTrafficCollectorMapper +}; + +export const virtualHub: OperationParameter = { + parameterPath: ["options", "virtualHub"], + mapper: AzureTrafficCollectorMapper +}; + +export const parameters1: OperationParameter = { + parameterPath: "parameters", + mapper: TagsObjectMapper +}; + +export const collectorPolicyName: OperationURLParameter = { + parameterPath: "collectorPolicyName", + mapper: { + serializedName: "collectorPolicyName", + required: true, + type: { + name: "String" + } + } +}; + +export const ingestionPolicy: OperationParameter = { + parameterPath: ["options", "ingestionPolicy"], + mapper: CollectorPolicyMapper +}; + +export const emissionPolicies: OperationParameter = { + parameterPath: ["options", "emissionPolicies"], + mapper: CollectorPolicyMapper +}; diff --git a/sdk/networkfunction/arm-networkfunction/src/operations/azureTrafficCollectors.ts b/sdk/networkfunction/arm-networkfunction/src/operations/azureTrafficCollectors.ts new file mode 100644 index 000000000000..7a69deea75a9 --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/src/operations/azureTrafficCollectors.ts @@ -0,0 +1,358 @@ +/* + * 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 { AzureTrafficCollectors } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureTrafficCollectorClient } from "../azureTrafficCollectorClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + AzureTrafficCollectorsGetOptionalParams, + AzureTrafficCollectorsGetResponse, + AzureTrafficCollectorsCreateOrUpdateOptionalParams, + AzureTrafficCollectorsCreateOrUpdateResponse, + AzureTrafficCollectorsDeleteOptionalParams, + TagsObject, + AzureTrafficCollectorsUpdateTagsOptionalParams, + AzureTrafficCollectorsUpdateTagsResponse +} from "../models"; + +/** Class containing AzureTrafficCollectors operations. */ +export class AzureTrafficCollectorsImpl implements AzureTrafficCollectors { + private readonly client: AzureTrafficCollectorClient; + + /** + * Initialize a new instance of the class AzureTrafficCollectors class. + * @param client Reference to the service client + */ + constructor(client: AzureTrafficCollectorClient) { + this.client = client; + } + + /** + * Gets the specified Azure Traffic Collector in a specified resource group + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param options The options parameters. + */ + get( + resourceGroupName: string, + azureTrafficCollectorName: string, + options?: AzureTrafficCollectorsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, azureTrafficCollectorName, options }, + getOperationSpec + ); + } + + /** + * Creates or updates a Azure Traffic Collector resource + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + azureTrafficCollectorName: string, + options?: AzureTrafficCollectorsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + AzureTrafficCollectorsCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, azureTrafficCollectorName, options }, + createOrUpdateOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Creates or updates a Azure Traffic Collector resource + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + azureTrafficCollectorName: string, + options?: AzureTrafficCollectorsCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + azureTrafficCollectorName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Deletes a specified Azure Traffic Collector resource. + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + azureTrafficCollectorName: string, + options?: AzureTrafficCollectorsDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, azureTrafficCollectorName, options }, + deleteOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Deletes a specified Azure Traffic Collector resource. + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + azureTrafficCollectorName: string, + options?: AzureTrafficCollectorsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + azureTrafficCollectorName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Updates the specified Azure Traffic Collector tags. + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param parameters Parameters supplied to update Azure Traffic Collector tags. + * @param options The options parameters. + */ + updateTags( + resourceGroupName: string, + azureTrafficCollectorName: string, + parameters: TagsObject, + options?: AzureTrafficCollectorsUpdateTagsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, azureTrafficCollectorName, parameters, options }, + updateTagsOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AzureTrafficCollector + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.azureTrafficCollectorName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.AzureTrafficCollector + }, + 201: { + bodyMapper: Mappers.AzureTrafficCollector + }, + 202: { + bodyMapper: Mappers.AzureTrafficCollector + }, + 204: { + bodyMapper: Mappers.AzureTrafficCollector + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: { + parameterPath: { + location: ["options", "location"], + tags: ["options", "tags"], + collectorPolicies: ["options", "collectorPolicies"], + virtualHub: ["options", "virtualHub"] + }, + mapper: { ...Mappers.AzureTrafficCollector, required: true } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.azureTrafficCollectorName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.azureTrafficCollectorName + ], + headerParameters: [Parameters.accept], + serializer +}; +const updateTagsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.AzureTrafficCollector + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.azureTrafficCollectorName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; diff --git a/sdk/networkfunction/arm-networkfunction/src/operations/azureTrafficCollectorsByResourceGroup.ts b/sdk/networkfunction/arm-networkfunction/src/operations/azureTrafficCollectorsByResourceGroup.ts new file mode 100644 index 000000000000..4a07337a16e1 --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/src/operations/azureTrafficCollectorsByResourceGroup.ts @@ -0,0 +1,163 @@ +/* + * 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 { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { AzureTrafficCollectorsByResourceGroup } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureTrafficCollectorClient } from "../azureTrafficCollectorClient"; +import { + AzureTrafficCollector, + AzureTrafficCollectorsByResourceGroupListNextOptionalParams, + AzureTrafficCollectorsByResourceGroupListOptionalParams, + AzureTrafficCollectorsByResourceGroupListResponse, + AzureTrafficCollectorsByResourceGroupListNextResponse +} from "../models"; + +/// +/** Class containing AzureTrafficCollectorsByResourceGroup operations. */ +export class AzureTrafficCollectorsByResourceGroupImpl + implements AzureTrafficCollectorsByResourceGroup { + private readonly client: AzureTrafficCollectorClient; + + /** + * Initialize a new instance of the class AzureTrafficCollectorsByResourceGroup class. + * @param client Reference to the service client + */ + constructor(client: AzureTrafficCollectorClient) { + this.client = client; + } + + /** + * Return list of Azure Traffic Collectors in a Resource Group + * @param resourceGroupName The name of the resource group. + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + options?: AzureTrafficCollectorsByResourceGroupListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(resourceGroupName, options); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + options?: AzureTrafficCollectorsByResourceGroupListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(resourceGroupName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + resourceGroupName: string, + options?: AzureTrafficCollectorsByResourceGroupListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(resourceGroupName, options)) { + yield* page; + } + } + + /** + * Return list of Azure Traffic Collectors in a Resource Group + * @param resourceGroupName The name of the resource group. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + options?: AzureTrafficCollectorsByResourceGroupListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + nextLink: string, + options?: AzureTrafficCollectorsByResourceGroupListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AzureTrafficCollectorListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AzureTrafficCollectorListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/networkfunction/arm-networkfunction/src/operations/azureTrafficCollectorsBySubscription.ts b/sdk/networkfunction/arm-networkfunction/src/operations/azureTrafficCollectorsBySubscription.ts new file mode 100644 index 000000000000..150ecdf697be --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/src/operations/azureTrafficCollectorsBySubscription.ts @@ -0,0 +1,143 @@ +/* + * 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 { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { AzureTrafficCollectorsBySubscription } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureTrafficCollectorClient } from "../azureTrafficCollectorClient"; +import { + AzureTrafficCollector, + AzureTrafficCollectorsBySubscriptionListNextOptionalParams, + AzureTrafficCollectorsBySubscriptionListOptionalParams, + AzureTrafficCollectorsBySubscriptionListResponse, + AzureTrafficCollectorsBySubscriptionListNextResponse +} from "../models"; + +/// +/** Class containing AzureTrafficCollectorsBySubscription operations. */ +export class AzureTrafficCollectorsBySubscriptionImpl + implements AzureTrafficCollectorsBySubscription { + private readonly client: AzureTrafficCollectorClient; + + /** + * Initialize a new instance of the class AzureTrafficCollectorsBySubscription class. + * @param client Reference to the service client + */ + constructor(client: AzureTrafficCollectorClient) { + this.client = client; + } + + /** + * Return list of Azure Traffic Collectors in a subscription + * @param options The options parameters. + */ + public list( + options?: AzureTrafficCollectorsBySubscriptionListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: AzureTrafficCollectorsBySubscriptionListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: AzureTrafficCollectorsBySubscriptionListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * Return list of Azure Traffic Collectors in a subscription + * @param options The options parameters. + */ + private _list( + options?: AzureTrafficCollectorsBySubscriptionListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + nextLink: string, + options?: AzureTrafficCollectorsBySubscriptionListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkFunction/azureTrafficCollectors", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AzureTrafficCollectorListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.AzureTrafficCollectorListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/networkfunction/arm-networkfunction/src/operations/collectorPolicies.ts b/sdk/networkfunction/arm-networkfunction/src/operations/collectorPolicies.ts new file mode 100644 index 000000000000..7e521971c6ad --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/src/operations/collectorPolicies.ts @@ -0,0 +1,498 @@ +/* + * 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 { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { CollectorPolicies } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureTrafficCollectorClient } from "../azureTrafficCollectorClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + CollectorPolicy, + CollectorPoliciesListNextOptionalParams, + CollectorPoliciesListOptionalParams, + CollectorPoliciesListResponse, + CollectorPoliciesGetOptionalParams, + CollectorPoliciesGetResponse, + CollectorPoliciesCreateOrUpdateOptionalParams, + CollectorPoliciesCreateOrUpdateResponse, + CollectorPoliciesDeleteOptionalParams, + CollectorPoliciesListNextResponse +} from "../models"; + +/// +/** Class containing CollectorPolicies operations. */ +export class CollectorPoliciesImpl implements CollectorPolicies { + private readonly client: AzureTrafficCollectorClient; + + /** + * Initialize a new instance of the class CollectorPolicies class. + * @param client Reference to the service client + */ + constructor(client: AzureTrafficCollectorClient) { + this.client = client; + } + + /** + * Return list of Collector policies in a Azure Traffic Collector + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param options The options parameters. + */ + public list( + resourceGroupName: string, + azureTrafficCollectorName: string, + options?: CollectorPoliciesListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + resourceGroupName, + azureTrafficCollectorName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage( + resourceGroupName, + azureTrafficCollectorName, + options + ); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + azureTrafficCollectorName: string, + options?: CollectorPoliciesListOptionalParams + ): AsyncIterableIterator { + let result = await this._list( + resourceGroupName, + azureTrafficCollectorName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext( + resourceGroupName, + azureTrafficCollectorName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + resourceGroupName: string, + azureTrafficCollectorName: string, + options?: CollectorPoliciesListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + azureTrafficCollectorName, + options + )) { + yield* page; + } + } + + /** + * Return list of Collector policies in a Azure Traffic Collector + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + azureTrafficCollectorName: string, + options?: CollectorPoliciesListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, azureTrafficCollectorName, options }, + listOperationSpec + ); + } + + /** + * Gets the collector policy in a specified Traffic Collector + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param collectorPolicyName Collector Policy Name + * @param options The options parameters. + */ + get( + resourceGroupName: string, + azureTrafficCollectorName: string, + collectorPolicyName: string, + options?: CollectorPoliciesGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + azureTrafficCollectorName, + collectorPolicyName, + options + }, + getOperationSpec + ); + } + + /** + * Creates or updates a Collector Policy resource + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param collectorPolicyName Collector Policy Name + * @param options The options parameters. + */ + async beginCreateOrUpdate( + resourceGroupName: string, + azureTrafficCollectorName: string, + collectorPolicyName: string, + options?: CollectorPoliciesCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + CollectorPoliciesCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { + resourceGroupName, + azureTrafficCollectorName, + collectorPolicyName, + options + }, + createOrUpdateOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + await poller.poll(); + return poller; + } + + /** + * Creates or updates a Collector Policy resource + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param collectorPolicyName Collector Policy Name + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + azureTrafficCollectorName: string, + collectorPolicyName: string, + options?: CollectorPoliciesCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + azureTrafficCollectorName, + collectorPolicyName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Deletes a specified Collector Policy resource. + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param collectorPolicyName Collector Policy Name + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + azureTrafficCollectorName: string, + collectorPolicyName: string, + options?: CollectorPoliciesDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { + resourceGroupName, + azureTrafficCollectorName, + collectorPolicyName, + options + }, + deleteOperationSpec + ); + const poller = new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); + await poller.poll(); + return poller; + } + + /** + * Deletes a specified Collector Policy resource. + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param collectorPolicyName Collector Policy Name + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + azureTrafficCollectorName: string, + collectorPolicyName: string, + options?: CollectorPoliciesDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + azureTrafficCollectorName, + collectorPolicyName, + options + ); + return poller.pollUntilDone(); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + azureTrafficCollectorName: string, + nextLink: string, + options?: CollectorPoliciesListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, azureTrafficCollectorName, nextLink, options }, + listNextOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName}/collectorPolicies", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CollectorPolicyListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.azureTrafficCollectorName + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName}/collectorPolicies/{collectorPolicyName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CollectorPolicy + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.azureTrafficCollectorName, + Parameters.collectorPolicyName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName}/collectorPolicies/{collectorPolicyName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.CollectorPolicy + }, + 201: { + bodyMapper: Mappers.CollectorPolicy + }, + 202: { + bodyMapper: Mappers.CollectorPolicy + }, + 204: { + bodyMapper: Mappers.CollectorPolicy + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: { + parameterPath: { + ingestionPolicy: ["options", "ingestionPolicy"], + emissionPolicies: ["options", "emissionPolicies"] + }, + mapper: { ...Mappers.CollectorPolicy, required: true } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.azureTrafficCollectorName, + Parameters.collectorPolicyName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkFunction/azureTrafficCollectors/{azureTrafficCollectorName}/collectorPolicies/{collectorPolicyName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.azureTrafficCollectorName, + Parameters.collectorPolicyName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CollectorPolicyListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink, + Parameters.resourceGroupName, + Parameters.azureTrafficCollectorName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/networkfunction/arm-networkfunction/src/operations/index.ts b/sdk/networkfunction/arm-networkfunction/src/operations/index.ts new file mode 100644 index 000000000000..d40fa77aefe1 --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/src/operations/index.ts @@ -0,0 +1,13 @@ +/* + * 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 "./networkFunction"; +export * from "./azureTrafficCollectorsBySubscription"; +export * from "./azureTrafficCollectorsByResourceGroup"; +export * from "./azureTrafficCollectors"; +export * from "./collectorPolicies"; diff --git a/sdk/networkfunction/arm-networkfunction/src/operations/networkFunction.ts b/sdk/networkfunction/arm-networkfunction/src/operations/networkFunction.ts new file mode 100644 index 000000000000..521995730ae7 --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/src/operations/networkFunction.ts @@ -0,0 +1,101 @@ +/* + * 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 { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { NetworkFunction } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { AzureTrafficCollectorClient } from "../azureTrafficCollectorClient"; +import { + Operation, + NetworkFunctionListOperationsOptionalParams, + NetworkFunctionListOperationsResponse +} from "../models"; + +/// +/** Class containing NetworkFunction operations. */ +export class NetworkFunctionImpl implements NetworkFunction { + private readonly client: AzureTrafficCollectorClient; + + /** + * Initialize a new instance of the class NetworkFunction class. + * @param client Reference to the service client + */ + constructor(client: AzureTrafficCollectorClient) { + this.client = client; + } + + /** + * Lists all of the available NetworkFunction Rest API operations. + * @param options The options parameters. + */ + public listOperations( + options?: NetworkFunctionListOperationsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listOperationsPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listOperationsPagingPage(options); + } + }; + } + + private async *listOperationsPagingPage( + options?: NetworkFunctionListOperationsOptionalParams + ): AsyncIterableIterator { + let result = await this._listOperations(options); + yield result.value || []; + } + + private async *listOperationsPagingAll( + options?: NetworkFunctionListOperationsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listOperationsPagingPage(options)) { + yield* page; + } + } + + /** + * Lists all of the available NetworkFunction Rest API operations. + * @param options The options parameters. + */ + private _listOperations( + options?: NetworkFunctionListOperationsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listOperationsOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationsOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.NetworkFunction/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/networkfunction/arm-networkfunction/src/operationsInterfaces/azureTrafficCollectors.ts b/sdk/networkfunction/arm-networkfunction/src/operationsInterfaces/azureTrafficCollectors.ts new file mode 100644 index 000000000000..c3e398b9d46b --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/src/operationsInterfaces/azureTrafficCollectors.ts @@ -0,0 +1,96 @@ +/* + * 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 { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + AzureTrafficCollectorsGetOptionalParams, + AzureTrafficCollectorsGetResponse, + AzureTrafficCollectorsCreateOrUpdateOptionalParams, + AzureTrafficCollectorsCreateOrUpdateResponse, + AzureTrafficCollectorsDeleteOptionalParams, + TagsObject, + AzureTrafficCollectorsUpdateTagsOptionalParams, + AzureTrafficCollectorsUpdateTagsResponse +} from "../models"; + +/** Interface representing a AzureTrafficCollectors. */ +export interface AzureTrafficCollectors { + /** + * Gets the specified Azure Traffic Collector in a specified resource group + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param options The options parameters. + */ + get( + resourceGroupName: string, + azureTrafficCollectorName: string, + options?: AzureTrafficCollectorsGetOptionalParams + ): Promise; + /** + * Creates or updates a Azure Traffic Collector resource + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + azureTrafficCollectorName: string, + options?: AzureTrafficCollectorsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + AzureTrafficCollectorsCreateOrUpdateResponse + > + >; + /** + * Creates or updates a Azure Traffic Collector resource + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + azureTrafficCollectorName: string, + options?: AzureTrafficCollectorsCreateOrUpdateOptionalParams + ): Promise; + /** + * Deletes a specified Azure Traffic Collector resource. + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + azureTrafficCollectorName: string, + options?: AzureTrafficCollectorsDeleteOptionalParams + ): Promise, void>>; + /** + * Deletes a specified Azure Traffic Collector resource. + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + azureTrafficCollectorName: string, + options?: AzureTrafficCollectorsDeleteOptionalParams + ): Promise; + /** + * Updates the specified Azure Traffic Collector tags. + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param parameters Parameters supplied to update Azure Traffic Collector tags. + * @param options The options parameters. + */ + updateTags( + resourceGroupName: string, + azureTrafficCollectorName: string, + parameters: TagsObject, + options?: AzureTrafficCollectorsUpdateTagsOptionalParams + ): Promise; +} diff --git a/sdk/networkfunction/arm-networkfunction/src/operationsInterfaces/azureTrafficCollectorsByResourceGroup.ts b/sdk/networkfunction/arm-networkfunction/src/operationsInterfaces/azureTrafficCollectorsByResourceGroup.ts new file mode 100644 index 000000000000..1df4fe9e43b4 --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/src/operationsInterfaces/azureTrafficCollectorsByResourceGroup.ts @@ -0,0 +1,27 @@ +/* + * 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 { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + AzureTrafficCollector, + AzureTrafficCollectorsByResourceGroupListOptionalParams +} from "../models"; + +/// +/** Interface representing a AzureTrafficCollectorsByResourceGroup. */ +export interface AzureTrafficCollectorsByResourceGroup { + /** + * Return list of Azure Traffic Collectors in a Resource Group + * @param resourceGroupName The name of the resource group. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + options?: AzureTrafficCollectorsByResourceGroupListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/networkfunction/arm-networkfunction/src/operationsInterfaces/azureTrafficCollectorsBySubscription.ts b/sdk/networkfunction/arm-networkfunction/src/operationsInterfaces/azureTrafficCollectorsBySubscription.ts new file mode 100644 index 000000000000..ecd1282ec14f --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/src/operationsInterfaces/azureTrafficCollectorsBySubscription.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 { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + AzureTrafficCollector, + AzureTrafficCollectorsBySubscriptionListOptionalParams +} from "../models"; + +/// +/** Interface representing a AzureTrafficCollectorsBySubscription. */ +export interface AzureTrafficCollectorsBySubscription { + /** + * Return list of Azure Traffic Collectors in a subscription + * @param options The options parameters. + */ + list( + options?: AzureTrafficCollectorsBySubscriptionListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/networkfunction/arm-networkfunction/src/operationsInterfaces/collectorPolicies.ts b/sdk/networkfunction/arm-networkfunction/src/operationsInterfaces/collectorPolicies.ts new file mode 100644 index 000000000000..c7e0755cd3dc --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/src/operationsInterfaces/collectorPolicies.ts @@ -0,0 +1,105 @@ +/* + * 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 { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + CollectorPolicy, + CollectorPoliciesListOptionalParams, + CollectorPoliciesGetOptionalParams, + CollectorPoliciesGetResponse, + CollectorPoliciesCreateOrUpdateOptionalParams, + CollectorPoliciesCreateOrUpdateResponse, + CollectorPoliciesDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a CollectorPolicies. */ +export interface CollectorPolicies { + /** + * Return list of Collector policies in a Azure Traffic Collector + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param options The options parameters. + */ + list( + resourceGroupName: string, + azureTrafficCollectorName: string, + options?: CollectorPoliciesListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets the collector policy in a specified Traffic Collector + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param collectorPolicyName Collector Policy Name + * @param options The options parameters. + */ + get( + resourceGroupName: string, + azureTrafficCollectorName: string, + collectorPolicyName: string, + options?: CollectorPoliciesGetOptionalParams + ): Promise; + /** + * Creates or updates a Collector Policy resource + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param collectorPolicyName Collector Policy Name + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + azureTrafficCollectorName: string, + collectorPolicyName: string, + options?: CollectorPoliciesCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + CollectorPoliciesCreateOrUpdateResponse + > + >; + /** + * Creates or updates a Collector Policy resource + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param collectorPolicyName Collector Policy Name + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + azureTrafficCollectorName: string, + collectorPolicyName: string, + options?: CollectorPoliciesCreateOrUpdateOptionalParams + ): Promise; + /** + * Deletes a specified Collector Policy resource. + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param collectorPolicyName Collector Policy Name + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + azureTrafficCollectorName: string, + collectorPolicyName: string, + options?: CollectorPoliciesDeleteOptionalParams + ): Promise, void>>; + /** + * Deletes a specified Collector Policy resource. + * @param resourceGroupName The name of the resource group. + * @param azureTrafficCollectorName Azure Traffic Collector name + * @param collectorPolicyName Collector Policy Name + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + azureTrafficCollectorName: string, + collectorPolicyName: string, + options?: CollectorPoliciesDeleteOptionalParams + ): Promise; +} diff --git a/sdk/networkfunction/arm-networkfunction/src/operationsInterfaces/index.ts b/sdk/networkfunction/arm-networkfunction/src/operationsInterfaces/index.ts new file mode 100644 index 000000000000..d40fa77aefe1 --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/src/operationsInterfaces/index.ts @@ -0,0 +1,13 @@ +/* + * 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 "./networkFunction"; +export * from "./azureTrafficCollectorsBySubscription"; +export * from "./azureTrafficCollectorsByResourceGroup"; +export * from "./azureTrafficCollectors"; +export * from "./collectorPolicies"; diff --git a/sdk/networkfunction/arm-networkfunction/src/operationsInterfaces/networkFunction.ts b/sdk/networkfunction/arm-networkfunction/src/operationsInterfaces/networkFunction.ts new file mode 100644 index 000000000000..982e1d1e969f --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/src/operationsInterfaces/networkFunction.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 { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + Operation, + NetworkFunctionListOperationsOptionalParams +} from "../models"; + +/// +/** Interface representing a NetworkFunction. */ +export interface NetworkFunction { + /** + * Lists all of the available NetworkFunction Rest API operations. + * @param options The options parameters. + */ + listOperations( + options?: NetworkFunctionListOperationsOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/networkfunction/arm-networkfunction/test/sampleTest.ts b/sdk/networkfunction/arm-networkfunction/test/sampleTest.ts new file mode 100644 index 000000000000..25aeb3ebcc36 --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/test/sampleTest.ts @@ -0,0 +1,43 @@ +/* + * 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 { + Recorder, + RecorderStartOptions, + env +} from "@azure-tools/test-recorder"; +import { assert } from "chai"; +import { Context } from "mocha"; + +const replaceableVariables: Record = { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" +}; + +const recorderOptions: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function(this: Context) { + recorder = new Recorder(this.currentTest); + await recorder.start(recorderOptions); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/networkfunction/arm-networkfunction/tsconfig.json b/sdk/networkfunction/arm-networkfunction/tsconfig.json new file mode 100644 index 000000000000..3e6ae96443f3 --- /dev/null +++ b/sdk/networkfunction/arm-networkfunction/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "es6", + "moduleResolution": "node", + "strict": true, + "target": "es6", + "sourceMap": true, + "declarationMap": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es6", + "dom" + ], + "declaration": true, + "outDir": "./dist-esm", + "importHelpers": true + }, + "include": [ + "./src/**/*.ts", + "./test/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/sdk/networkfunction/ci.mgmt.yml b/sdk/networkfunction/ci.mgmt.yml new file mode 100644 index 000000000000..339877e136e2 --- /dev/null +++ b/sdk/networkfunction/ci.mgmt.yml @@ -0,0 +1,38 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/networkfunction/arm-networkfunction + - sdk/networkfunction/ci.mgmt.yml + +pr: + branches: + include: + - main + - feature/* + - release/* + - hotfix/* + exclude: + - feature/v4 + paths: + include: + - sdk/networkfunction/arm-networkfunction + - sdk/networkfunction/ci.mgmt.yml + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: networkfunction + Artifacts: + - name: azure-arm-networkfunction + safeName: azurearmnetworkfunction + \ No newline at end of file