diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 3071a32ae3ea..466ca4ceba9c 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -3874,7 +3874,7 @@ packages: dependencies: semver: 7.5.0 shelljs: 0.8.5 - typescript: 5.1.0-dev.20230502 + typescript: 5.1.0-dev.20230508 dev: false /ecdsa-sig-formatter/1.0.11: @@ -8554,8 +8554,8 @@ packages: hasBin: true dev: false - /typescript/5.1.0-dev.20230502: - resolution: {integrity: sha512-xhGigho37UgtjMkTWMKDtIBV6ElFjcMFdzwTPQ0knTCSJ8tq0ENGsQPeTe0E7Db7mgZYWULEZnzs8KZ8IlHHLQ==} + /typescript/5.1.0-dev.20230508: + resolution: {integrity: sha512-87gFJLsUB0IWN6/MUhh0QHS+qnLR5gTGwZr5vU5dYEVPv+VTNv/g2oXLWr5LCEP+hyj+a4LXx8QjCD7x6v+5wg==} engines: {node: '>=14.17'} hasBin: true dev: false @@ -11636,7 +11636,7 @@ packages: dev: false file:projects/arm-dns.tgz: - resolution: {integrity: sha512-oMp5u+IM0Sd2+2Bq9HDhWui5fVmPfHRJ2BxRcE5Lns1TCVeKJPBRrWIvgT1x908Kh8waE0gnIlr+NOCHI0hmHA==, tarball: file:projects/arm-dns.tgz} + resolution: {integrity: sha512-aM/Y+MH9z2mS6Q08EIaOfXiZMuZmFjrRN/SMfXEQICTh8r0PLFHLaEsG/mIJicLj//ZOlYFh2lip9JEHsfqxpA==, tarball: file:projects/arm-dns.tgz} name: '@rush-temp/arm-dns' version: 0.0.0 dependencies: @@ -11650,7 +11650,8 @@ packages: '@types/node': 14.18.43 chai: 4.3.7 cross-env: 7.0.3 - mkdirp: 1.0.4 + dotenv: 16.0.3 + mkdirp: 2.1.6 mocha: 7.2.0 rimraf: 3.0.2 rollup: 2.79.1 @@ -15895,7 +15896,7 @@ packages: dev: false file:projects/communication-rooms.tgz: - resolution: {integrity: sha512-MWKqSMfk8nSMa06UaTb9zmyhqNzJHHdxqKvtjLUGw3ULCN+SopfAL4owdy0rfkvZ+2UEH3OBmxnbwJbuASIIWA==, tarball: file:projects/communication-rooms.tgz} + resolution: {integrity: sha512-1jxME+P4umHDyg1wNfAWpx4pTbspvARTojOKayxAUPp6cEj0FqFIxb/GAW62LQRE3RcHwH7oxPZQuEozv2Ocww==, tarball: file:projects/communication-rooms.tgz} name: '@rush-temp/communication-rooms' version: 0.0.0 dependencies: diff --git a/sdk/dns/arm-dns/CHANGELOG.md b/sdk/dns/arm-dns/CHANGELOG.md index 8223906e5298..01a232b0e0b1 100644 --- a/sdk/dns/arm-dns/CHANGELOG.md +++ b/sdk/dns/arm-dns/CHANGELOG.md @@ -1,15 +1,19 @@ # Release History + +## 5.2.0 (2023-05-08) + +**Features** -## 5.1.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes - + - Interface RecordSetsListAllByDnsZoneNextOptionalParams no longer has parameter recordSetNameSuffix + - Interface RecordSetsListAllByDnsZoneNextOptionalParams no longer has parameter top + - Interface RecordSetsListByDnsZoneNextOptionalParams no longer has parameter recordsetnamesuffix + - Interface RecordSetsListByDnsZoneNextOptionalParams no longer has parameter top + - Interface RecordSetsListByTypeNextOptionalParams no longer has parameter recordsetnamesuffix + - Interface RecordSetsListByTypeNextOptionalParams no longer has parameter top + - Interface ZonesListByResourceGroupNextOptionalParams no longer has parameter top + - Interface ZonesListNextOptionalParams no longer has parameter top + + ## 5.1.0 (2022-11-22) **Features** diff --git a/sdk/dns/arm-dns/LICENSE b/sdk/dns/arm-dns/LICENSE index 5d1d36e0af80..3a1d9b6f24f7 100644 --- a/sdk/dns/arm-dns/LICENSE +++ b/sdk/dns/arm-dns/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2022 Microsoft +Copyright (c) 2023 Microsoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/sdk/dns/arm-dns/_meta.json b/sdk/dns/arm-dns/_meta.json index 62bb5cac0934..cc792ff949a2 100644 --- a/sdk/dns/arm-dns/_meta.json +++ b/sdk/dns/arm-dns/_meta.json @@ -1,8 +1,8 @@ { - "commit": "20df2424a278ca19437e437a7dbf3a7857a0dd9d", + "commit": "17aa6a1314de5aafef059d9aa2229901df506e75", "readme": "specification/dns/resource-manager/readme.md", - "autorest_command": "autorest --version=3.8.4 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\dns\\resource-manager\\readme.md --use=@autorest/typescript@6.0.0-rc.3.20221108.1 --generate-sample=true", + "autorest_command": "autorest --version=3.9.3 --typescript --modelerfour.lenient-model-deduplication --azure-arm --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\Git\\azure-sdk-for-js ..\\azure-rest-api-specs\\specification\\dns\\resource-manager\\readme.md --use=@autorest/typescript@6.0.1 --generate-sample=true", "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "release_tool": "@azure-tools/js-sdk-release-tools@2.4.2", - "use": "@autorest/typescript@6.0.0-rc.3.20221108.1" + "release_tool": "@azure-tools/js-sdk-release-tools@2.6.2", + "use": "@autorest/typescript@6.0.1" } \ No newline at end of file diff --git a/sdk/dns/arm-dns/package.json b/sdk/dns/arm-dns/package.json index 9d88f77f7653..590f90418607 100644 --- a/sdk/dns/arm-dns/package.json +++ b/sdk/dns/arm-dns/package.json @@ -3,15 +3,15 @@ "sdk-type": "mgmt", "author": "Microsoft Corporation", "description": "A generated SDK for DnsManagementClient.", - "version": "5.1.1", + "version": "5.2.0", "engines": { "node": ">=14.0.0" }, "dependencies": { - "@azure/core-lro": "^2.2.0", + "@azure/core-lro": "^2.5.0", "@azure/abort-controller": "^1.0.0", "@azure/core-paging": "^1.2.0", - "@azure/core-client": "^1.6.1", + "@azure/core-client": "^1.7.0", "@azure/core-auth": "^1.3.0", "@azure/core-rest-pipeline": "^1.8.0", "tslib": "^2.2.0" @@ -33,12 +33,13 @@ "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-multi-entry": "^6.0.0", "@rollup/plugin-node-resolve": "^13.1.3", - "mkdirp": "^1.0.4", + "mkdirp": "^2.1.2", "rollup": "^2.66.1", "rollup-plugin-sourcemaps": "^0.6.3", "typescript": "~5.0.0", "uglify-js": "^3.4.9", "rimraf": "^3.0.0", + "dotenv": "^16.0.0", "@azure/identity": "^2.0.1", "@azure-tools/test-recorder": "^3.0.0", "@azure-tools/test-credential": "^1.0.0", @@ -49,7 +50,6 @@ "@types/node": "^14.0.0", "@azure/dev-tool": "^1.0.0" }, - "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/dns/arm-dns", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" @@ -111,6 +111,7 @@ ] }, "autoPublish": true, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/dns/arm-dns", "//sampleConfiguration": { "productName": "", "productSlugs": [ diff --git a/sdk/dns/arm-dns/review/arm-dns.api.md b/sdk/dns/arm-dns/review/arm-dns.api.md index a5b61162778b..5c5cd58e3b68 100644 --- a/sdk/dns/arm-dns/review/arm-dns.api.md +++ b/sdk/dns/arm-dns/review/arm-dns.api.md @@ -6,9 +6,9 @@ import * as coreAuth from '@azure/core-auth'; import * as coreClient from '@azure/core-client'; +import { OperationState } from '@azure/core-lro'; import { PagedAsyncIterableIterator } from '@azure/core-paging'; -import { PollerLike } from '@azure/core-lro'; -import { PollOperationState } from '@azure/core-lro'; +import { SimplePollerLike } from '@azure/core-lro'; // @public export interface AaaaRecord { @@ -181,8 +181,6 @@ export type RecordSetsGetResponse = RecordSet; // @public export interface RecordSetsListAllByDnsZoneNextOptionalParams extends coreClient.OperationOptions { - recordSetNameSuffix?: string; - top?: number; } // @public @@ -199,8 +197,6 @@ export type RecordSetsListAllByDnsZoneResponse = RecordSetListResult; // @public export interface RecordSetsListByDnsZoneNextOptionalParams extends coreClient.OperationOptions { - recordsetnamesuffix?: string; - top?: number; } // @public @@ -217,8 +213,6 @@ export type RecordSetsListByDnsZoneResponse = RecordSetListResult; // @public export interface RecordSetsListByTypeNextOptionalParams extends coreClient.OperationOptions { - recordsetnamesuffix?: string; - top?: number; } // @public @@ -309,7 +303,7 @@ export interface ZoneListResult { // @public export interface Zones { - beginDelete(resourceGroupName: string, zoneName: string, options?: ZonesDeleteOptionalParams): Promise, void>>; + beginDelete(resourceGroupName: string, zoneName: string, options?: ZonesDeleteOptionalParams): Promise, void>>; beginDeleteAndWait(resourceGroupName: string, zoneName: string, options?: ZonesDeleteOptionalParams): Promise; createOrUpdate(resourceGroupName: string, zoneName: string, parameters: Zone, options?: ZonesCreateOrUpdateOptionalParams): Promise; get(resourceGroupName: string, zoneName: string, options?: ZonesGetOptionalParams): Promise; @@ -343,7 +337,6 @@ export type ZonesGetResponse = Zone; // @public export interface ZonesListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { - top?: number; } // @public @@ -359,7 +352,6 @@ export type ZonesListByResourceGroupResponse = ZoneListResult; // @public export interface ZonesListNextOptionalParams extends coreClient.OperationOptions { - top?: number; } // @public diff --git a/sdk/dns/arm-dns/samples-dev/dnsResourceReferenceGetByTargetResourcesSample.ts b/sdk/dns/arm-dns/samples-dev/dnsResourceReferenceGetByTargetResourcesSample.ts index d821484661a3..557e412a2b69 100644 --- a/sdk/dns/arm-dns/samples-dev/dnsResourceReferenceGetByTargetResourcesSample.ts +++ b/sdk/dns/arm-dns/samples-dev/dnsResourceReferenceGetByTargetResourcesSample.ts @@ -13,6 +13,9 @@ import { DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Returns the DNS records specified by the referencing targetResourceIds. @@ -21,7 +24,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetDnsResourceReference.json */ async function listZonesByResourceGroup() { - const subscriptionId = "subid"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; const parameters: DnsResourceReferenceRequest = { targetResources: [ { @@ -38,4 +41,8 @@ async function listZonesByResourceGroup() { console.log(result); } -listZonesByResourceGroup().catch(console.error); +async function main() { + listZonesByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples-dev/recordSetsCreateOrUpdateSample.ts b/sdk/dns/arm-dns/samples-dev/recordSetsCreateOrUpdateSample.ts index 503aab50d6f9..63ca1b658910 100644 --- a/sdk/dns/arm-dns/samples-dev/recordSetsCreateOrUpdateSample.ts +++ b/sdk/dns/arm-dns/samples-dev/recordSetsCreateOrUpdateSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { RecordSet, DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateARecordset.json */ async function createARecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -40,8 +43,6 @@ async function createARecordset() { console.log(result); } -createARecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -49,8 +50,8 @@ createARecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateARecordsetAlias.json */ async function createARecordsetWithAliasTargetResource() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -74,8 +75,6 @@ async function createARecordsetWithAliasTargetResource() { console.log(result); } -createARecordsetWithAliasTargetResource().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -83,8 +82,8 @@ createARecordsetWithAliasTargetResource().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateAAAARecordset.json */ async function createAaaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "AAAA"; @@ -105,8 +104,6 @@ async function createAaaaRecordset() { console.log(result); } -createAaaaRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -114,8 +111,8 @@ createAaaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateCaaRecordset.json */ async function createCaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "CAA"; @@ -136,8 +133,6 @@ async function createCaaRecordset() { console.log(result); } -createCaaRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -145,8 +140,8 @@ createCaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateCNAMERecordset.json */ async function createCnameRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "CNAME"; @@ -167,8 +162,6 @@ async function createCnameRecordset() { console.log(result); } -createCnameRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -176,8 +169,8 @@ createCnameRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateMXRecordset.json */ async function createMxRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "MX"; @@ -198,8 +191,6 @@ async function createMxRecordset() { console.log(result); } -createMxRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -207,8 +198,8 @@ createMxRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateNSRecordset.json */ async function createNsRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "NS"; @@ -229,8 +220,6 @@ async function createNsRecordset() { console.log(result); } -createNsRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -238,8 +227,8 @@ createNsRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdatePTRRecordset.json */ async function createPtrRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "0.0.127.in-addr.arpa"; const relativeRecordSetName = "1"; const recordType = "PTR"; @@ -260,8 +249,6 @@ async function createPtrRecordset() { console.log(result); } -createPtrRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -269,8 +256,8 @@ createPtrRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateSOARecordset.json */ async function createSoaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "@"; const recordType = "SOA"; @@ -299,8 +286,6 @@ async function createSoaRecordset() { console.log(result); } -createSoaRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -308,8 +293,8 @@ createSoaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateSRVRecordset.json */ async function createSrvRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "SRV"; @@ -330,8 +315,6 @@ async function createSrvRecordset() { console.log(result); } -createSrvRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -339,8 +322,8 @@ createSrvRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateTXTRecordset.json */ async function createTxtRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "TXT"; @@ -361,4 +344,18 @@ async function createTxtRecordset() { console.log(result); } -createTxtRecordset().catch(console.error); +async function main() { + createARecordset(); + createARecordsetWithAliasTargetResource(); + createAaaaRecordset(); + createCaaRecordset(); + createCnameRecordset(); + createMxRecordset(); + createNsRecordset(); + createPtrRecordset(); + createSoaRecordset(); + createSrvRecordset(); + createTxtRecordset(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples-dev/recordSetsDeleteSample.ts b/sdk/dns/arm-dns/samples-dev/recordSetsDeleteSample.ts index dfd43a5b485e..7ba1f97582d8 100644 --- a/sdk/dns/arm-dns/samples-dev/recordSetsDeleteSample.ts +++ b/sdk/dns/arm-dns/samples-dev/recordSetsDeleteSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteARecordset.json */ async function deleteARecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -34,8 +37,6 @@ async function deleteARecordset() { console.log(result); } -deleteARecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -43,8 +44,8 @@ deleteARecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteAAAARecordset.json */ async function deleteAaaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "AAAA"; @@ -59,8 +60,6 @@ async function deleteAaaaRecordset() { console.log(result); } -deleteAaaaRecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -68,8 +67,8 @@ deleteAaaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteCaaRecordset.json */ async function deleteCaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "CAA"; @@ -84,8 +83,6 @@ async function deleteCaaRecordset() { console.log(result); } -deleteCaaRecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -93,8 +90,8 @@ deleteCaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteARecordset.json */ async function deleteCnameRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -109,8 +106,6 @@ async function deleteCnameRecordset() { console.log(result); } -deleteCnameRecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -118,8 +113,8 @@ deleteCnameRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteARecordset.json */ async function deleteMxRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -134,8 +129,6 @@ async function deleteMxRecordset() { console.log(result); } -deleteMxRecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -143,8 +136,8 @@ deleteMxRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteARecordset.json */ async function deleteNsRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -159,8 +152,6 @@ async function deleteNsRecordset() { console.log(result); } -deleteNsRecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -168,8 +159,8 @@ deleteNsRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeletePTRRecordset.json */ async function deletePtrRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "0.0.127.in-addr.arpa"; const relativeRecordSetName = "1"; const recordType = "PTR"; @@ -184,8 +175,6 @@ async function deletePtrRecordset() { console.log(result); } -deletePtrRecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -193,8 +182,8 @@ deletePtrRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteSRVRecordset.json */ async function deleteSrvRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "SRV"; @@ -209,8 +198,6 @@ async function deleteSrvRecordset() { console.log(result); } -deleteSrvRecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -218,8 +205,8 @@ deleteSrvRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteTXTRecordset.json */ async function deleteTxtRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "TXT"; @@ -234,4 +221,16 @@ async function deleteTxtRecordset() { console.log(result); } -deleteTxtRecordset().catch(console.error); +async function main() { + deleteARecordset(); + deleteAaaaRecordset(); + deleteCaaRecordset(); + deleteCnameRecordset(); + deleteMxRecordset(); + deleteNsRecordset(); + deletePtrRecordset(); + deleteSrvRecordset(); + deleteTxtRecordset(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples-dev/recordSetsGetSample.ts b/sdk/dns/arm-dns/samples-dev/recordSetsGetSample.ts index 6dc689b1631a..35e01c4c5edb 100644 --- a/sdk/dns/arm-dns/samples-dev/recordSetsGetSample.ts +++ b/sdk/dns/arm-dns/samples-dev/recordSetsGetSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Gets a record set. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetARecordset.json */ async function getARecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -34,8 +37,6 @@ async function getARecordset() { console.log(result); } -getARecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -43,8 +44,8 @@ getARecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetAAAARecordset.json */ async function getAaaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "AAAA"; @@ -59,8 +60,6 @@ async function getAaaaRecordset() { console.log(result); } -getAaaaRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -68,8 +67,8 @@ getAaaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetCaaRecordset.json */ async function getCaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "CAA"; @@ -84,8 +83,6 @@ async function getCaaRecordset() { console.log(result); } -getCaaRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -93,8 +90,8 @@ getCaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetCNAMERecordset.json */ async function getCnameRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "CNAME"; @@ -109,8 +106,6 @@ async function getCnameRecordset() { console.log(result); } -getCnameRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -118,8 +113,8 @@ getCnameRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetMXRecordset.json */ async function getMxRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "MX"; @@ -134,8 +129,6 @@ async function getMxRecordset() { console.log(result); } -getMxRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -143,8 +136,8 @@ getMxRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetNSRecordset.json */ async function getNsRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "NS"; @@ -159,8 +152,6 @@ async function getNsRecordset() { console.log(result); } -getNsRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -168,8 +159,8 @@ getNsRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetPTRRecordset.json */ async function getPtrRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "0.0.127.in-addr.arpa"; const relativeRecordSetName = "1"; const recordType = "PTR"; @@ -184,8 +175,6 @@ async function getPtrRecordset() { console.log(result); } -getPtrRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -193,8 +182,8 @@ getPtrRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetSOARecordset.json */ async function getSoaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "@"; const recordType = "SOA"; @@ -209,8 +198,6 @@ async function getSoaRecordset() { console.log(result); } -getSoaRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -218,8 +205,8 @@ getSoaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetSRVRecordset.json */ async function getSrvRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "SRV"; @@ -234,8 +221,6 @@ async function getSrvRecordset() { console.log(result); } -getSrvRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -243,8 +228,8 @@ getSrvRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetTXTRecordset.json */ async function getTxtRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "TXT"; @@ -259,4 +244,17 @@ async function getTxtRecordset() { console.log(result); } -getTxtRecordset().catch(console.error); +async function main() { + getARecordset(); + getAaaaRecordset(); + getCaaRecordset(); + getCnameRecordset(); + getMxRecordset(); + getNsRecordset(); + getPtrRecordset(); + getSoaRecordset(); + getSrvRecordset(); + getTxtRecordset(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples-dev/recordSetsListAllByDnsZoneSample.ts b/sdk/dns/arm-dns/samples-dev/recordSetsListAllByDnsZoneSample.ts index 7e598a43bd6a..2e02059e32aa 100644 --- a/sdk/dns/arm-dns/samples-dev/recordSetsListAllByDnsZoneSample.ts +++ b/sdk/dns/arm-dns/samples-dev/recordSetsListAllByDnsZoneSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Lists all record sets in a DNS zone. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListRecordSetsByZone.json */ async function listRecordsetsByZone() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const credential = new DefaultAzureCredential(); const client = new DnsManagementClient(credential, subscriptionId); @@ -33,4 +36,8 @@ async function listRecordsetsByZone() { console.log(resArray); } -listRecordsetsByZone().catch(console.error); +async function main() { + listRecordsetsByZone(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples-dev/recordSetsListByDnsZoneSample.ts b/sdk/dns/arm-dns/samples-dev/recordSetsListByDnsZoneSample.ts index ecfdc6d50729..bd56cf5db068 100644 --- a/sdk/dns/arm-dns/samples-dev/recordSetsListByDnsZoneSample.ts +++ b/sdk/dns/arm-dns/samples-dev/recordSetsListByDnsZoneSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Lists all record sets in a DNS zone. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListRecordSetsByZone.json */ async function listRecordsetsByZone() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const credential = new DefaultAzureCredential(); const client = new DnsManagementClient(credential, subscriptionId); @@ -33,4 +36,8 @@ async function listRecordsetsByZone() { console.log(resArray); } -listRecordsetsByZone().catch(console.error); +async function main() { + listRecordsetsByZone(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples-dev/recordSetsListByTypeSample.ts b/sdk/dns/arm-dns/samples-dev/recordSetsListByTypeSample.ts index 13bf55297832..5632ff3b61a5 100644 --- a/sdk/dns/arm-dns/samples-dev/recordSetsListByTypeSample.ts +++ b/sdk/dns/arm-dns/samples-dev/recordSetsListByTypeSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListARecordset.json */ async function listARecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "A"; const credential = new DefaultAzureCredential(); @@ -35,8 +38,6 @@ async function listARecordsets() { console.log(resArray); } -listARecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -44,8 +45,8 @@ listARecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListAAAARecordset.json */ async function listAaaaRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "AAAA"; const credential = new DefaultAzureCredential(); @@ -61,8 +62,6 @@ async function listAaaaRecordsets() { console.log(resArray); } -listAaaaRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -70,8 +69,8 @@ listAaaaRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListCaaRecordset.json */ async function listCaaRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "CAA"; const credential = new DefaultAzureCredential(); @@ -87,8 +86,6 @@ async function listCaaRecordsets() { console.log(resArray); } -listCaaRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -96,8 +93,8 @@ listCaaRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListCNAMERecordset.json */ async function listCnameRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "CNAME"; const credential = new DefaultAzureCredential(); @@ -113,8 +110,6 @@ async function listCnameRecordsets() { console.log(resArray); } -listCnameRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -122,8 +117,8 @@ listCnameRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListMXRecordset.json */ async function listMxRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "MX"; const credential = new DefaultAzureCredential(); @@ -139,8 +134,6 @@ async function listMxRecordsets() { console.log(resArray); } -listMxRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -148,8 +141,8 @@ listMxRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListNSRecordset.json */ async function listNsRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "NS"; const credential = new DefaultAzureCredential(); @@ -165,8 +158,6 @@ async function listNsRecordsets() { console.log(resArray); } -listNsRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -174,8 +165,8 @@ listNsRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListPTRRecordset.json */ async function listPtrRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "0.0.127.in-addr.arpa"; const recordType = "PTR"; const credential = new DefaultAzureCredential(); @@ -191,8 +182,6 @@ async function listPtrRecordsets() { console.log(resArray); } -listPtrRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -200,8 +189,8 @@ listPtrRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListSOARecordset.json */ async function listSoaRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "SOA"; const credential = new DefaultAzureCredential(); @@ -217,8 +206,6 @@ async function listSoaRecordsets() { console.log(resArray); } -listSoaRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -226,8 +213,8 @@ listSoaRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListSRVRecordset.json */ async function listSrvRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "SRV"; const credential = new DefaultAzureCredential(); @@ -243,8 +230,6 @@ async function listSrvRecordsets() { console.log(resArray); } -listSrvRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -252,8 +237,8 @@ listSrvRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListTXTRecordset.json */ async function listTxtRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "TXT"; const credential = new DefaultAzureCredential(); @@ -269,4 +254,17 @@ async function listTxtRecordsets() { console.log(resArray); } -listTxtRecordsets().catch(console.error); +async function main() { + listARecordsets(); + listAaaaRecordsets(); + listCaaRecordsets(); + listCnameRecordsets(); + listMxRecordsets(); + listNsRecordsets(); + listPtrRecordsets(); + listSoaRecordsets(); + listSrvRecordsets(); + listTxtRecordsets(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples-dev/recordSetsUpdateSample.ts b/sdk/dns/arm-dns/samples-dev/recordSetsUpdateSample.ts index 08daa3eb25d4..f3c8d9fde0da 100644 --- a/sdk/dns/arm-dns/samples-dev/recordSetsUpdateSample.ts +++ b/sdk/dns/arm-dns/samples-dev/recordSetsUpdateSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { RecordSet, DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Updates a record set within a DNS zone. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchARecordset.json */ async function patchARecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -36,8 +39,6 @@ async function patchARecordset() { console.log(result); } -patchARecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -45,8 +46,8 @@ patchARecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchAAAARecordset.json */ async function patchAaaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "AAAA"; @@ -63,8 +64,6 @@ async function patchAaaaRecordset() { console.log(result); } -patchAaaaRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -72,8 +71,8 @@ patchAaaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchCaaRecordset.json */ async function patchCaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "CAA"; @@ -90,8 +89,6 @@ async function patchCaaRecordset() { console.log(result); } -patchCaaRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -99,8 +96,8 @@ patchCaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchCNAMERecordset.json */ async function patchCnameRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "CNAME"; @@ -117,8 +114,6 @@ async function patchCnameRecordset() { console.log(result); } -patchCnameRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -126,8 +121,8 @@ patchCnameRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchMXRecordset.json */ async function patchMxRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "MX"; @@ -144,8 +139,6 @@ async function patchMxRecordset() { console.log(result); } -patchMxRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -153,8 +146,8 @@ patchMxRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchNSRecordset.json */ async function patchNsRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "NS"; @@ -171,8 +164,6 @@ async function patchNsRecordset() { console.log(result); } -patchNsRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -180,8 +171,8 @@ patchNsRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchPTRRecordset.json */ async function patchPtrRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "0.0.127.in-addr.arpa"; const relativeRecordSetName = "1"; const recordType = "PTR"; @@ -198,8 +189,6 @@ async function patchPtrRecordset() { console.log(result); } -patchPtrRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -207,8 +196,8 @@ patchPtrRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchSOARecordset.json */ async function patchSoaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "@"; const recordType = "SOA"; @@ -225,8 +214,6 @@ async function patchSoaRecordset() { console.log(result); } -patchSoaRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -234,8 +221,8 @@ patchSoaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchSRVRecordset.json */ async function patchSrvRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "SRV"; @@ -252,8 +239,6 @@ async function patchSrvRecordset() { console.log(result); } -patchSrvRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -261,8 +246,8 @@ patchSrvRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchTXTRecordset.json */ async function patchTxtRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "TXT"; @@ -279,4 +264,17 @@ async function patchTxtRecordset() { console.log(result); } -patchTxtRecordset().catch(console.error); +async function main() { + patchARecordset(); + patchAaaaRecordset(); + patchCaaRecordset(); + patchCnameRecordset(); + patchMxRecordset(); + patchNsRecordset(); + patchPtrRecordset(); + patchSoaRecordset(); + patchSrvRecordset(); + patchTxtRecordset(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples-dev/zonesCreateOrUpdateSample.ts b/sdk/dns/arm-dns/samples-dev/zonesCreateOrUpdateSample.ts index 8528dff6389f..13e31970a6e6 100644 --- a/sdk/dns/arm-dns/samples-dev/zonesCreateOrUpdateSample.ts +++ b/sdk/dns/arm-dns/samples-dev/zonesCreateOrUpdateSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { Zone, DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Creates or updates a DNS zone. Does not modify DNS records within the zone. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateZone.json */ async function createZone() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const parameters: Zone = { location: "Global", tags: { key1: "value1" } }; const credential = new DefaultAzureCredential(); @@ -32,4 +35,8 @@ async function createZone() { console.log(result); } -createZone().catch(console.error); +async function main() { + createZone(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples-dev/zonesDeleteSample.ts b/sdk/dns/arm-dns/samples-dev/zonesDeleteSample.ts index b4e525a5dfc0..1a17a8565b4c 100644 --- a/sdk/dns/arm-dns/samples-dev/zonesDeleteSample.ts +++ b/sdk/dns/arm-dns/samples-dev/zonesDeleteSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot be undone. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteZone.json */ async function deleteZone() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const credential = new DefaultAzureCredential(); const client = new DnsManagementClient(credential, subscriptionId); @@ -30,4 +33,8 @@ async function deleteZone() { console.log(result); } -deleteZone().catch(console.error); +async function main() { + deleteZone(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples-dev/zonesGetSample.ts b/sdk/dns/arm-dns/samples-dev/zonesGetSample.ts index 9612b92ecf16..1c7978e4333f 100644 --- a/sdk/dns/arm-dns/samples-dev/zonesGetSample.ts +++ b/sdk/dns/arm-dns/samples-dev/zonesGetSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetZone.json */ async function getZone() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const credential = new DefaultAzureCredential(); const client = new DnsManagementClient(credential, subscriptionId); @@ -27,4 +30,8 @@ async function getZone() { console.log(result); } -getZone().catch(console.error); +async function main() { + getZone(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples-dev/zonesListByResourceGroupSample.ts b/sdk/dns/arm-dns/samples-dev/zonesListByResourceGroupSample.ts index f533a0ad64c9..592df029ebc5 100644 --- a/sdk/dns/arm-dns/samples-dev/zonesListByResourceGroupSample.ts +++ b/sdk/dns/arm-dns/samples-dev/zonesListByResourceGroupSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Lists the DNS zones within a resource group. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListZonesByResourceGroup.json */ async function listZonesByResourceGroup() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const credential = new DefaultAzureCredential(); const client = new DnsManagementClient(credential, subscriptionId); const resArray = new Array(); @@ -29,4 +32,8 @@ async function listZonesByResourceGroup() { console.log(resArray); } -listZonesByResourceGroup().catch(console.error); +async function main() { + listZonesByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples-dev/zonesListSample.ts b/sdk/dns/arm-dns/samples-dev/zonesListSample.ts index fa9cc20c8383..8de5c1203068 100644 --- a/sdk/dns/arm-dns/samples-dev/zonesListSample.ts +++ b/sdk/dns/arm-dns/samples-dev/zonesListSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Lists the DNS zones in all resource groups in a subscription. @@ -18,7 +21,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListZonesBySubscription.json */ async function listZonesBySubscription() { - const subscriptionId = "subid"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; const credential = new DefaultAzureCredential(); const client = new DnsManagementClient(credential, subscriptionId); const resArray = new Array(); @@ -28,4 +31,8 @@ async function listZonesBySubscription() { console.log(resArray); } -listZonesBySubscription().catch(console.error); +async function main() { + listZonesBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples-dev/zonesUpdateSample.ts b/sdk/dns/arm-dns/samples-dev/zonesUpdateSample.ts index eca304e5ece3..5c7121e460c6 100644 --- a/sdk/dns/arm-dns/samples-dev/zonesUpdateSample.ts +++ b/sdk/dns/arm-dns/samples-dev/zonesUpdateSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { ZoneUpdate, DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Updates a DNS zone. Does not modify DNS records within the zone. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchZone.json */ async function patchZone() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const parameters: ZoneUpdate = { tags: { key2: "value2" } }; const credential = new DefaultAzureCredential(); @@ -32,4 +35,8 @@ async function patchZone() { console.log(result); } -patchZone().catch(console.error); +async function main() { + patchZone(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/javascript/README.md b/sdk/dns/arm-dns/samples/v5/javascript/README.md index a0e4246a903c..1d0a2c0dcfdc 100644 --- a/sdk/dns/arm-dns/samples/v5/javascript/README.md +++ b/sdk/dns/arm-dns/samples/v5/javascript/README.md @@ -50,7 +50,7 @@ node dnsResourceReferenceGetByTargetResourcesSample.js Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): ```bash -npx cross-env node dnsResourceReferenceGetByTargetResourcesSample.js +npx cross-env DNS_SUBSCRIPTION_ID="" node dnsResourceReferenceGetByTargetResourcesSample.js ``` ## Next Steps diff --git a/sdk/dns/arm-dns/samples/v5/javascript/dnsResourceReferenceGetByTargetResourcesSample.js b/sdk/dns/arm-dns/samples/v5/javascript/dnsResourceReferenceGetByTargetResourcesSample.js index 6dca26df3c7c..e24f3594b6db 100644 --- a/sdk/dns/arm-dns/samples/v5/javascript/dnsResourceReferenceGetByTargetResourcesSample.js +++ b/sdk/dns/arm-dns/samples/v5/javascript/dnsResourceReferenceGetByTargetResourcesSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { DnsManagementClient } = require("@azure/arm-dns"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * This sample demonstrates how to Returns the DNS records specified by the referencing targetResourceIds. @@ -18,7 +19,7 @@ const { DefaultAzureCredential } = require("@azure/identity"); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetDnsResourceReference.json */ async function listZonesByResourceGroup() { - const subscriptionId = "subid"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; const parameters = { targetResources: [ { @@ -32,4 +33,8 @@ async function listZonesByResourceGroup() { console.log(result); } -listZonesByResourceGroup().catch(console.error); +async function main() { + listZonesByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/javascript/recordSetsCreateOrUpdateSample.js b/sdk/dns/arm-dns/samples/v5/javascript/recordSetsCreateOrUpdateSample.js index 9650fc73748f..361752996265 100644 --- a/sdk/dns/arm-dns/samples/v5/javascript/recordSetsCreateOrUpdateSample.js +++ b/sdk/dns/arm-dns/samples/v5/javascript/recordSetsCreateOrUpdateSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { DnsManagementClient } = require("@azure/arm-dns"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. @@ -18,8 +19,8 @@ const { DefaultAzureCredential } = require("@azure/identity"); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateARecordset.json */ async function createARecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -40,8 +41,6 @@ async function createARecordset() { console.log(result); } -createARecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -49,8 +48,8 @@ createARecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateARecordsetAlias.json */ async function createARecordsetWithAliasTargetResource() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -73,8 +72,6 @@ async function createARecordsetWithAliasTargetResource() { console.log(result); } -createARecordsetWithAliasTargetResource().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -82,8 +79,8 @@ createARecordsetWithAliasTargetResource().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateAAAARecordset.json */ async function createAaaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "AAAA"; @@ -104,8 +101,6 @@ async function createAaaaRecordset() { console.log(result); } -createAaaaRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -113,8 +108,8 @@ createAaaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateCaaRecordset.json */ async function createCaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "CAA"; @@ -135,8 +130,6 @@ async function createCaaRecordset() { console.log(result); } -createCaaRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -144,8 +137,8 @@ createCaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateCNAMERecordset.json */ async function createCnameRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "CNAME"; @@ -166,8 +159,6 @@ async function createCnameRecordset() { console.log(result); } -createCnameRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -175,8 +166,8 @@ createCnameRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateMXRecordset.json */ async function createMxRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "MX"; @@ -197,8 +188,6 @@ async function createMxRecordset() { console.log(result); } -createMxRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -206,8 +195,8 @@ createMxRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateNSRecordset.json */ async function createNsRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "NS"; @@ -228,8 +217,6 @@ async function createNsRecordset() { console.log(result); } -createNsRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -237,8 +224,8 @@ createNsRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdatePTRRecordset.json */ async function createPtrRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "0.0.127.in-addr.arpa"; const relativeRecordSetName = "1"; const recordType = "PTR"; @@ -259,8 +246,6 @@ async function createPtrRecordset() { console.log(result); } -createPtrRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -268,8 +253,8 @@ createPtrRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateSOARecordset.json */ async function createSoaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "@"; const recordType = "SOA"; @@ -298,8 +283,6 @@ async function createSoaRecordset() { console.log(result); } -createSoaRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -307,8 +290,8 @@ createSoaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateSRVRecordset.json */ async function createSrvRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "SRV"; @@ -329,8 +312,6 @@ async function createSrvRecordset() { console.log(result); } -createSrvRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -338,8 +319,8 @@ createSrvRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateTXTRecordset.json */ async function createTxtRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "TXT"; @@ -360,4 +341,18 @@ async function createTxtRecordset() { console.log(result); } -createTxtRecordset().catch(console.error); +async function main() { + createARecordset(); + createARecordsetWithAliasTargetResource(); + createAaaaRecordset(); + createCaaRecordset(); + createCnameRecordset(); + createMxRecordset(); + createNsRecordset(); + createPtrRecordset(); + createSoaRecordset(); + createSrvRecordset(); + createTxtRecordset(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/javascript/recordSetsDeleteSample.js b/sdk/dns/arm-dns/samples/v5/javascript/recordSetsDeleteSample.js index aee7f62ed614..f877a3f0f314 100644 --- a/sdk/dns/arm-dns/samples/v5/javascript/recordSetsDeleteSample.js +++ b/sdk/dns/arm-dns/samples/v5/javascript/recordSetsDeleteSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { DnsManagementClient } = require("@azure/arm-dns"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. @@ -18,8 +19,8 @@ const { DefaultAzureCredential } = require("@azure/identity"); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteARecordset.json */ async function deleteARecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -34,8 +35,6 @@ async function deleteARecordset() { console.log(result); } -deleteARecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -43,8 +42,8 @@ deleteARecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteAAAARecordset.json */ async function deleteAaaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "AAAA"; @@ -59,8 +58,6 @@ async function deleteAaaaRecordset() { console.log(result); } -deleteAaaaRecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -68,8 +65,8 @@ deleteAaaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteCaaRecordset.json */ async function deleteCaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "CAA"; @@ -84,8 +81,6 @@ async function deleteCaaRecordset() { console.log(result); } -deleteCaaRecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -93,8 +88,8 @@ deleteCaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteARecordset.json */ async function deleteCnameRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -109,8 +104,6 @@ async function deleteCnameRecordset() { console.log(result); } -deleteCnameRecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -118,8 +111,8 @@ deleteCnameRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteARecordset.json */ async function deleteMxRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -134,8 +127,6 @@ async function deleteMxRecordset() { console.log(result); } -deleteMxRecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -143,8 +134,8 @@ deleteMxRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteARecordset.json */ async function deleteNsRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -159,8 +150,6 @@ async function deleteNsRecordset() { console.log(result); } -deleteNsRecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -168,8 +157,8 @@ deleteNsRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeletePTRRecordset.json */ async function deletePtrRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "0.0.127.in-addr.arpa"; const relativeRecordSetName = "1"; const recordType = "PTR"; @@ -184,8 +173,6 @@ async function deletePtrRecordset() { console.log(result); } -deletePtrRecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -193,8 +180,8 @@ deletePtrRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteSRVRecordset.json */ async function deleteSrvRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "SRV"; @@ -209,8 +196,6 @@ async function deleteSrvRecordset() { console.log(result); } -deleteSrvRecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -218,8 +203,8 @@ deleteSrvRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteTXTRecordset.json */ async function deleteTxtRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "TXT"; @@ -234,4 +219,16 @@ async function deleteTxtRecordset() { console.log(result); } -deleteTxtRecordset().catch(console.error); +async function main() { + deleteARecordset(); + deleteAaaaRecordset(); + deleteCaaRecordset(); + deleteCnameRecordset(); + deleteMxRecordset(); + deleteNsRecordset(); + deletePtrRecordset(); + deleteSrvRecordset(); + deleteTxtRecordset(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/javascript/recordSetsGetSample.js b/sdk/dns/arm-dns/samples/v5/javascript/recordSetsGetSample.js index b0df8cb09045..449790f20db0 100644 --- a/sdk/dns/arm-dns/samples/v5/javascript/recordSetsGetSample.js +++ b/sdk/dns/arm-dns/samples/v5/javascript/recordSetsGetSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { DnsManagementClient } = require("@azure/arm-dns"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * This sample demonstrates how to Gets a record set. @@ -18,8 +19,8 @@ const { DefaultAzureCredential } = require("@azure/identity"); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetARecordset.json */ async function getARecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -34,8 +35,6 @@ async function getARecordset() { console.log(result); } -getARecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -43,8 +42,8 @@ getARecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetAAAARecordset.json */ async function getAaaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "AAAA"; @@ -59,8 +58,6 @@ async function getAaaaRecordset() { console.log(result); } -getAaaaRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -68,8 +65,8 @@ getAaaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetCaaRecordset.json */ async function getCaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "CAA"; @@ -84,8 +81,6 @@ async function getCaaRecordset() { console.log(result); } -getCaaRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -93,8 +88,8 @@ getCaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetCNAMERecordset.json */ async function getCnameRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "CNAME"; @@ -109,8 +104,6 @@ async function getCnameRecordset() { console.log(result); } -getCnameRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -118,8 +111,8 @@ getCnameRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetMXRecordset.json */ async function getMxRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "MX"; @@ -134,8 +127,6 @@ async function getMxRecordset() { console.log(result); } -getMxRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -143,8 +134,8 @@ getMxRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetNSRecordset.json */ async function getNsRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "NS"; @@ -159,8 +150,6 @@ async function getNsRecordset() { console.log(result); } -getNsRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -168,8 +157,8 @@ getNsRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetPTRRecordset.json */ async function getPtrRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "0.0.127.in-addr.arpa"; const relativeRecordSetName = "1"; const recordType = "PTR"; @@ -184,8 +173,6 @@ async function getPtrRecordset() { console.log(result); } -getPtrRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -193,8 +180,8 @@ getPtrRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetSOARecordset.json */ async function getSoaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "@"; const recordType = "SOA"; @@ -209,8 +196,6 @@ async function getSoaRecordset() { console.log(result); } -getSoaRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -218,8 +203,8 @@ getSoaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetSRVRecordset.json */ async function getSrvRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "SRV"; @@ -234,8 +219,6 @@ async function getSrvRecordset() { console.log(result); } -getSrvRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -243,8 +226,8 @@ getSrvRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetTXTRecordset.json */ async function getTxtRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "TXT"; @@ -259,4 +242,17 @@ async function getTxtRecordset() { console.log(result); } -getTxtRecordset().catch(console.error); +async function main() { + getARecordset(); + getAaaaRecordset(); + getCaaRecordset(); + getCnameRecordset(); + getMxRecordset(); + getNsRecordset(); + getPtrRecordset(); + getSoaRecordset(); + getSrvRecordset(); + getTxtRecordset(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/javascript/recordSetsListAllByDnsZoneSample.js b/sdk/dns/arm-dns/samples/v5/javascript/recordSetsListAllByDnsZoneSample.js index 729a5bc43e7e..350f61e87445 100644 --- a/sdk/dns/arm-dns/samples/v5/javascript/recordSetsListAllByDnsZoneSample.js +++ b/sdk/dns/arm-dns/samples/v5/javascript/recordSetsListAllByDnsZoneSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { DnsManagementClient } = require("@azure/arm-dns"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * This sample demonstrates how to Lists all record sets in a DNS zone. @@ -18,8 +19,8 @@ const { DefaultAzureCredential } = require("@azure/identity"); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListRecordSetsByZone.json */ async function listRecordsetsByZone() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const credential = new DefaultAzureCredential(); const client = new DnsManagementClient(credential, subscriptionId); @@ -30,4 +31,8 @@ async function listRecordsetsByZone() { console.log(resArray); } -listRecordsetsByZone().catch(console.error); +async function main() { + listRecordsetsByZone(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/javascript/recordSetsListByDnsZoneSample.js b/sdk/dns/arm-dns/samples/v5/javascript/recordSetsListByDnsZoneSample.js index 51aba98c902d..fe111b43f705 100644 --- a/sdk/dns/arm-dns/samples/v5/javascript/recordSetsListByDnsZoneSample.js +++ b/sdk/dns/arm-dns/samples/v5/javascript/recordSetsListByDnsZoneSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { DnsManagementClient } = require("@azure/arm-dns"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * This sample demonstrates how to Lists all record sets in a DNS zone. @@ -18,8 +19,8 @@ const { DefaultAzureCredential } = require("@azure/identity"); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListRecordSetsByZone.json */ async function listRecordsetsByZone() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const credential = new DefaultAzureCredential(); const client = new DnsManagementClient(credential, subscriptionId); @@ -30,4 +31,8 @@ async function listRecordsetsByZone() { console.log(resArray); } -listRecordsetsByZone().catch(console.error); +async function main() { + listRecordsetsByZone(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/javascript/recordSetsListByTypeSample.js b/sdk/dns/arm-dns/samples/v5/javascript/recordSetsListByTypeSample.js index 2f8a43a67ef4..d36e443a1807 100644 --- a/sdk/dns/arm-dns/samples/v5/javascript/recordSetsListByTypeSample.js +++ b/sdk/dns/arm-dns/samples/v5/javascript/recordSetsListByTypeSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { DnsManagementClient } = require("@azure/arm-dns"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. @@ -18,8 +19,8 @@ const { DefaultAzureCredential } = require("@azure/identity"); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListARecordset.json */ async function listARecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "A"; const credential = new DefaultAzureCredential(); @@ -31,8 +32,6 @@ async function listARecordsets() { console.log(resArray); } -listARecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -40,8 +39,8 @@ listARecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListAAAARecordset.json */ async function listAaaaRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "AAAA"; const credential = new DefaultAzureCredential(); @@ -53,8 +52,6 @@ async function listAaaaRecordsets() { console.log(resArray); } -listAaaaRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -62,8 +59,8 @@ listAaaaRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListCaaRecordset.json */ async function listCaaRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "CAA"; const credential = new DefaultAzureCredential(); @@ -75,8 +72,6 @@ async function listCaaRecordsets() { console.log(resArray); } -listCaaRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -84,8 +79,8 @@ listCaaRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListCNAMERecordset.json */ async function listCnameRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "CNAME"; const credential = new DefaultAzureCredential(); @@ -97,8 +92,6 @@ async function listCnameRecordsets() { console.log(resArray); } -listCnameRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -106,8 +99,8 @@ listCnameRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListMXRecordset.json */ async function listMxRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "MX"; const credential = new DefaultAzureCredential(); @@ -119,8 +112,6 @@ async function listMxRecordsets() { console.log(resArray); } -listMxRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -128,8 +119,8 @@ listMxRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListNSRecordset.json */ async function listNsRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "NS"; const credential = new DefaultAzureCredential(); @@ -141,8 +132,6 @@ async function listNsRecordsets() { console.log(resArray); } -listNsRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -150,8 +139,8 @@ listNsRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListPTRRecordset.json */ async function listPtrRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "0.0.127.in-addr.arpa"; const recordType = "PTR"; const credential = new DefaultAzureCredential(); @@ -163,8 +152,6 @@ async function listPtrRecordsets() { console.log(resArray); } -listPtrRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -172,8 +159,8 @@ listPtrRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListSOARecordset.json */ async function listSoaRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "SOA"; const credential = new DefaultAzureCredential(); @@ -185,8 +172,6 @@ async function listSoaRecordsets() { console.log(resArray); } -listSoaRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -194,8 +179,8 @@ listSoaRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListSRVRecordset.json */ async function listSrvRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "SRV"; const credential = new DefaultAzureCredential(); @@ -207,8 +192,6 @@ async function listSrvRecordsets() { console.log(resArray); } -listSrvRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -216,8 +199,8 @@ listSrvRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListTXTRecordset.json */ async function listTxtRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "TXT"; const credential = new DefaultAzureCredential(); @@ -229,4 +212,17 @@ async function listTxtRecordsets() { console.log(resArray); } -listTxtRecordsets().catch(console.error); +async function main() { + listARecordsets(); + listAaaaRecordsets(); + listCaaRecordsets(); + listCnameRecordsets(); + listMxRecordsets(); + listNsRecordsets(); + listPtrRecordsets(); + listSoaRecordsets(); + listSrvRecordsets(); + listTxtRecordsets(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/javascript/recordSetsUpdateSample.js b/sdk/dns/arm-dns/samples/v5/javascript/recordSetsUpdateSample.js index ecaf1f4e156c..0af8b952a230 100644 --- a/sdk/dns/arm-dns/samples/v5/javascript/recordSetsUpdateSample.js +++ b/sdk/dns/arm-dns/samples/v5/javascript/recordSetsUpdateSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { DnsManagementClient } = require("@azure/arm-dns"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * This sample demonstrates how to Updates a record set within a DNS zone. @@ -18,8 +19,8 @@ const { DefaultAzureCredential } = require("@azure/identity"); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchARecordset.json */ async function patchARecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -36,8 +37,6 @@ async function patchARecordset() { console.log(result); } -patchARecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -45,8 +44,8 @@ patchARecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchAAAARecordset.json */ async function patchAaaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "AAAA"; @@ -63,8 +62,6 @@ async function patchAaaaRecordset() { console.log(result); } -patchAaaaRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -72,8 +69,8 @@ patchAaaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchCaaRecordset.json */ async function patchCaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "CAA"; @@ -90,8 +87,6 @@ async function patchCaaRecordset() { console.log(result); } -patchCaaRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -99,8 +94,8 @@ patchCaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchCNAMERecordset.json */ async function patchCnameRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "CNAME"; @@ -117,8 +112,6 @@ async function patchCnameRecordset() { console.log(result); } -patchCnameRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -126,8 +119,8 @@ patchCnameRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchMXRecordset.json */ async function patchMxRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "MX"; @@ -144,8 +137,6 @@ async function patchMxRecordset() { console.log(result); } -patchMxRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -153,8 +144,8 @@ patchMxRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchNSRecordset.json */ async function patchNsRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "NS"; @@ -171,8 +162,6 @@ async function patchNsRecordset() { console.log(result); } -patchNsRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -180,8 +169,8 @@ patchNsRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchPTRRecordset.json */ async function patchPtrRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "0.0.127.in-addr.arpa"; const relativeRecordSetName = "1"; const recordType = "PTR"; @@ -198,8 +187,6 @@ async function patchPtrRecordset() { console.log(result); } -patchPtrRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -207,8 +194,8 @@ patchPtrRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchSOARecordset.json */ async function patchSoaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "@"; const recordType = "SOA"; @@ -225,8 +212,6 @@ async function patchSoaRecordset() { console.log(result); } -patchSoaRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -234,8 +219,8 @@ patchSoaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchSRVRecordset.json */ async function patchSrvRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "SRV"; @@ -252,8 +237,6 @@ async function patchSrvRecordset() { console.log(result); } -patchSrvRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -261,8 +244,8 @@ patchSrvRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchTXTRecordset.json */ async function patchTxtRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "TXT"; @@ -279,4 +262,17 @@ async function patchTxtRecordset() { console.log(result); } -patchTxtRecordset().catch(console.error); +async function main() { + patchARecordset(); + patchAaaaRecordset(); + patchCaaRecordset(); + patchCnameRecordset(); + patchMxRecordset(); + patchNsRecordset(); + patchPtrRecordset(); + patchSoaRecordset(); + patchSrvRecordset(); + patchTxtRecordset(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/javascript/zonesCreateOrUpdateSample.js b/sdk/dns/arm-dns/samples/v5/javascript/zonesCreateOrUpdateSample.js index 5d3a13d7bca7..aa53aea965ec 100644 --- a/sdk/dns/arm-dns/samples/v5/javascript/zonesCreateOrUpdateSample.js +++ b/sdk/dns/arm-dns/samples/v5/javascript/zonesCreateOrUpdateSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { DnsManagementClient } = require("@azure/arm-dns"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * This sample demonstrates how to Creates or updates a DNS zone. Does not modify DNS records within the zone. @@ -18,8 +19,8 @@ const { DefaultAzureCredential } = require("@azure/identity"); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateZone.json */ async function createZone() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const parameters = { location: "Global", tags: { key1: "value1" } }; const credential = new DefaultAzureCredential(); @@ -28,4 +29,8 @@ async function createZone() { console.log(result); } -createZone().catch(console.error); +async function main() { + createZone(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/javascript/zonesDeleteSample.js b/sdk/dns/arm-dns/samples/v5/javascript/zonesDeleteSample.js index e5ae5890ad32..7746851b254c 100644 --- a/sdk/dns/arm-dns/samples/v5/javascript/zonesDeleteSample.js +++ b/sdk/dns/arm-dns/samples/v5/javascript/zonesDeleteSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { DnsManagementClient } = require("@azure/arm-dns"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * This sample demonstrates how to Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot be undone. @@ -18,8 +19,8 @@ const { DefaultAzureCredential } = require("@azure/identity"); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteZone.json */ async function deleteZone() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const credential = new DefaultAzureCredential(); const client = new DnsManagementClient(credential, subscriptionId); @@ -27,4 +28,8 @@ async function deleteZone() { console.log(result); } -deleteZone().catch(console.error); +async function main() { + deleteZone(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/javascript/zonesGetSample.js b/sdk/dns/arm-dns/samples/v5/javascript/zonesGetSample.js index 344a093a550a..d89aacfec37a 100644 --- a/sdk/dns/arm-dns/samples/v5/javascript/zonesGetSample.js +++ b/sdk/dns/arm-dns/samples/v5/javascript/zonesGetSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { DnsManagementClient } = require("@azure/arm-dns"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * This sample demonstrates how to Gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. @@ -18,8 +19,8 @@ const { DefaultAzureCredential } = require("@azure/identity"); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetZone.json */ async function getZone() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const credential = new DefaultAzureCredential(); const client = new DnsManagementClient(credential, subscriptionId); @@ -27,4 +28,8 @@ async function getZone() { console.log(result); } -getZone().catch(console.error); +async function main() { + getZone(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/javascript/zonesListByResourceGroupSample.js b/sdk/dns/arm-dns/samples/v5/javascript/zonesListByResourceGroupSample.js index d53403ed6d73..b592ea44f066 100644 --- a/sdk/dns/arm-dns/samples/v5/javascript/zonesListByResourceGroupSample.js +++ b/sdk/dns/arm-dns/samples/v5/javascript/zonesListByResourceGroupSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { DnsManagementClient } = require("@azure/arm-dns"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * This sample demonstrates how to Lists the DNS zones within a resource group. @@ -18,8 +19,8 @@ const { DefaultAzureCredential } = require("@azure/identity"); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListZonesByResourceGroup.json */ async function listZonesByResourceGroup() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const credential = new DefaultAzureCredential(); const client = new DnsManagementClient(credential, subscriptionId); const resArray = new Array(); @@ -29,4 +30,8 @@ async function listZonesByResourceGroup() { console.log(resArray); } -listZonesByResourceGroup().catch(console.error); +async function main() { + listZonesByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/javascript/zonesListSample.js b/sdk/dns/arm-dns/samples/v5/javascript/zonesListSample.js index 67cbb27f8b39..840420347e51 100644 --- a/sdk/dns/arm-dns/samples/v5/javascript/zonesListSample.js +++ b/sdk/dns/arm-dns/samples/v5/javascript/zonesListSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { DnsManagementClient } = require("@azure/arm-dns"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * This sample demonstrates how to Lists the DNS zones in all resource groups in a subscription. @@ -18,7 +19,7 @@ const { DefaultAzureCredential } = require("@azure/identity"); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListZonesBySubscription.json */ async function listZonesBySubscription() { - const subscriptionId = "subid"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; const credential = new DefaultAzureCredential(); const client = new DnsManagementClient(credential, subscriptionId); const resArray = new Array(); @@ -28,4 +29,8 @@ async function listZonesBySubscription() { console.log(resArray); } -listZonesBySubscription().catch(console.error); +async function main() { + listZonesBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/javascript/zonesUpdateSample.js b/sdk/dns/arm-dns/samples/v5/javascript/zonesUpdateSample.js index a11cdc5582e7..75f5fa9cad84 100644 --- a/sdk/dns/arm-dns/samples/v5/javascript/zonesUpdateSample.js +++ b/sdk/dns/arm-dns/samples/v5/javascript/zonesUpdateSample.js @@ -10,6 +10,7 @@ // Licensed under the MIT License. const { DnsManagementClient } = require("@azure/arm-dns"); const { DefaultAzureCredential } = require("@azure/identity"); +require("dotenv").config(); /** * This sample demonstrates how to Updates a DNS zone. Does not modify DNS records within the zone. @@ -18,8 +19,8 @@ const { DefaultAzureCredential } = require("@azure/identity"); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchZone.json */ async function patchZone() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const parameters = { tags: { key2: "value2" } }; const credential = new DefaultAzureCredential(); @@ -28,4 +29,8 @@ async function patchZone() { console.log(result); } -patchZone().catch(console.error); +async function main() { + patchZone(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/typescript/README.md b/sdk/dns/arm-dns/samples/v5/typescript/README.md index e9041138c11b..492373cbd6d5 100644 --- a/sdk/dns/arm-dns/samples/v5/typescript/README.md +++ b/sdk/dns/arm-dns/samples/v5/typescript/README.md @@ -62,7 +62,7 @@ node dist/dnsResourceReferenceGetByTargetResourcesSample.js Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): ```bash -npx cross-env node dist/dnsResourceReferenceGetByTargetResourcesSample.js +npx cross-env DNS_SUBSCRIPTION_ID="" node dist/dnsResourceReferenceGetByTargetResourcesSample.js ``` ## Next Steps diff --git a/sdk/dns/arm-dns/samples/v5/typescript/src/dnsResourceReferenceGetByTargetResourcesSample.ts b/sdk/dns/arm-dns/samples/v5/typescript/src/dnsResourceReferenceGetByTargetResourcesSample.ts index d821484661a3..557e412a2b69 100644 --- a/sdk/dns/arm-dns/samples/v5/typescript/src/dnsResourceReferenceGetByTargetResourcesSample.ts +++ b/sdk/dns/arm-dns/samples/v5/typescript/src/dnsResourceReferenceGetByTargetResourcesSample.ts @@ -13,6 +13,9 @@ import { DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Returns the DNS records specified by the referencing targetResourceIds. @@ -21,7 +24,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetDnsResourceReference.json */ async function listZonesByResourceGroup() { - const subscriptionId = "subid"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; const parameters: DnsResourceReferenceRequest = { targetResources: [ { @@ -38,4 +41,8 @@ async function listZonesByResourceGroup() { console.log(result); } -listZonesByResourceGroup().catch(console.error); +async function main() { + listZonesByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsCreateOrUpdateSample.ts b/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsCreateOrUpdateSample.ts index 503aab50d6f9..63ca1b658910 100644 --- a/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsCreateOrUpdateSample.ts +++ b/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsCreateOrUpdateSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { RecordSet, DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateARecordset.json */ async function createARecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -40,8 +43,6 @@ async function createARecordset() { console.log(result); } -createARecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -49,8 +50,8 @@ createARecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateARecordsetAlias.json */ async function createARecordsetWithAliasTargetResource() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -74,8 +75,6 @@ async function createARecordsetWithAliasTargetResource() { console.log(result); } -createARecordsetWithAliasTargetResource().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -83,8 +82,8 @@ createARecordsetWithAliasTargetResource().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateAAAARecordset.json */ async function createAaaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "AAAA"; @@ -105,8 +104,6 @@ async function createAaaaRecordset() { console.log(result); } -createAaaaRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -114,8 +111,8 @@ createAaaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateCaaRecordset.json */ async function createCaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "CAA"; @@ -136,8 +133,6 @@ async function createCaaRecordset() { console.log(result); } -createCaaRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -145,8 +140,8 @@ createCaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateCNAMERecordset.json */ async function createCnameRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "CNAME"; @@ -167,8 +162,6 @@ async function createCnameRecordset() { console.log(result); } -createCnameRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -176,8 +169,8 @@ createCnameRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateMXRecordset.json */ async function createMxRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "MX"; @@ -198,8 +191,6 @@ async function createMxRecordset() { console.log(result); } -createMxRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -207,8 +198,8 @@ createMxRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateNSRecordset.json */ async function createNsRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "NS"; @@ -229,8 +220,6 @@ async function createNsRecordset() { console.log(result); } -createNsRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -238,8 +227,8 @@ createNsRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdatePTRRecordset.json */ async function createPtrRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "0.0.127.in-addr.arpa"; const relativeRecordSetName = "1"; const recordType = "PTR"; @@ -260,8 +249,6 @@ async function createPtrRecordset() { console.log(result); } -createPtrRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -269,8 +256,8 @@ createPtrRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateSOARecordset.json */ async function createSoaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "@"; const recordType = "SOA"; @@ -299,8 +286,6 @@ async function createSoaRecordset() { console.log(result); } -createSoaRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -308,8 +293,8 @@ createSoaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateSRVRecordset.json */ async function createSrvRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "SRV"; @@ -330,8 +315,6 @@ async function createSrvRecordset() { console.log(result); } -createSrvRecordset().catch(console.error); - /** * This sample demonstrates how to Creates or updates a record set within a DNS zone. * @@ -339,8 +322,8 @@ createSrvRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateTXTRecordset.json */ async function createTxtRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "TXT"; @@ -361,4 +344,18 @@ async function createTxtRecordset() { console.log(result); } -createTxtRecordset().catch(console.error); +async function main() { + createARecordset(); + createARecordsetWithAliasTargetResource(); + createAaaaRecordset(); + createCaaRecordset(); + createCnameRecordset(); + createMxRecordset(); + createNsRecordset(); + createPtrRecordset(); + createSoaRecordset(); + createSrvRecordset(); + createTxtRecordset(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsDeleteSample.ts b/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsDeleteSample.ts index dfd43a5b485e..7ba1f97582d8 100644 --- a/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsDeleteSample.ts +++ b/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsDeleteSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteARecordset.json */ async function deleteARecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -34,8 +37,6 @@ async function deleteARecordset() { console.log(result); } -deleteARecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -43,8 +44,8 @@ deleteARecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteAAAARecordset.json */ async function deleteAaaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "AAAA"; @@ -59,8 +60,6 @@ async function deleteAaaaRecordset() { console.log(result); } -deleteAaaaRecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -68,8 +67,8 @@ deleteAaaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteCaaRecordset.json */ async function deleteCaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "CAA"; @@ -84,8 +83,6 @@ async function deleteCaaRecordset() { console.log(result); } -deleteCaaRecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -93,8 +90,8 @@ deleteCaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteARecordset.json */ async function deleteCnameRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -109,8 +106,6 @@ async function deleteCnameRecordset() { console.log(result); } -deleteCnameRecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -118,8 +113,8 @@ deleteCnameRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteARecordset.json */ async function deleteMxRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -134,8 +129,6 @@ async function deleteMxRecordset() { console.log(result); } -deleteMxRecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -143,8 +136,8 @@ deleteMxRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteARecordset.json */ async function deleteNsRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -159,8 +152,6 @@ async function deleteNsRecordset() { console.log(result); } -deleteNsRecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -168,8 +159,8 @@ deleteNsRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeletePTRRecordset.json */ async function deletePtrRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "0.0.127.in-addr.arpa"; const relativeRecordSetName = "1"; const recordType = "PTR"; @@ -184,8 +175,6 @@ async function deletePtrRecordset() { console.log(result); } -deletePtrRecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -193,8 +182,8 @@ deletePtrRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteSRVRecordset.json */ async function deleteSrvRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "SRV"; @@ -209,8 +198,6 @@ async function deleteSrvRecordset() { console.log(result); } -deleteSrvRecordset().catch(console.error); - /** * This sample demonstrates how to Deletes a record set from a DNS zone. This operation cannot be undone. * @@ -218,8 +205,8 @@ deleteSrvRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteTXTRecordset.json */ async function deleteTxtRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "TXT"; @@ -234,4 +221,16 @@ async function deleteTxtRecordset() { console.log(result); } -deleteTxtRecordset().catch(console.error); +async function main() { + deleteARecordset(); + deleteAaaaRecordset(); + deleteCaaRecordset(); + deleteCnameRecordset(); + deleteMxRecordset(); + deleteNsRecordset(); + deletePtrRecordset(); + deleteSrvRecordset(); + deleteTxtRecordset(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsGetSample.ts b/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsGetSample.ts index 6dc689b1631a..35e01c4c5edb 100644 --- a/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsGetSample.ts +++ b/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsGetSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Gets a record set. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetARecordset.json */ async function getARecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -34,8 +37,6 @@ async function getARecordset() { console.log(result); } -getARecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -43,8 +44,8 @@ getARecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetAAAARecordset.json */ async function getAaaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "AAAA"; @@ -59,8 +60,6 @@ async function getAaaaRecordset() { console.log(result); } -getAaaaRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -68,8 +67,8 @@ getAaaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetCaaRecordset.json */ async function getCaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "CAA"; @@ -84,8 +83,6 @@ async function getCaaRecordset() { console.log(result); } -getCaaRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -93,8 +90,8 @@ getCaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetCNAMERecordset.json */ async function getCnameRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "CNAME"; @@ -109,8 +106,6 @@ async function getCnameRecordset() { console.log(result); } -getCnameRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -118,8 +113,8 @@ getCnameRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetMXRecordset.json */ async function getMxRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "MX"; @@ -134,8 +129,6 @@ async function getMxRecordset() { console.log(result); } -getMxRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -143,8 +136,8 @@ getMxRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetNSRecordset.json */ async function getNsRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "NS"; @@ -159,8 +152,6 @@ async function getNsRecordset() { console.log(result); } -getNsRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -168,8 +159,8 @@ getNsRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetPTRRecordset.json */ async function getPtrRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "0.0.127.in-addr.arpa"; const relativeRecordSetName = "1"; const recordType = "PTR"; @@ -184,8 +175,6 @@ async function getPtrRecordset() { console.log(result); } -getPtrRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -193,8 +182,8 @@ getPtrRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetSOARecordset.json */ async function getSoaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "@"; const recordType = "SOA"; @@ -209,8 +198,6 @@ async function getSoaRecordset() { console.log(result); } -getSoaRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -218,8 +205,8 @@ getSoaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetSRVRecordset.json */ async function getSrvRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "SRV"; @@ -234,8 +221,6 @@ async function getSrvRecordset() { console.log(result); } -getSrvRecordset().catch(console.error); - /** * This sample demonstrates how to Gets a record set. * @@ -243,8 +228,8 @@ getSrvRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetTXTRecordset.json */ async function getTxtRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "TXT"; @@ -259,4 +244,17 @@ async function getTxtRecordset() { console.log(result); } -getTxtRecordset().catch(console.error); +async function main() { + getARecordset(); + getAaaaRecordset(); + getCaaRecordset(); + getCnameRecordset(); + getMxRecordset(); + getNsRecordset(); + getPtrRecordset(); + getSoaRecordset(); + getSrvRecordset(); + getTxtRecordset(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsListAllByDnsZoneSample.ts b/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsListAllByDnsZoneSample.ts index 7e598a43bd6a..2e02059e32aa 100644 --- a/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsListAllByDnsZoneSample.ts +++ b/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsListAllByDnsZoneSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Lists all record sets in a DNS zone. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListRecordSetsByZone.json */ async function listRecordsetsByZone() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const credential = new DefaultAzureCredential(); const client = new DnsManagementClient(credential, subscriptionId); @@ -33,4 +36,8 @@ async function listRecordsetsByZone() { console.log(resArray); } -listRecordsetsByZone().catch(console.error); +async function main() { + listRecordsetsByZone(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsListByDnsZoneSample.ts b/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsListByDnsZoneSample.ts index ecfdc6d50729..bd56cf5db068 100644 --- a/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsListByDnsZoneSample.ts +++ b/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsListByDnsZoneSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Lists all record sets in a DNS zone. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListRecordSetsByZone.json */ async function listRecordsetsByZone() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const credential = new DefaultAzureCredential(); const client = new DnsManagementClient(credential, subscriptionId); @@ -33,4 +36,8 @@ async function listRecordsetsByZone() { console.log(resArray); } -listRecordsetsByZone().catch(console.error); +async function main() { + listRecordsetsByZone(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsListByTypeSample.ts b/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsListByTypeSample.ts index 13bf55297832..5632ff3b61a5 100644 --- a/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsListByTypeSample.ts +++ b/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsListByTypeSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListARecordset.json */ async function listARecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "A"; const credential = new DefaultAzureCredential(); @@ -35,8 +38,6 @@ async function listARecordsets() { console.log(resArray); } -listARecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -44,8 +45,8 @@ listARecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListAAAARecordset.json */ async function listAaaaRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "AAAA"; const credential = new DefaultAzureCredential(); @@ -61,8 +62,6 @@ async function listAaaaRecordsets() { console.log(resArray); } -listAaaaRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -70,8 +69,8 @@ listAaaaRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListCaaRecordset.json */ async function listCaaRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "CAA"; const credential = new DefaultAzureCredential(); @@ -87,8 +86,6 @@ async function listCaaRecordsets() { console.log(resArray); } -listCaaRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -96,8 +93,8 @@ listCaaRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListCNAMERecordset.json */ async function listCnameRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "CNAME"; const credential = new DefaultAzureCredential(); @@ -113,8 +110,6 @@ async function listCnameRecordsets() { console.log(resArray); } -listCnameRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -122,8 +117,8 @@ listCnameRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListMXRecordset.json */ async function listMxRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "MX"; const credential = new DefaultAzureCredential(); @@ -139,8 +134,6 @@ async function listMxRecordsets() { console.log(resArray); } -listMxRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -148,8 +141,8 @@ listMxRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListNSRecordset.json */ async function listNsRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "NS"; const credential = new DefaultAzureCredential(); @@ -165,8 +158,6 @@ async function listNsRecordsets() { console.log(resArray); } -listNsRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -174,8 +165,8 @@ listNsRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListPTRRecordset.json */ async function listPtrRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "0.0.127.in-addr.arpa"; const recordType = "PTR"; const credential = new DefaultAzureCredential(); @@ -191,8 +182,6 @@ async function listPtrRecordsets() { console.log(resArray); } -listPtrRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -200,8 +189,8 @@ listPtrRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListSOARecordset.json */ async function listSoaRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "SOA"; const credential = new DefaultAzureCredential(); @@ -217,8 +206,6 @@ async function listSoaRecordsets() { console.log(resArray); } -listSoaRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -226,8 +213,8 @@ listSoaRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListSRVRecordset.json */ async function listSrvRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "SRV"; const credential = new DefaultAzureCredential(); @@ -243,8 +230,6 @@ async function listSrvRecordsets() { console.log(resArray); } -listSrvRecordsets().catch(console.error); - /** * This sample demonstrates how to Lists the record sets of a specified type in a DNS zone. * @@ -252,8 +237,8 @@ listSrvRecordsets().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListTXTRecordset.json */ async function listTxtRecordsets() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const recordType = "TXT"; const credential = new DefaultAzureCredential(); @@ -269,4 +254,17 @@ async function listTxtRecordsets() { console.log(resArray); } -listTxtRecordsets().catch(console.error); +async function main() { + listARecordsets(); + listAaaaRecordsets(); + listCaaRecordsets(); + listCnameRecordsets(); + listMxRecordsets(); + listNsRecordsets(); + listPtrRecordsets(); + listSoaRecordsets(); + listSrvRecordsets(); + listTxtRecordsets(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsUpdateSample.ts b/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsUpdateSample.ts index 08daa3eb25d4..f3c8d9fde0da 100644 --- a/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsUpdateSample.ts +++ b/sdk/dns/arm-dns/samples/v5/typescript/src/recordSetsUpdateSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { RecordSet, DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Updates a record set within a DNS zone. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchARecordset.json */ async function patchARecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "A"; @@ -36,8 +39,6 @@ async function patchARecordset() { console.log(result); } -patchARecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -45,8 +46,8 @@ patchARecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchAAAARecordset.json */ async function patchAaaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "AAAA"; @@ -63,8 +64,6 @@ async function patchAaaaRecordset() { console.log(result); } -patchAaaaRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -72,8 +71,8 @@ patchAaaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchCaaRecordset.json */ async function patchCaaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "CAA"; @@ -90,8 +89,6 @@ async function patchCaaRecordset() { console.log(result); } -patchCaaRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -99,8 +96,8 @@ patchCaaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchCNAMERecordset.json */ async function patchCnameRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "CNAME"; @@ -117,8 +114,6 @@ async function patchCnameRecordset() { console.log(result); } -patchCnameRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -126,8 +121,8 @@ patchCnameRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchMXRecordset.json */ async function patchMxRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "MX"; @@ -144,8 +139,6 @@ async function patchMxRecordset() { console.log(result); } -patchMxRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -153,8 +146,8 @@ patchMxRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchNSRecordset.json */ async function patchNsRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "NS"; @@ -171,8 +164,6 @@ async function patchNsRecordset() { console.log(result); } -patchNsRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -180,8 +171,8 @@ patchNsRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchPTRRecordset.json */ async function patchPtrRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "0.0.127.in-addr.arpa"; const relativeRecordSetName = "1"; const recordType = "PTR"; @@ -198,8 +189,6 @@ async function patchPtrRecordset() { console.log(result); } -patchPtrRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -207,8 +196,8 @@ patchPtrRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchSOARecordset.json */ async function patchSoaRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "@"; const recordType = "SOA"; @@ -225,8 +214,6 @@ async function patchSoaRecordset() { console.log(result); } -patchSoaRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -234,8 +221,8 @@ patchSoaRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchSRVRecordset.json */ async function patchSrvRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "SRV"; @@ -252,8 +239,6 @@ async function patchSrvRecordset() { console.log(result); } -patchSrvRecordset().catch(console.error); - /** * This sample demonstrates how to Updates a record set within a DNS zone. * @@ -261,8 +246,8 @@ patchSrvRecordset().catch(console.error); * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchTXTRecordset.json */ async function patchTxtRecordset() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const relativeRecordSetName = "record1"; const recordType = "TXT"; @@ -279,4 +264,17 @@ async function patchTxtRecordset() { console.log(result); } -patchTxtRecordset().catch(console.error); +async function main() { + patchARecordset(); + patchAaaaRecordset(); + patchCaaRecordset(); + patchCnameRecordset(); + patchMxRecordset(); + patchNsRecordset(); + patchPtrRecordset(); + patchSoaRecordset(); + patchSrvRecordset(); + patchTxtRecordset(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/typescript/src/zonesCreateOrUpdateSample.ts b/sdk/dns/arm-dns/samples/v5/typescript/src/zonesCreateOrUpdateSample.ts index 8528dff6389f..13e31970a6e6 100644 --- a/sdk/dns/arm-dns/samples/v5/typescript/src/zonesCreateOrUpdateSample.ts +++ b/sdk/dns/arm-dns/samples/v5/typescript/src/zonesCreateOrUpdateSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { Zone, DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Creates or updates a DNS zone. Does not modify DNS records within the zone. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/CreateOrUpdateZone.json */ async function createZone() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const parameters: Zone = { location: "Global", tags: { key1: "value1" } }; const credential = new DefaultAzureCredential(); @@ -32,4 +35,8 @@ async function createZone() { console.log(result); } -createZone().catch(console.error); +async function main() { + createZone(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/typescript/src/zonesDeleteSample.ts b/sdk/dns/arm-dns/samples/v5/typescript/src/zonesDeleteSample.ts index b4e525a5dfc0..1a17a8565b4c 100644 --- a/sdk/dns/arm-dns/samples/v5/typescript/src/zonesDeleteSample.ts +++ b/sdk/dns/arm-dns/samples/v5/typescript/src/zonesDeleteSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot be undone. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/DeleteZone.json */ async function deleteZone() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const credential = new DefaultAzureCredential(); const client = new DnsManagementClient(credential, subscriptionId); @@ -30,4 +33,8 @@ async function deleteZone() { console.log(result); } -deleteZone().catch(console.error); +async function main() { + deleteZone(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/typescript/src/zonesGetSample.ts b/sdk/dns/arm-dns/samples/v5/typescript/src/zonesGetSample.ts index 9612b92ecf16..1c7978e4333f 100644 --- a/sdk/dns/arm-dns/samples/v5/typescript/src/zonesGetSample.ts +++ b/sdk/dns/arm-dns/samples/v5/typescript/src/zonesGetSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Gets a DNS zone. Retrieves the zone properties, but not the record sets within the zone. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/GetZone.json */ async function getZone() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const credential = new DefaultAzureCredential(); const client = new DnsManagementClient(credential, subscriptionId); @@ -27,4 +30,8 @@ async function getZone() { console.log(result); } -getZone().catch(console.error); +async function main() { + getZone(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/typescript/src/zonesListByResourceGroupSample.ts b/sdk/dns/arm-dns/samples/v5/typescript/src/zonesListByResourceGroupSample.ts index f533a0ad64c9..592df029ebc5 100644 --- a/sdk/dns/arm-dns/samples/v5/typescript/src/zonesListByResourceGroupSample.ts +++ b/sdk/dns/arm-dns/samples/v5/typescript/src/zonesListByResourceGroupSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Lists the DNS zones within a resource group. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListZonesByResourceGroup.json */ async function listZonesByResourceGroup() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const credential = new DefaultAzureCredential(); const client = new DnsManagementClient(credential, subscriptionId); const resArray = new Array(); @@ -29,4 +32,8 @@ async function listZonesByResourceGroup() { console.log(resArray); } -listZonesByResourceGroup().catch(console.error); +async function main() { + listZonesByResourceGroup(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/typescript/src/zonesListSample.ts b/sdk/dns/arm-dns/samples/v5/typescript/src/zonesListSample.ts index fa9cc20c8383..8de5c1203068 100644 --- a/sdk/dns/arm-dns/samples/v5/typescript/src/zonesListSample.ts +++ b/sdk/dns/arm-dns/samples/v5/typescript/src/zonesListSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Lists the DNS zones in all resource groups in a subscription. @@ -18,7 +21,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/ListZonesBySubscription.json */ async function listZonesBySubscription() { - const subscriptionId = "subid"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; const credential = new DefaultAzureCredential(); const client = new DnsManagementClient(credential, subscriptionId); const resArray = new Array(); @@ -28,4 +31,8 @@ async function listZonesBySubscription() { console.log(resArray); } -listZonesBySubscription().catch(console.error); +async function main() { + listZonesBySubscription(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/typescript/src/zonesUpdateSample.ts b/sdk/dns/arm-dns/samples/v5/typescript/src/zonesUpdateSample.ts index eca304e5ece3..5c7121e460c6 100644 --- a/sdk/dns/arm-dns/samples/v5/typescript/src/zonesUpdateSample.ts +++ b/sdk/dns/arm-dns/samples/v5/typescript/src/zonesUpdateSample.ts @@ -10,6 +10,9 @@ // Licensed under the MIT License. import { ZoneUpdate, DnsManagementClient } from "@azure/arm-dns"; import { DefaultAzureCredential } from "@azure/identity"; +import * as dotenv from "dotenv"; + +dotenv.config(); /** * This sample demonstrates how to Updates a DNS zone. Does not modify DNS records within the zone. @@ -18,8 +21,8 @@ import { DefaultAzureCredential } from "@azure/identity"; * x-ms-original-file: specification/dns/resource-manager/Microsoft.Network/stable/2018-05-01/examples/PatchZone.json */ async function patchZone() { - const subscriptionId = "subid"; - const resourceGroupName = "rg1"; + const subscriptionId = process.env["DNS_SUBSCRIPTION_ID"] || "subid"; + const resourceGroupName = process.env["DNS_RESOURCE_GROUP"] || "rg1"; const zoneName = "zone1"; const parameters: ZoneUpdate = { tags: { key2: "value2" } }; const credential = new DefaultAzureCredential(); @@ -32,4 +35,8 @@ async function patchZone() { console.log(result); } -patchZone().catch(console.error); +async function main() { + patchZone(); +} + +main().catch(console.error); diff --git a/sdk/dns/arm-dns/samples/v5/typescript/tsconfig.json b/sdk/dns/arm-dns/samples/v5/typescript/tsconfig.json index 416c2dd82e00..e26ce2a6d8f7 100644 --- a/sdk/dns/arm-dns/samples/v5/typescript/tsconfig.json +++ b/sdk/dns/arm-dns/samples/v5/typescript/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "ES2018", + "target": "ES2020", "module": "commonjs", "moduleResolution": "node", "resolveJsonModule": true, diff --git a/sdk/dns/arm-dns/src/dnsManagementClient.ts b/sdk/dns/arm-dns/src/dnsManagementClient.ts index fffaf8fc4abf..0474187d4f9f 100644 --- a/sdk/dns/arm-dns/src/dnsManagementClient.ts +++ b/sdk/dns/arm-dns/src/dnsManagementClient.ts @@ -59,7 +59,7 @@ export class DnsManagementClient extends coreClient.ServiceClient { credential: credentials }; - const packageDetails = `azsdk-js-arm-dns/5.1.1`; + const packageDetails = `azsdk-js-arm-dns/5.2.0`; const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` diff --git a/sdk/dns/arm-dns/src/lroImpl.ts b/sdk/dns/arm-dns/src/lroImpl.ts index 518d5f053b4e..dd803cd5e28c 100644 --- a/sdk/dns/arm-dns/src/lroImpl.ts +++ b/sdk/dns/arm-dns/src/lroImpl.ts @@ -6,29 +6,37 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +import { AbortSignalLike } from "@azure/abort-controller"; 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" - }); - } +export function createLroSpec(inputs: { + sendOperationFn: (args: any, spec: any) => Promise>; + args: Record; + spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record; +}): LongRunningOperation { + const { args, spec, sendOperationFn } = inputs; + return { + requestMethod: spec.httpMethod, + requestPath: spec.path!, + sendInitialRequest: () => sendOperationFn(args, spec), + sendPollRequest: ( + path: string, + options?: { abortSignal?: AbortSignalLike } + ) => { + const { requestBody, ...restSpec } = spec; + return sendOperationFn(args, { + ...restSpec, + httpMethod: "GET", + path, + abortSignal: options?.abortSignal + }); + } + }; } diff --git a/sdk/dns/arm-dns/src/models/index.ts b/sdk/dns/arm-dns/src/models/index.ts index 9ebfbf2d1ae5..48fc9822060c 100644 --- a/sdk/dns/arm-dns/src/models/index.ts +++ b/sdk/dns/arm-dns/src/models/index.ts @@ -371,36 +371,21 @@ export type RecordSetsListAllByDnsZoneResponse = RecordSetListResult; /** Optional parameters. */ export interface RecordSetsListByTypeNextOptionalParams - extends coreClient.OperationOptions { - /** The maximum number of record sets to return. If not specified, returns up to 100 record sets. */ - top?: number; - /** The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return only records that end with . */ - recordsetnamesuffix?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listByTypeNext operation. */ export type RecordSetsListByTypeNextResponse = RecordSetListResult; /** Optional parameters. */ export interface RecordSetsListByDnsZoneNextOptionalParams - extends coreClient.OperationOptions { - /** The maximum number of record sets to return. If not specified, returns up to 100 record sets. */ - top?: number; - /** The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return only records that end with . */ - recordsetnamesuffix?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listByDnsZoneNext operation. */ export type RecordSetsListByDnsZoneNextResponse = RecordSetListResult; /** Optional parameters. */ export interface RecordSetsListAllByDnsZoneNextOptionalParams - extends coreClient.OperationOptions { - /** The maximum number of record sets to return. If not specified, returns up to 100 record sets. */ - top?: number; - /** The suffix label of the record set name that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will return only records that end with . */ - recordSetNameSuffix?: string; -} + extends coreClient.OperationOptions {} /** Contains response data for the listAllByDnsZoneNext operation. */ export type RecordSetsListAllByDnsZoneNextResponse = RecordSetListResult; @@ -463,20 +448,14 @@ export type ZonesListResponse = ZoneListResult; /** Optional parameters. */ export interface ZonesListByResourceGroupNextOptionalParams - extends coreClient.OperationOptions { - /** The maximum number of record sets to return. If not specified, returns up to 100 record sets. */ - top?: number; -} + extends coreClient.OperationOptions {} /** Contains response data for the listByResourceGroupNext operation. */ export type ZonesListByResourceGroupNextResponse = ZoneListResult; /** Optional parameters. */ export interface ZonesListNextOptionalParams - extends coreClient.OperationOptions { - /** The maximum number of DNS zones to return. If not specified, returns up to 100 zones. */ - top?: number; -} + extends coreClient.OperationOptions {} /** Contains response data for the listNext operation. */ export type ZonesListNextResponse = ZoneListResult; diff --git a/sdk/dns/arm-dns/src/operations/recordSets.ts b/sdk/dns/arm-dns/src/operations/recordSets.ts index cd2c8fec50bd..9d1eaf7a7067 100644 --- a/sdk/dns/arm-dns/src/operations/recordSets.ts +++ b/sdk/dns/arm-dns/src/operations/recordSets.ts @@ -739,11 +739,6 @@ const listByTypeNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.top, - Parameters.recordsetnamesuffix - ], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, @@ -766,11 +761,6 @@ const listByDnsZoneNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.top, - Parameters.recordsetnamesuffix - ], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, @@ -792,11 +782,6 @@ const listAllByDnsZoneNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [ - Parameters.apiVersion, - Parameters.top, - Parameters.recordSetNameSuffix - ], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, diff --git a/sdk/dns/arm-dns/src/operations/zones.ts b/sdk/dns/arm-dns/src/operations/zones.ts index b0944aa02ffd..b4cb02543874 100644 --- a/sdk/dns/arm-dns/src/operations/zones.ts +++ b/sdk/dns/arm-dns/src/operations/zones.ts @@ -13,8 +13,12 @@ import * as coreClient from "@azure/core-client"; import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; import { DnsManagementClient } from "../dnsManagementClient"; -import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; -import { LroImpl } from "../lroImpl"; +import { + SimplePollerLike, + OperationState, + createHttpPoller +} from "@azure/core-lro"; +import { createLroSpec } from "../lroImpl"; import { Zone, ZonesListByResourceGroupNextOptionalParams, @@ -201,14 +205,14 @@ export class ZonesImpl implements Zones { resourceGroupName: string, zoneName: string, options?: ZonesDeleteOptionalParams - ): Promise, void>> { + ): Promise, void>> { const directSendOperation = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ): Promise => { return this.client.sendOperationRequest(args, spec); }; - const sendOperation = async ( + const sendOperationFn = async ( args: coreClient.OperationArguments, spec: coreClient.OperationSpec ) => { @@ -241,13 +245,13 @@ export class ZonesImpl implements Zones { }; }; - const lro = new LroImpl( - sendOperation, - { resourceGroupName, zoneName, options }, - deleteOperationSpec - ); - const poller = new LroEngine(lro, { - resumeFrom: options?.resumeFrom, + const lro = createLroSpec({ + sendOperationFn, + args: { resourceGroupName, zoneName, options }, + spec: deleteOperationSpec + }); + const poller = await createHttpPoller>(lro, { + restoreFrom: options?.resumeFrom, intervalInMs: options?.updateIntervalInMs }); await poller.poll(); @@ -517,7 +521,6 @@ const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [Parameters.apiVersion, Parameters.top], urlParameters: [ Parameters.$host, Parameters.resourceGroupName, @@ -538,7 +541,6 @@ const listNextOperationSpec: coreClient.OperationSpec = { bodyMapper: Mappers.CloudError } }, - queryParameters: [Parameters.apiVersion, Parameters.top], urlParameters: [ Parameters.$host, Parameters.subscriptionId, diff --git a/sdk/dns/arm-dns/src/operationsInterfaces/zones.ts b/sdk/dns/arm-dns/src/operationsInterfaces/zones.ts index 2de4bd98877a..8d324494e374 100644 --- a/sdk/dns/arm-dns/src/operationsInterfaces/zones.ts +++ b/sdk/dns/arm-dns/src/operationsInterfaces/zones.ts @@ -7,7 +7,7 @@ */ import { PagedAsyncIterableIterator } from "@azure/core-paging"; -import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { SimplePollerLike, OperationState } from "@azure/core-lro"; import { Zone, ZonesListByResourceGroupOptionalParams, @@ -63,7 +63,7 @@ export interface Zones { resourceGroupName: string, zoneName: string, options?: ZonesDeleteOptionalParams - ): Promise, void>>; + ): Promise, void>>; /** * Deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot * be undone. diff --git a/sdk/dns/arm-dns/src/pagingHelper.ts b/sdk/dns/arm-dns/src/pagingHelper.ts index d85fc13bce1e..269a2b9814b5 100644 --- a/sdk/dns/arm-dns/src/pagingHelper.ts +++ b/sdk/dns/arm-dns/src/pagingHelper.ts @@ -13,11 +13,11 @@ export interface PageInfo { const pageMap = new WeakMap(); /** - * Given a result page from a pageable operation, returns a - * continuation token that can be used to begin paging from + * Given the last `.value` produced by the `byPage` iterator, + * returns a continuation token that can be used to begin paging from * that point later. - * @param page A result object from calling .byPage() on a paged operation. - * @returns The continuation token that can be passed into byPage(). + * @param page An object from accessing `value` on the IteratorResult from a `byPage` iterator. + * @returns The continuation token that can be passed into byPage() during future calls. */ export function getContinuationToken(page: unknown): string | undefined { if (typeof page !== "object" || page === null) {