From 66637bec091d59e2c08aa0dc25089f61df27c3ee Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Thu, 23 Jan 2025 15:39:10 +0800 Subject: [PATCH 1/9] servicenetworking smoke --- .../arm-servicenetworking/LICENSE | 21 + .../arm-servicenetworking/README.md | 106 ++ .../arm-servicenetworking/api-extractor.json | 18 + .../arm-servicenetworking/eslint.config.mjs | 16 + .../arm-servicenetworking/package.json | 69 ++ .../arm-servicenetworking/rollup.config.js | 118 +++ .../arm-servicenetworking/sample.env | 1 + ...sociationsInterfaceCreateOrUpdateSample.ts | 42 + ...erfaceAssociationsInterfaceDeleteSample.ts | 31 + ...InterfaceAssociationsInterfaceGetSample.ts | 32 + ...sInterfaceListByTrafficControllerSample.ts | 35 + ...erfaceAssociationsInterfaceUpdateSample.ts | 41 + ...eFrontendsInterfaceCreateOrUpdateSample.ts | 34 + ...InterfaceFrontendsInterfaceDeleteSample.ts | 31 + ...ndsInterfaceFrontendsInterfaceGetSample.ts | 32 + ...sInterfaceListByTrafficControllerSample.ts | 35 + ...InterfaceFrontendsInterfaceUpdateSample.ts | 33 + .../operationsOperationsListSample.ts | 32 + ...tyPoliciesInterfaceCreateOrUpdateSample.ts | 41 + ...ceSecurityPoliciesInterfaceDeleteSample.ts | 31 + ...rfaceSecurityPoliciesInterfaceGetSample.ts | 33 + ...sInterfaceListByTrafficControllerSample.ts | 35 + ...ceSecurityPoliciesInterfaceUpdateSample.ts | 40 + ...ControllerInterfaceCreateOrUpdateSample.ts | 33 + ...eTrafficControllerInterfaceDeleteSample.ts | 30 + ...faceTrafficControllerInterfaceGetSample.ts | 32 + ...ollerInterfaceListByResourceGroupSample.ts | 34 + ...rollerInterfaceListBySubscriptionSample.ts | 32 + ...eTrafficControllerInterfaceUpdateSample.ts | 33 + .../src/api/associationsInterface/index.ts | 353 +++++++ .../src/api/frontendsInterface/index.ts | 353 +++++++ .../arm-servicenetworking/src/api/index.ts | 62 ++ .../src/api/operations/index.ts | 66 ++ .../arm-servicenetworking/src/api/options.ts | 114 ++ .../api/securityPoliciesInterface/index.ts | 361 +++++++ .../api/serviceNetworkingManagementContext.ts | 70 ++ .../api/trafficControllerInterface/index.ts | 392 +++++++ .../classic/associationsInterface/index.ts | 143 +++ .../src/classic/frontendsInterface/index.ts | 141 +++ .../src/classic/index.ts | 8 + .../src/classic/operations/index.ts | 31 + .../securityPoliciesInterface/index.ts | 143 +++ .../trafficControllerInterface/index.ts | 140 +++ .../arm-servicenetworking/src/index.ts | 88 ++ .../arm-servicenetworking/src/logger.ts | 5 + .../arm-servicenetworking/src/models/index.ts | 47 + .../src/models/models.ts | 987 ++++++++++++++++++ .../src/restorePollerHelpers.ts | 216 ++++ .../src/serviceNetworkingManagementClient.ts | 78 ++ .../src/static-helpers/pagingHelpers.ts | 274 +++++ .../src/static-helpers/pollingHelpers.ts | 137 +++ .../test/public/sampleTest.spec.ts | 21 + .../test/public/utils/recordedClient.ts | 29 + .../arm-servicenetworking/tsconfig.json | 24 + .../vitest.browser.config.ts | 38 + .../arm-servicenetworking/vitest.config.ts | 34 + .../spec/client.tsp | 18 + .../2023-11-01/AssociationDelete.json | 20 + .../examples/2023-11-01/AssociationGet.json | 28 + .../examples/2023-11-01/AssociationPatch.json | 35 + .../examples/2023-11-01/AssociationPut.json | 51 + .../examples/2023-11-01/AssociationsGet.json | 31 + .../examples/2023-11-01/FrontendDelete.json | 20 + .../spec/examples/2023-11-01/FrontendGet.json | 25 + .../examples/2023-11-01/FrontendPatch.json | 26 + .../spec/examples/2023-11-01/FrontendPut.json | 41 + .../examples/2023-11-01/FrontendsGet.json | 28 + .../examples/2023-11-01/OperationsList.json | 26 + .../2023-11-01/TrafficControllerDelete.json | 19 + .../2023-11-01/TrafficControllerGet.json | 39 + .../2023-11-01/TrafficControllerPatch.json | 44 + .../2023-11-01/TrafficControllerPut.json | 72 ++ .../2023-11-01/TrafficControllersGet.json | 42 + .../2023-11-01/TrafficControllersGetList.json | 41 + .../2024-05-01-preview/AssociationDelete.json | 20 + .../2024-05-01-preview/AssociationGet.json | 28 + .../2024-05-01-preview/AssociationPatch.json | 35 + .../2024-05-01-preview/AssociationPut.json | 51 + .../2024-05-01-preview/AssociationsGet.json | 31 + .../2024-05-01-preview/FrontendDelete.json | 20 + .../2024-05-01-preview/FrontendGet.json | 25 + .../2024-05-01-preview/FrontendPatch.json | 26 + .../2024-05-01-preview/FrontendPut.json | 41 + .../2024-05-01-preview/FrontendsGet.json | 28 + .../2024-05-01-preview/OperationsList.json | 26 + .../SecurityPoliciesGetList.json | 31 + .../SecurityPolicyDelete.json | 20 + .../2024-05-01-preview/SecurityPolicyGet.json | 28 + .../SecurityPolicyPatch.json | 35 + .../2024-05-01-preview/SecurityPolicyPut.json | 51 + .../TrafficControllerDelete.json | 19 + .../TrafficControllerGet.json | 39 + .../TrafficControllerPatch.json | 54 + .../TrafficControllerPut.json | 92 ++ .../TrafficControllersGet.json | 52 + .../TrafficControllersGetList.json | 51 + .../2025-01-01/AssociationDelete.json | 20 + .../examples/2025-01-01/AssociationGet.json | 28 + .../examples/2025-01-01/AssociationPatch.json | 35 + .../examples/2025-01-01/AssociationPut.json | 51 + .../examples/2025-01-01/AssociationsGet.json | 31 + .../examples/2025-01-01/FrontendDelete.json | 20 + .../spec/examples/2025-01-01/FrontendGet.json | 25 + .../examples/2025-01-01/FrontendPatch.json | 26 + .../spec/examples/2025-01-01/FrontendPut.json | 41 + .../examples/2025-01-01/FrontendsGet.json | 28 + .../examples/2025-01-01/OperationsList.json | 26 + .../2025-01-01/SecurityPoliciesGetList.json | 31 + .../2025-01-01/SecurityPolicyDelete.json | 20 + .../2025-01-01/SecurityPolicyGet.json | 28 + .../2025-01-01/SecurityPolicyPatch.json | 35 + .../2025-01-01/SecurityPolicyPut.json | 51 + .../2025-01-01/TrafficControllerDelete.json | 19 + .../2025-01-01/TrafficControllerGet.json | 39 + .../2025-01-01/TrafficControllerPatch.json | 54 + .../2025-01-01/TrafficControllerPut.json | 92 ++ .../2025-01-01/TrafficControllersGet.json | 52 + .../2025-01-01/TrafficControllersGetList.json | 51 + .../spec/main.tsp | 328 ++++++ .../spec/sdk-suppressions.yaml | 32 + .../tspconfig.yaml | 13 + 121 files changed, 8041 insertions(+) create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/LICENSE create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/README.md create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/api-extractor.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/eslint.config.mjs create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/package.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/rollup.config.js create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/sample.env create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceCreateOrUpdateSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceDeleteSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceGetSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceListByTrafficControllerSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceUpdateSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceCreateOrUpdateSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceDeleteSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceGetSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceListByTrafficControllerSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceUpdateSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/operationsOperationsListSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceCreateOrUpdateSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceDeleteSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceGetSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceListByTrafficControllerSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceUpdateSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceCreateOrUpdateSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceDeleteSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceGetSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListByResourceGroupSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListBySubscriptionSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceUpdateSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/associationsInterface/index.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/frontendsInterface/index.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/index.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/operations/index.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/options.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/securityPoliciesInterface/index.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/serviceNetworkingManagementContext.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/trafficControllerInterface/index.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/associationsInterface/index.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/frontendsInterface/index.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/index.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/operations/index.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/securityPoliciesInterface/index.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/trafficControllerInterface/index.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/index.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/logger.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/models/index.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/models/models.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/restorePollerHelpers.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/serviceNetworkingManagementClient.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/static-helpers/pagingHelpers.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/static-helpers/pollingHelpers.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/test/public/sampleTest.spec.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/test/public/utils/recordedClient.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/tsconfig.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/vitest.browser.config.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/vitest.config.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/client.tsp create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationDelete.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationGet.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationPatch.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationPut.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationsGet.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendDelete.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendGet.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendPatch.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendPut.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendsGet.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/OperationsList.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerDelete.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerGet.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerPatch.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerPut.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllersGet.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllersGetList.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationDelete.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationGet.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationPatch.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationPut.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationsGet.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendDelete.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendGet.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendPatch.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendPut.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendsGet.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/OperationsList.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPoliciesGetList.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyDelete.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyGet.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyPatch.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyPut.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerDelete.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerGet.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerPatch.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerPut.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllersGet.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllersGetList.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationDelete.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationGet.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationPatch.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationPut.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationsGet.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendDelete.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendGet.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendPatch.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendPut.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendsGet.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/OperationsList.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPoliciesGetList.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyDelete.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyGet.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyPatch.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyPut.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerDelete.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerGet.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerPatch.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerPut.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllersGet.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllersGetList.json create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/main.tsp create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/sdk-suppressions.yaml create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/tspconfig.yaml diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/LICENSE b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/LICENSE new file mode 100644 index 0000000000..2ad4de7b17 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2025 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/README.md b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/README.md new file mode 100644 index 0000000000..b794a4e301 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/README.md @@ -0,0 +1,106 @@ +# Azure ServiceNetworking client library for JavaScript + +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure ServiceNetworking client. + +Traffic Controller Provider management API. + +Key links: + +- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/servicenetworking/arm-servicenetworking) +- [Package (NPM)](https://www.npmjs.com/package/@azure/arm-servicenetworking) +- [API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-servicenetworking?view=azure-node-preview) +- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/servicenetworking/arm-servicenetworking/samples) + +## Getting started + +### Currently supported environments + +- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) +- Latest versions of Safari, Chrome, Edge and Firefox. + +See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. + +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-servicenetworking` package + +Install the Azure ServiceNetworking client library for JavaScript with `npm`: + +```bash +npm install @azure/arm-servicenetworking +``` + +### Create and authenticate a `ServiceNetworkingClient` + +To create a client object to access the Azure ServiceNetworking API, you will need the `endpoint` of your Azure ServiceNetworking resource and a `credential`. The Azure ServiceNetworking client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure ServiceNetworking resource in the [Azure Portal][azure_portal]. + +You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). + +To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: + +```bash +npm install @azure/identity +``` + +You will also need to **register a new AAD application and grant access to Azure ServiceNetworking** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). + +For more information about how to create an Azure AD Application check out [this guide](https://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). + +```javascript +const { ServiceNetworkingClient } = require("@azure/arm-servicenetworking"); +const { DefaultAzureCredential } = require("@azure/identity"); +// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details. + +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new ServiceNetworkingClient(new DefaultAzureCredential(), subscriptionId); + +// For client-side applications running in the browser, use this code instead: +// const credential = new InteractiveBrowserCredential({ +// tenantId: "", +// clientId: "" +// }); +// const client = new ServiceNetworkingClient(credential, subscriptionId); +``` + + +### JavaScript Bundle +To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). + +## Key concepts + +### ServiceNetworkingClient + +`ServiceNetworkingClient` is the primary interface for developers using the Azure ServiceNetworking client library. Explore the methods on this client object to understand the different features of the Azure ServiceNetworking service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); +``` + +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/servicenetworking/arm-servicenetworking/samples) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + +## Related projects + +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) + +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/api-extractor.json b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/api-extractor.json new file mode 100644 index 0000000000..ae4c926254 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist/esm/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-servicenetworking.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/eslint.config.mjs b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/eslint.config.mjs new file mode 100644 index 0000000000..ac1c3c967e --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/eslint.config.mjs @@ -0,0 +1,16 @@ +import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; + +export default azsdkEslint.config([ + { + rules: { + "@azure/azure-sdk/ts-modules-only-named": "warn", + "@azure/azure-sdk/ts-apiextractor-json-types": "warn", + "@azure/azure-sdk/ts-package-json-types": "warn", + "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", + "@azure/azure-sdk/ts-package-json-module": "off", + "@azure/azure-sdk/ts-package-json-files-required": "off", + "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", + "tsdoc/syntax": "warn" + } + } +]); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/package.json b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/package.json new file mode 100644 index 0000000000..ea6cf25a15 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/package.json @@ -0,0 +1,69 @@ +{ + "name": "@azure/arm-servicenetworking", + "version": "1.0.0-beta.1", + "description": "A generated SDK for ServiceNetworkingClient.", + "engines": { + "node": ">=18.0.0" + }, + "sideEffects": false, + "autoPublish": false, + "tshy": { + "exports": { + "./package.json": "./package.json", + ".": "./src/index.ts", + "./models": "./src/models/index.ts" + }, + "dialects": ["esm", "commonjs"], + "esmDialects": ["browser", "react-native"], + "selfLink": false + }, + "type": "module", + "keywords": ["node", "azure", "cloud", "typescript", "browser", "isomorphic"], + "author": "Microsoft Corporation", + "license": "MIT", + "files": ["dist", "README.md", "LICENSE", "review/*", "CHANGELOG.md"], + "dependencies": { + "@azure/core-util": "^1.9.2", + "@azure-rest/core-client": "^2.3.1", + "@azure/core-auth": "^1.6.0", + "@azure/core-rest-pipeline": "^1.5.0", + "@azure/logger": "^1.0.0", + "tslib": "^2.6.2", + "@azure/core-lro": "^3.1.0", + "@azure/abort-controller": "^2.1.2" + }, + "devDependencies": { + "dotenv": "^16.0.0", + "@microsoft/api-extractor": "^7.40.3", + "@types/node": "^18.0.0", + "eslint": "^9.9.0", + "typescript": "~5.6.2", + "tshy": "^2.0.0", + "@azure/identity": "^4.2.1", + "@vitest/browser": "^2.0.5", + "@vitest/coverage-istanbul": "^2.0.5", + "playwright": "^1.41.2", + "vitest": "^2.0.5", + "@azure-tools/test-credential": "^2.0.0", + "@azure-tools/test-recorder": "^4.0.0", + "rimraf": "^5.0.5", + "mkdirp": "^3.0.1" + }, + "scripts": { + "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "extract-api": "rimraf review && mkdirp ./review && api-extractor run --local", + "pack": "npm pack 2>&1", + "lint": "eslint package.json api-extractor.json src", + "lint:fix": "eslint package.json api-extractor.json src --fix --fix-type [problem,suggestion]", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:browser": "vitest -c vitest.browser.config.ts", + "unit-test:node": "vitest -c vitest.config.ts", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:browser": "echo skipped", + "integration-test:node": "echo skipped", + "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", + "test:node": "npm run clean && tshy && npm run unit-test:node && npm run integration-test:node", + "test": "npm run clean && tshy && npm run unit-test:node && npm run unit-test:browser && npm run integration-test", + "build": "npm run clean && tshy && npm run extract-api" + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/rollup.config.js b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/rollup.config.js new file mode 100644 index 0000000000..843de501bf --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/rollup.config.js @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import nodeResolve from "@rollup/plugin-node-resolve"; +import cjs from "@rollup/plugin-commonjs"; +import sourcemaps from "rollup-plugin-sourcemaps"; +import multiEntry from "@rollup/plugin-multi-entry"; +import json from "@rollup/plugin-json"; + +import nodeBuiltins from "builtin-modules"; + +// #region Warning Handler + +/** + * A function that can determine whether a rollup warning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEval(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependency(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && + warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; + +/** + * Construct a warning handler for the shared rollup configuration + * that ignores certain warnings that are not relevant to testing. + */ +function makeOnWarnForTesting() { + return (warning, warn) => { + // If every inhibitor returns false (i.e. no inhibitors), then show the warning + if (warningInhibitors.every((inhib) => !inhib(warning))) { + warn(warning); + } + }; +} + +// #endregion + +function makeBrowserTestConfig() { + const config = { + input: { + include: ["dist-esm/test/**/*.spec.js"], + exclude: ["dist-esm/test/**/node/**"], + }, + output: { + file: `dist-test/index.browser.js`, + format: "umd", + sourcemap: true, + }, + preserveSymlinks: false, + plugins: [ + multiEntry({ exports: false }), + nodeResolve({ + mainFields: ["module", "browser"], + }), + cjs(), + json(), + sourcemaps(), + //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) + ], + onwarn: makeOnWarnForTesting(), + // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, + // rollup started respecting the "sideEffects" field in package.json. Since + // our package.json sets "sideEffects=false", this also applies to test + // code, which causes all tests to be removed by tree-shaking. + treeshake: false, + }; + + return config; +} + +const defaultConfigurationOptions = { + disableBrowserBundle: false, +}; + +export function makeConfig(pkg, options) { + options = { + ...defaultConfigurationOptions, + ...(options || {}), + }; + + const baseConfig = { + // Use the package's module field if it has one + input: pkg["module"] || "dist-esm/src/index.js", + external: [ + ...nodeBuiltins, + ...Object.keys(pkg.dependencies), + ...Object.keys(pkg.devDependencies), + ], + output: { file: "dist/index.js", format: "cjs", sourcemap: true }, + preserveSymlinks: false, + plugins: [sourcemaps(), nodeResolve()], + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/sample.env b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/sample.env new file mode 100644 index 0000000000..508439fc7d --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/sample.env @@ -0,0 +1 @@ +# Feel free to add your own environment variables. \ No newline at end of file diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceCreateOrUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceCreateOrUpdateSample.ts new file mode 100644 index 0000000000..3ec054708e --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceCreateOrUpdateSample.ts @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a Association + * + * @summary create a Association + * x-ms-original-file: 2025-01-01/AssociationPut.json + */ +async function putAssociation() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = + await client.associationsInterface.AssociationsInterface_createOrUpdate( + "rg1", + "tc1", + "as1", + { + location: "NorthCentralUS", + properties: { + associationType: "subnets", + subnet: { + id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet", + }, + }, + }, + ); + console.log(result); +} + +async function main() { + await putAssociation(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceDeleteSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceDeleteSample.ts new file mode 100644 index 0000000000..d815267fe2 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceDeleteSample.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a Association + * + * @summary delete a Association + * x-ms-original-file: 2025-01-01/AssociationDelete.json + */ +async function deleteAssociation() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + await client.associationsInterface.AssociationsInterface_delete( + "rg1", + "tc1", + "as1", + ); +} + +async function main() { + await deleteAssociation(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceGetSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceGetSample.ts new file mode 100644 index 0000000000..78e680181d --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceGetSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a Association + * + * @summary get a Association + * x-ms-original-file: 2025-01-01/AssociationGet.json + */ +async function getAssociation() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = await client.associationsInterface.AssociationsInterface_get( + "rg1", + "tc1", + "as1", + ); + console.log(result); +} + +async function main() { + await getAssociation(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceListByTrafficControllerSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceListByTrafficControllerSample.ts new file mode 100644 index 0000000000..75360debff --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceListByTrafficControllerSample.ts @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list Association resources by TrafficController + * + * @summary list Association resources by TrafficController + * x-ms-original-file: 2025-01-01/AssociationsGet.json + */ +async function getAssociations() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const resArray = new Array(); + for await (let item of client.associationsInterface.AssociationsInterface_listByTrafficController( + "rg1", + "tc1", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await getAssociations(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceUpdateSample.ts new file mode 100644 index 0000000000..dc5df3da22 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceUpdateSample.ts @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to update a Association + * + * @summary update a Association + * x-ms-original-file: 2025-01-01/AssociationPatch.json + */ +async function updateAssociation() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = + await client.associationsInterface.AssociationsInterface_update( + "rg1", + "tc1", + "as1", + { + properties: { + associationType: "subnets", + subnet: { + id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet", + }, + }, + }, + ); + console.log(result); +} + +async function main() { + await updateAssociation(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceCreateOrUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceCreateOrUpdateSample.ts new file mode 100644 index 0000000000..a80bffc40c --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceCreateOrUpdateSample.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a Frontend + * + * @summary create a Frontend + * x-ms-original-file: 2025-01-01/FrontendPut.json + */ +async function putFrontend() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = + await client.frontendsInterface.FrontendsInterface_createOrUpdate( + "rg1", + "tc1", + "fe1", + { location: "NorthCentralUS", properties: {} }, + ); + console.log(result); +} + +async function main() { + await putFrontend(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceDeleteSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceDeleteSample.ts new file mode 100644 index 0000000000..049b636410 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceDeleteSample.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a Frontend + * + * @summary delete a Frontend + * x-ms-original-file: 2025-01-01/FrontendDelete.json + */ +async function deleteFrontend() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + await client.frontendsInterface.FrontendsInterface_delete( + "rg1", + "tc1", + "fe1", + ); +} + +async function main() { + await deleteFrontend(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceGetSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceGetSample.ts new file mode 100644 index 0000000000..9d292969a5 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceGetSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a Frontend + * + * @summary get a Frontend + * x-ms-original-file: 2025-01-01/FrontendGet.json + */ +async function getFrontend() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = await client.frontendsInterface.FrontendsInterface_get( + "rg1", + "tc1", + "fe1", + ); + console.log(result); +} + +async function main() { + await getFrontend(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceListByTrafficControllerSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceListByTrafficControllerSample.ts new file mode 100644 index 0000000000..12c35e344b --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceListByTrafficControllerSample.ts @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list Frontend resources by TrafficController + * + * @summary list Frontend resources by TrafficController + * x-ms-original-file: 2025-01-01/FrontendsGet.json + */ +async function getFrontends() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const resArray = new Array(); + for await (let item of client.frontendsInterface.FrontendsInterface_listByTrafficController( + "rg1", + "tc1", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await getFrontends(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceUpdateSample.ts new file mode 100644 index 0000000000..da6eff8685 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceUpdateSample.ts @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to update a Frontend + * + * @summary update a Frontend + * x-ms-original-file: 2025-01-01/FrontendPatch.json + */ +async function updateFrontend() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = await client.frontendsInterface.FrontendsInterface_update( + "rg1", + "tc1", + "fe1", + {}, + ); + console.log(result); +} + +async function main() { + await updateFrontend(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/operationsOperationsListSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/operationsOperationsListSample.ts new file mode 100644 index 0000000000..84a68a6a27 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/operationsOperationsListSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list the operations for the provider + * + * @summary list the operations for the provider + * x-ms-original-file: 2025-01-01/OperationsList.json + */ +async function getOperationsList() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-00000000000"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const resArray = new Array(); + for await (let item of client.operations.Operations_list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await getOperationsList(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceCreateOrUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceCreateOrUpdateSample.ts new file mode 100644 index 0000000000..b330bae64e --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceCreateOrUpdateSample.ts @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a SecurityPolicy + * + * @summary create a SecurityPolicy + * x-ms-original-file: 2025-01-01/SecurityPolicyPut.json + */ +async function putSecurityPolicy() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = + await client.securityPoliciesInterface.SecurityPoliciesInterface_createOrUpdate( + "rg1", + "tc1", + "sp1", + { + location: "NorthCentralUS", + properties: { + wafPolicy: { + id: "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0", + }, + }, + }, + ); + console.log(result); +} + +async function main() { + await putSecurityPolicy(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceDeleteSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceDeleteSample.ts new file mode 100644 index 0000000000..cd75193b2a --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceDeleteSample.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a SecurityPolicy + * + * @summary delete a SecurityPolicy + * x-ms-original-file: 2025-01-01/SecurityPolicyDelete.json + */ +async function deleteSecurityPolicy() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + await client.securityPoliciesInterface.SecurityPoliciesInterface_delete( + "rg1", + "tc1", + "sp1", + ); +} + +async function main() { + await deleteSecurityPolicy(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceGetSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceGetSample.ts new file mode 100644 index 0000000000..da00dde36e --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceGetSample.ts @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a SecurityPolicy + * + * @summary get a SecurityPolicy + * x-ms-original-file: 2025-01-01/SecurityPolicyGet.json + */ +async function getSecurityPolicy() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = + await client.securityPoliciesInterface.SecurityPoliciesInterface_get( + "rg1", + "tc1", + "sp1", + ); + console.log(result); +} + +async function main() { + await getSecurityPolicy(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceListByTrafficControllerSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceListByTrafficControllerSample.ts new file mode 100644 index 0000000000..2222499db5 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceListByTrafficControllerSample.ts @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list SecurityPolicy resources by TrafficController + * + * @summary list SecurityPolicy resources by TrafficController + * x-ms-original-file: 2025-01-01/SecurityPoliciesGetList.json + */ +async function getSecurityPolicies() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const resArray = new Array(); + for await (let item of client.securityPoliciesInterface.SecurityPoliciesInterface_listByTrafficController( + "rg1", + "tc1", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await getSecurityPolicies(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceUpdateSample.ts new file mode 100644 index 0000000000..2b3b78e2ad --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceUpdateSample.ts @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to update a SecurityPolicy + * + * @summary update a SecurityPolicy + * x-ms-original-file: 2025-01-01/SecurityPolicyPatch.json + */ +async function updateSecurityPolicy() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = + await client.securityPoliciesInterface.SecurityPoliciesInterface_update( + "rg1", + "tc1", + "sp1", + { + properties: { + wafPolicy: { + id: "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0", + }, + }, + }, + ); + console.log(result); +} + +async function main() { + await updateSecurityPolicy(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceCreateOrUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceCreateOrUpdateSample.ts new file mode 100644 index 0000000000..7c6ee77254 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceCreateOrUpdateSample.ts @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a TrafficController + * + * @summary create a TrafficController + * x-ms-original-file: 2025-01-01/TrafficControllerPut.json + */ +async function putTrafficController() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = + await client.trafficControllerInterface.TrafficControllerInterface_createOrUpdate( + "rg1", + "tc1", + { location: "NorthCentralUS", tags: { key1: "value1" } }, + ); + console.log(result); +} + +async function main() { + await putTrafficController(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceDeleteSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceDeleteSample.ts new file mode 100644 index 0000000000..19d652e325 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceDeleteSample.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a TrafficController + * + * @summary delete a TrafficController + * x-ms-original-file: 2025-01-01/TrafficControllerDelete.json + */ +async function deleteTrafficController() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + await client.trafficControllerInterface.TrafficControllerInterface_delete( + "rg1", + "tc1", + ); +} + +async function main() { + await deleteTrafficController(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceGetSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceGetSample.ts new file mode 100644 index 0000000000..d8f0101697 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceGetSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a TrafficController + * + * @summary get a TrafficController + * x-ms-original-file: 2025-01-01/TrafficControllerGet.json + */ +async function getTrafficController() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = + await client.trafficControllerInterface.TrafficControllerInterface_get( + "rg1", + "tc1", + ); + console.log(result); +} + +async function main() { + await getTrafficController(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListByResourceGroupSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListByResourceGroupSample.ts new file mode 100644 index 0000000000..e8c0a270f7 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListByResourceGroupSample.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list TrafficController resources by resource group + * + * @summary list TrafficController resources by resource group + * x-ms-original-file: 2025-01-01/TrafficControllersGet.json + */ +async function getTrafficControllers() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const resArray = new Array(); + for await (let item of client.trafficControllerInterface.TrafficControllerInterface_listByResourceGroup( + "rg1", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await getTrafficControllers(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListBySubscriptionSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListBySubscriptionSample.ts new file mode 100644 index 0000000000..7fe574e327 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListBySubscriptionSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list TrafficController resources by subscription ID + * + * @summary list TrafficController resources by subscription ID + * x-ms-original-file: 2025-01-01/TrafficControllersGetList.json + */ +async function getTrafficControllersList() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const resArray = new Array(); + for await (let item of client.trafficControllerInterface.TrafficControllerInterface_listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main() { + await getTrafficControllersList(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceUpdateSample.ts new file mode 100644 index 0000000000..4cb1602a3b --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceUpdateSample.ts @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to update a TrafficController + * + * @summary update a TrafficController + * x-ms-original-file: 2025-01-01/TrafficControllerPatch.json + */ +async function patchTrafficController() { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = + await client.trafficControllerInterface.TrafficControllerInterface_update( + "rg1", + "tc1", + { tags: { key1: "value1" } }, + ); + console.log(result); +} + +async function main() { + await patchTrafficController(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/associationsInterface/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/associationsInterface/index.ts new file mode 100644 index 0000000000..3c253729a9 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/associationsInterface/index.ts @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + AssociationsInterfaceCreateOrUpdateOptionalParams, + AssociationsInterfaceDeleteOptionalParams, + AssociationsInterfaceGetOptionalParams, + AssociationsInterfaceListByTrafficControllerOptionalParams, + AssociationsInterfaceUpdateOptionalParams, + ServiceNetworkingManagementContext as Client, +} from "../index.js"; +import { + errorResponseDeserializer, + Association, + associationSerializer, + associationDeserializer, + AssociationUpdate, + associationUpdateSerializer, + _AssociationListResult, + _associationListResultDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _associationsInterfaceListByTrafficControllerSend( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + options: AssociationsInterfaceListByTrafficControllerOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/associations", + context.subscriptionId, + resourceGroupName, + trafficControllerName, + ) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); +} + +export async function _associationsInterfaceListByTrafficControllerDeserialize( + result: PathUncheckedResponse, +): Promise<_AssociationListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _associationListResultDeserializer(result.body); +} + +/** List Association resources by TrafficController */ +export function associationsInterfaceListByTrafficController( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + options: AssociationsInterfaceListByTrafficControllerOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _associationsInterfaceListByTrafficControllerSend( + context, + resourceGroupName, + trafficControllerName, + options, + ), + _associationsInterfaceListByTrafficControllerDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _associationsInterfaceDeleteSend( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + associationName: string, + options: AssociationsInterfaceDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/associations/{associationName}", + context.subscriptionId, + resourceGroupName, + trafficControllerName, + associationName, + ) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); +} + +export async function _associationsInterfaceDeleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a Association */ +export function associationsInterfaceDelete( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + associationName: string, + options: AssociationsInterfaceDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _associationsInterfaceDeleteDeserialize, + ["202", "204", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _associationsInterfaceDeleteSend( + context, + resourceGroupName, + trafficControllerName, + associationName, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; +} + +export function _associationsInterfaceUpdateSend( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + associationName: string, + properties: AssociationUpdate, + options: AssociationsInterfaceUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/associations/{associationName}", + context.subscriptionId, + resourceGroupName, + trafficControllerName, + associationName, + ) + .patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: associationUpdateSerializer(properties), + }); +} + +export async function _associationsInterfaceUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return associationDeserializer(result.body); +} + +/** Update a Association */ +export async function associationsInterfaceUpdate( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + associationName: string, + properties: AssociationUpdate, + options: AssociationsInterfaceUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _associationsInterfaceUpdateSend( + context, + resourceGroupName, + trafficControllerName, + associationName, + properties, + options, + ); + return _associationsInterfaceUpdateDeserialize(result); +} + +export function _associationsInterfaceCreateOrUpdateSend( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + associationName: string, + resource: Association, + options: AssociationsInterfaceCreateOrUpdateOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/associations/{associationName}", + context.subscriptionId, + resourceGroupName, + trafficControllerName, + associationName, + ) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: associationSerializer(resource), + }); +} + +export async function _associationsInterfaceCreateOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return associationDeserializer(result.body); +} + +/** Create a Association */ +export function associationsInterfaceCreateOrUpdate( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + associationName: string, + resource: Association, + options: AssociationsInterfaceCreateOrUpdateOptionalParams = { + requestOptions: {}, + }, +): PollerLike, Association> { + return getLongRunningPoller( + context, + _associationsInterfaceCreateOrUpdateDeserialize, + ["200", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _associationsInterfaceCreateOrUpdateSend( + context, + resourceGroupName, + trafficControllerName, + associationName, + resource, + options, + ), + resourceLocationConfig: "azure-async-operation", + }, + ) as PollerLike, Association>; +} + +export function _associationsInterfaceGetSend( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + associationName: string, + options: AssociationsInterfaceGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/associations/{associationName}", + context.subscriptionId, + resourceGroupName, + trafficControllerName, + associationName, + ) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); +} + +export async function _associationsInterfaceGetDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return associationDeserializer(result.body); +} + +/** Get a Association */ +export async function associationsInterfaceGet( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + associationName: string, + options: AssociationsInterfaceGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _associationsInterfaceGetSend( + context, + resourceGroupName, + trafficControllerName, + associationName, + options, + ); + return _associationsInterfaceGetDeserialize(result); +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/frontendsInterface/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/frontendsInterface/index.ts new file mode 100644 index 0000000000..196bd0f011 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/frontendsInterface/index.ts @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + ServiceNetworkingManagementContext as Client, + FrontendsInterfaceCreateOrUpdateOptionalParams, + FrontendsInterfaceDeleteOptionalParams, + FrontendsInterfaceGetOptionalParams, + FrontendsInterfaceListByTrafficControllerOptionalParams, + FrontendsInterfaceUpdateOptionalParams, +} from "../index.js"; +import { + errorResponseDeserializer, + Frontend, + frontendSerializer, + frontendDeserializer, + FrontendUpdate, + frontendUpdateSerializer, + _FrontendListResult, + _frontendListResultDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _frontendsInterfaceListByTrafficControllerSend( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + options: FrontendsInterfaceListByTrafficControllerOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/frontends", + context.subscriptionId, + resourceGroupName, + trafficControllerName, + ) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); +} + +export async function _frontendsInterfaceListByTrafficControllerDeserialize( + result: PathUncheckedResponse, +): Promise<_FrontendListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _frontendListResultDeserializer(result.body); +} + +/** List Frontend resources by TrafficController */ +export function frontendsInterfaceListByTrafficController( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + options: FrontendsInterfaceListByTrafficControllerOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _frontendsInterfaceListByTrafficControllerSend( + context, + resourceGroupName, + trafficControllerName, + options, + ), + _frontendsInterfaceListByTrafficControllerDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _frontendsInterfaceDeleteSend( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + frontendName: string, + options: FrontendsInterfaceDeleteOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/frontends/{frontendName}", + context.subscriptionId, + resourceGroupName, + trafficControllerName, + frontendName, + ) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); +} + +export async function _frontendsInterfaceDeleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a Frontend */ +export function frontendsInterfaceDelete( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + frontendName: string, + options: FrontendsInterfaceDeleteOptionalParams = { requestOptions: {} }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _frontendsInterfaceDeleteDeserialize, + ["202", "204", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _frontendsInterfaceDeleteSend( + context, + resourceGroupName, + trafficControllerName, + frontendName, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; +} + +export function _frontendsInterfaceUpdateSend( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + frontendName: string, + properties: FrontendUpdate, + options: FrontendsInterfaceUpdateOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/frontends/{frontendName}", + context.subscriptionId, + resourceGroupName, + trafficControllerName, + frontendName, + ) + .patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: frontendUpdateSerializer(properties), + }); +} + +export async function _frontendsInterfaceUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return frontendDeserializer(result.body); +} + +/** Update a Frontend */ +export async function frontendsInterfaceUpdate( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + frontendName: string, + properties: FrontendUpdate, + options: FrontendsInterfaceUpdateOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _frontendsInterfaceUpdateSend( + context, + resourceGroupName, + trafficControllerName, + frontendName, + properties, + options, + ); + return _frontendsInterfaceUpdateDeserialize(result); +} + +export function _frontendsInterfaceCreateOrUpdateSend( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + frontendName: string, + resource: Frontend, + options: FrontendsInterfaceCreateOrUpdateOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/frontends/{frontendName}", + context.subscriptionId, + resourceGroupName, + trafficControllerName, + frontendName, + ) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: frontendSerializer(resource), + }); +} + +export async function _frontendsInterfaceCreateOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return frontendDeserializer(result.body); +} + +/** Create a Frontend */ +export function frontendsInterfaceCreateOrUpdate( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + frontendName: string, + resource: Frontend, + options: FrontendsInterfaceCreateOrUpdateOptionalParams = { + requestOptions: {}, + }, +): PollerLike, Frontend> { + return getLongRunningPoller( + context, + _frontendsInterfaceCreateOrUpdateDeserialize, + ["200", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _frontendsInterfaceCreateOrUpdateSend( + context, + resourceGroupName, + trafficControllerName, + frontendName, + resource, + options, + ), + resourceLocationConfig: "azure-async-operation", + }, + ) as PollerLike, Frontend>; +} + +export function _frontendsInterfaceGetSend( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + frontendName: string, + options: FrontendsInterfaceGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/frontends/{frontendName}", + context.subscriptionId, + resourceGroupName, + trafficControllerName, + frontendName, + ) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); +} + +export async function _frontendsInterfaceGetDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return frontendDeserializer(result.body); +} + +/** Get a Frontend */ +export async function frontendsInterfaceGet( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + frontendName: string, + options: FrontendsInterfaceGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _frontendsInterfaceGetSend( + context, + resourceGroupName, + trafficControllerName, + frontendName, + options, + ); + return _frontendsInterfaceGetDeserialize(result); +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/index.ts new file mode 100644 index 0000000000..cb398cec90 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/index.ts @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + OperationsListOptionalParams, + TrafficControllerInterfaceListBySubscriptionOptionalParams, + TrafficControllerInterfaceListByResourceGroupOptionalParams, + TrafficControllerInterfaceDeleteOptionalParams, + TrafficControllerInterfaceUpdateOptionalParams, + TrafficControllerInterfaceCreateOrUpdateOptionalParams, + TrafficControllerInterfaceGetOptionalParams, + SecurityPoliciesInterfaceListByTrafficControllerOptionalParams, + SecurityPoliciesInterfaceDeleteOptionalParams, + SecurityPoliciesInterfaceUpdateOptionalParams, + SecurityPoliciesInterfaceCreateOrUpdateOptionalParams, + SecurityPoliciesInterfaceGetOptionalParams, + FrontendsInterfaceListByTrafficControllerOptionalParams, + FrontendsInterfaceDeleteOptionalParams, + FrontendsInterfaceUpdateOptionalParams, + FrontendsInterfaceCreateOrUpdateOptionalParams, + FrontendsInterfaceGetOptionalParams, + AssociationsInterfaceListByTrafficControllerOptionalParams, + AssociationsInterfaceDeleteOptionalParams, + AssociationsInterfaceUpdateOptionalParams, + AssociationsInterfaceCreateOrUpdateOptionalParams, + AssociationsInterfaceGetOptionalParams, +} from "./options.js"; +export { + createServiceNetworkingManagement, + ServiceNetworkingManagementContext, + ServiceNetworkingManagementClientOptionalParams, +} from "./serviceNetworkingManagementContext.js"; +export { + associationsInterfaceListByTrafficController, + associationsInterfaceDelete, + associationsInterfaceUpdate, + associationsInterfaceCreateOrUpdate, + associationsInterfaceGet, +} from "./associationsInterface/index.js"; +export { + frontendsInterfaceListByTrafficController, + frontendsInterfaceDelete, + frontendsInterfaceUpdate, + frontendsInterfaceCreateOrUpdate, + frontendsInterfaceGet, +} from "./frontendsInterface/index.js"; +export { operationsList } from "./operations/index.js"; +export { + securityPoliciesInterfaceListByTrafficController, + securityPoliciesInterfaceDelete, + securityPoliciesInterfaceUpdate, + securityPoliciesInterfaceCreateOrUpdate, + securityPoliciesInterfaceGet, +} from "./securityPoliciesInterface/index.js"; +export { + trafficControllerInterfaceListBySubscription, + trafficControllerInterfaceListByResourceGroup, + trafficControllerInterfaceDelete, + trafficControllerInterfaceUpdate, + trafficControllerInterfaceCreateOrUpdate, + trafficControllerInterfaceGet, +} from "./trafficControllerInterface/index.js"; diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/operations/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/operations/index.ts new file mode 100644 index 0000000000..6551cc738e --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/operations/index.ts @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + ServiceNetworkingManagementContext as Client, + OperationsListOptionalParams, +} from "../index.js"; +import { + _OperationListResult, + _operationListResultDeserializer, + Operation, + errorResponseDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; + +export function _operationsListSend( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path("/providers/Microsoft.ServiceNetworking/operations") + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); +} + +export async function _operationsListDeserialize( + result: PathUncheckedResponse, +): Promise<_OperationListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _operationListResultDeserializer(result.body); +} + +/** List the operations for the provider */ +export function operationsList( + context: Client, + options: OperationsListOptionalParams = { requestOptions: {} }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _operationsListSend(context, options), + _operationsListDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/options.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/options.ts new file mode 100644 index 0000000000..2c833d1c75 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/options.ts @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { OperationOptions } from "@azure-rest/core-client"; + +/** Optional parameters. */ +export interface OperationsListOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface TrafficControllerInterfaceListBySubscriptionOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TrafficControllerInterfaceListByResourceGroupOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TrafficControllerInterfaceDeleteOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface TrafficControllerInterfaceUpdateOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface TrafficControllerInterfaceCreateOrUpdateOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface TrafficControllerInterfaceGetOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface SecurityPoliciesInterfaceListByTrafficControllerOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface SecurityPoliciesInterfaceDeleteOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface SecurityPoliciesInterfaceUpdateOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface SecurityPoliciesInterfaceCreateOrUpdateOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface SecurityPoliciesInterfaceGetOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface FrontendsInterfaceListByTrafficControllerOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface FrontendsInterfaceDeleteOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface FrontendsInterfaceUpdateOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface FrontendsInterfaceCreateOrUpdateOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface FrontendsInterfaceGetOptionalParams extends OperationOptions {} + +/** Optional parameters. */ +export interface AssociationsInterfaceListByTrafficControllerOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface AssociationsInterfaceDeleteOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface AssociationsInterfaceUpdateOptionalParams + extends OperationOptions {} + +/** Optional parameters. */ +export interface AssociationsInterfaceCreateOrUpdateOptionalParams + extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; +} + +/** Optional parameters. */ +export interface AssociationsInterfaceGetOptionalParams + extends OperationOptions {} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/securityPoliciesInterface/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/securityPoliciesInterface/index.ts new file mode 100644 index 0000000000..7b8bfda253 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/securityPoliciesInterface/index.ts @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + ServiceNetworkingManagementContext as Client, + SecurityPoliciesInterfaceCreateOrUpdateOptionalParams, + SecurityPoliciesInterfaceDeleteOptionalParams, + SecurityPoliciesInterfaceGetOptionalParams, + SecurityPoliciesInterfaceListByTrafficControllerOptionalParams, + SecurityPoliciesInterfaceUpdateOptionalParams, +} from "../index.js"; +import { + errorResponseDeserializer, + SecurityPolicy, + securityPolicySerializer, + securityPolicyDeserializer, + SecurityPolicyUpdate, + securityPolicyUpdateSerializer, + _SecurityPolicyListResult, + _securityPolicyListResultDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _securityPoliciesInterfaceListByTrafficControllerSend( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + options: SecurityPoliciesInterfaceListByTrafficControllerOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/securityPolicies", + context.subscriptionId, + resourceGroupName, + trafficControllerName, + ) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); +} + +export async function _securityPoliciesInterfaceListByTrafficControllerDeserialize( + result: PathUncheckedResponse, +): Promise<_SecurityPolicyListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _securityPolicyListResultDeserializer(result.body); +} + +/** List SecurityPolicy resources by TrafficController */ +export function securityPoliciesInterfaceListByTrafficController( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + options: SecurityPoliciesInterfaceListByTrafficControllerOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _securityPoliciesInterfaceListByTrafficControllerSend( + context, + resourceGroupName, + trafficControllerName, + options, + ), + _securityPoliciesInterfaceListByTrafficControllerDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _securityPoliciesInterfaceDeleteSend( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + securityPolicyName: string, + options: SecurityPoliciesInterfaceDeleteOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/securityPolicies/{securityPolicyName}", + context.subscriptionId, + resourceGroupName, + trafficControllerName, + securityPolicyName, + ) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); +} + +export async function _securityPoliciesInterfaceDeleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a SecurityPolicy */ +export function securityPoliciesInterfaceDelete( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + securityPolicyName: string, + options: SecurityPoliciesInterfaceDeleteOptionalParams = { + requestOptions: {}, + }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _securityPoliciesInterfaceDeleteDeserialize, + ["202", "204", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _securityPoliciesInterfaceDeleteSend( + context, + resourceGroupName, + trafficControllerName, + securityPolicyName, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; +} + +export function _securityPoliciesInterfaceUpdateSend( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + securityPolicyName: string, + properties: SecurityPolicyUpdate, + options: SecurityPoliciesInterfaceUpdateOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/securityPolicies/{securityPolicyName}", + context.subscriptionId, + resourceGroupName, + trafficControllerName, + securityPolicyName, + ) + .patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: securityPolicyUpdateSerializer(properties), + }); +} + +export async function _securityPoliciesInterfaceUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return securityPolicyDeserializer(result.body); +} + +/** Update a SecurityPolicy */ +export async function securityPoliciesInterfaceUpdate( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + securityPolicyName: string, + properties: SecurityPolicyUpdate, + options: SecurityPoliciesInterfaceUpdateOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _securityPoliciesInterfaceUpdateSend( + context, + resourceGroupName, + trafficControllerName, + securityPolicyName, + properties, + options, + ); + return _securityPoliciesInterfaceUpdateDeserialize(result); +} + +export function _securityPoliciesInterfaceCreateOrUpdateSend( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + securityPolicyName: string, + resource: SecurityPolicy, + options: SecurityPoliciesInterfaceCreateOrUpdateOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/securityPolicies/{securityPolicyName}", + context.subscriptionId, + resourceGroupName, + trafficControllerName, + securityPolicyName, + ) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: securityPolicySerializer(resource), + }); +} + +export async function _securityPoliciesInterfaceCreateOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return securityPolicyDeserializer(result.body); +} + +/** Create a SecurityPolicy */ +export function securityPoliciesInterfaceCreateOrUpdate( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + securityPolicyName: string, + resource: SecurityPolicy, + options: SecurityPoliciesInterfaceCreateOrUpdateOptionalParams = { + requestOptions: {}, + }, +): PollerLike, SecurityPolicy> { + return getLongRunningPoller( + context, + _securityPoliciesInterfaceCreateOrUpdateDeserialize, + ["200", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _securityPoliciesInterfaceCreateOrUpdateSend( + context, + resourceGroupName, + trafficControllerName, + securityPolicyName, + resource, + options, + ), + resourceLocationConfig: "azure-async-operation", + }, + ) as PollerLike, SecurityPolicy>; +} + +export function _securityPoliciesInterfaceGetSend( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + securityPolicyName: string, + options: SecurityPoliciesInterfaceGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/securityPolicies/{securityPolicyName}", + context.subscriptionId, + resourceGroupName, + trafficControllerName, + securityPolicyName, + ) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); +} + +export async function _securityPoliciesInterfaceGetDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return securityPolicyDeserializer(result.body); +} + +/** Get a SecurityPolicy */ +export async function securityPoliciesInterfaceGet( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + securityPolicyName: string, + options: SecurityPoliciesInterfaceGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _securityPoliciesInterfaceGetSend( + context, + resourceGroupName, + trafficControllerName, + securityPolicyName, + options, + ); + return _securityPoliciesInterfaceGetDeserialize(result); +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/serviceNetworkingManagementContext.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/serviceNetworkingManagementContext.ts new file mode 100644 index 0000000000..1a2b20a383 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/serviceNetworkingManagementContext.ts @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { logger } from "../logger.js"; +import { KnownVersions } from "../models/models.js"; +import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; +import { TokenCredential } from "@azure/core-auth"; + +/** Traffic Controller Provider management API. */ +export interface ServiceNetworkingManagementContext extends Client { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion: string; + /** The ID of the target subscription. The value must be an UUID. */ + subscriptionId: string; +} + +/** Optional parameters for the client. */ +export interface ServiceNetworkingManagementClientOptionalParams + extends ClientOptions { + /** The API version to use for this operation. */ + /** Known values of {@link KnownVersions} that the service accepts. */ + apiVersion?: string; +} + +/** Traffic Controller Provider management API. */ +export function createServiceNetworkingManagement( + credential: TokenCredential, + subscriptionId: string, + options: ServiceNetworkingManagementClientOptionalParams = {}, +): ServiceNetworkingManagementContext { + const endpointUrl = + options.endpoint ?? options.baseUrl ?? "https://management.azure.com"; + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentInfo = `azsdk-js-arm-servicenetworking/1.0.0-beta.1`; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}` + : `azsdk-js-api ${userAgentInfo}`; + const { apiVersion: _, ...updatedOptions } = { + ...options, + userAgentOptions: { userAgentPrefix }, + loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, + credentials: { + scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`], + }, + }; + const clientContext = getClient(endpointUrl, credential, updatedOptions); + clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); + const apiVersion = options.apiVersion ?? "2025-01-01"; + clientContext.pipeline.addPolicy({ + name: "ClientApiVersionPolicy", + sendRequest: (req, next) => { + // Use the apiVersion defined in request url directly + // Append one if there is no apiVersion and we have one at client options + const url = new URL(req.url); + if (!url.searchParams.get("api-version")) { + req.url = `${req.url}${ + Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" + }api-version=${apiVersion}`; + } + + return next(req); + }, + }); + return { + ...clientContext, + apiVersion, + subscriptionId, + } as ServiceNetworkingManagementContext; +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/trafficControllerInterface/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/trafficControllerInterface/index.ts new file mode 100644 index 0000000000..4997f96651 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/trafficControllerInterface/index.ts @@ -0,0 +1,392 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + ServiceNetworkingManagementContext as Client, + TrafficControllerInterfaceCreateOrUpdateOptionalParams, + TrafficControllerInterfaceDeleteOptionalParams, + TrafficControllerInterfaceGetOptionalParams, + TrafficControllerInterfaceListByResourceGroupOptionalParams, + TrafficControllerInterfaceListBySubscriptionOptionalParams, + TrafficControllerInterfaceUpdateOptionalParams, +} from "../index.js"; +import { + errorResponseDeserializer, + TrafficController, + trafficControllerSerializer, + trafficControllerDeserializer, + TrafficControllerUpdate, + trafficControllerUpdateSerializer, + _TrafficControllerListResult, + _trafficControllerListResultDeserializer, +} from "../../models/models.js"; +import { + PagedAsyncIterableIterator, + buildPagedAsyncIterator, +} from "../../static-helpers/pagingHelpers.js"; +import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; +import { + StreamableMethod, + PathUncheckedResponse, + createRestError, + operationOptionsToRequestParameters, +} from "@azure-rest/core-client"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +export function _trafficControllerInterfaceListBySubscriptionSend( + context: Client, + options: TrafficControllerInterfaceListBySubscriptionOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceNetworking/trafficControllers", + context.subscriptionId, + ) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); +} + +export async function _trafficControllerInterfaceListBySubscriptionDeserialize( + result: PathUncheckedResponse, +): Promise<_TrafficControllerListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _trafficControllerListResultDeserializer(result.body); +} + +/** List TrafficController resources by subscription ID */ +export function trafficControllerInterfaceListBySubscription( + context: Client, + options: TrafficControllerInterfaceListBySubscriptionOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => _trafficControllerInterfaceListBySubscriptionSend(context, options), + _trafficControllerInterfaceListBySubscriptionDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _trafficControllerInterfaceListByResourceGroupSend( + context: Client, + resourceGroupName: string, + options: TrafficControllerInterfaceListByResourceGroupOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers", + context.subscriptionId, + resourceGroupName, + ) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); +} + +export async function _trafficControllerInterfaceListByResourceGroupDeserialize( + result: PathUncheckedResponse, +): Promise<_TrafficControllerListResult> { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return _trafficControllerListResultDeserializer(result.body); +} + +/** List TrafficController resources by resource group */ +export function trafficControllerInterfaceListByResourceGroup( + context: Client, + resourceGroupName: string, + options: TrafficControllerInterfaceListByResourceGroupOptionalParams = { + requestOptions: {}, + }, +): PagedAsyncIterableIterator { + return buildPagedAsyncIterator( + context, + () => + _trafficControllerInterfaceListByResourceGroupSend( + context, + resourceGroupName, + options, + ), + _trafficControllerInterfaceListByResourceGroupDeserialize, + ["200"], + { itemName: "value", nextLinkName: "nextLink" }, + ); +} + +export function _trafficControllerInterfaceDeleteSend( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + options: TrafficControllerInterfaceDeleteOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}", + context.subscriptionId, + resourceGroupName, + trafficControllerName, + ) + .delete({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); +} + +export async function _trafficControllerInterfaceDeleteDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["202", "204", "200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return; +} + +/** Delete a TrafficController */ +export function trafficControllerInterfaceDelete( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + options: TrafficControllerInterfaceDeleteOptionalParams = { + requestOptions: {}, + }, +): PollerLike, void> { + return getLongRunningPoller( + context, + _trafficControllerInterfaceDeleteDeserialize, + ["202", "204", "200"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _trafficControllerInterfaceDeleteSend( + context, + resourceGroupName, + trafficControllerName, + options, + ), + resourceLocationConfig: "location", + }, + ) as PollerLike, void>; +} + +export function _trafficControllerInterfaceUpdateSend( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + properties: TrafficControllerUpdate, + options: TrafficControllerInterfaceUpdateOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}", + context.subscriptionId, + resourceGroupName, + trafficControllerName, + ) + .patch({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: trafficControllerUpdateSerializer(properties), + }); +} + +export async function _trafficControllerInterfaceUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return trafficControllerDeserializer(result.body); +} + +/** Update a TrafficController */ +export async function trafficControllerInterfaceUpdate( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + properties: TrafficControllerUpdate, + options: TrafficControllerInterfaceUpdateOptionalParams = { + requestOptions: {}, + }, +): Promise { + const result = await _trafficControllerInterfaceUpdateSend( + context, + resourceGroupName, + trafficControllerName, + properties, + options, + ); + return _trafficControllerInterfaceUpdateDeserialize(result); +} + +export function _trafficControllerInterfaceCreateOrUpdateSend( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + resource: TrafficController, + options: TrafficControllerInterfaceCreateOrUpdateOptionalParams = { + requestOptions: {}, + }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}", + context.subscriptionId, + resourceGroupName, + trafficControllerName, + ) + .put({ + ...operationOptionsToRequestParameters(options), + contentType: "application/json", + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + body: trafficControllerSerializer(resource), + }); +} + +export async function _trafficControllerInterfaceCreateOrUpdateDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200", "201"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return trafficControllerDeserializer(result.body); +} + +/** Create a TrafficController */ +export function trafficControllerInterfaceCreateOrUpdate( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + resource: TrafficController, + options: TrafficControllerInterfaceCreateOrUpdateOptionalParams = { + requestOptions: {}, + }, +): PollerLike, TrafficController> { + return getLongRunningPoller( + context, + _trafficControllerInterfaceCreateOrUpdateDeserialize, + ["200", "201"], + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + getInitialResponse: () => + _trafficControllerInterfaceCreateOrUpdateSend( + context, + resourceGroupName, + trafficControllerName, + resource, + options, + ), + resourceLocationConfig: "azure-async-operation", + }, + ) as PollerLike, TrafficController>; +} + +export function _trafficControllerInterfaceGetSend( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + options: TrafficControllerInterfaceGetOptionalParams = { requestOptions: {} }, +): StreamableMethod { + return context + .path( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}", + context.subscriptionId, + resourceGroupName, + trafficControllerName, + ) + .get({ + ...operationOptionsToRequestParameters(options), + headers: { + accept: "application/json", + ...options.requestOptions?.headers, + }, + queryParameters: { "api-version": context.apiVersion }, + }); +} + +export async function _trafficControllerInterfaceGetDeserialize( + result: PathUncheckedResponse, +): Promise { + const expectedStatuses = ["200"]; + if (!expectedStatuses.includes(result.status)) { + const error = createRestError(result); + error.details = errorResponseDeserializer(result.body); + throw error; + } + + return trafficControllerDeserializer(result.body); +} + +/** Get a TrafficController */ +export async function trafficControllerInterfaceGet( + context: Client, + resourceGroupName: string, + trafficControllerName: string, + options: TrafficControllerInterfaceGetOptionalParams = { requestOptions: {} }, +): Promise { + const result = await _trafficControllerInterfaceGetSend( + context, + resourceGroupName, + trafficControllerName, + options, + ); + return _trafficControllerInterfaceGetDeserialize(result); +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/associationsInterface/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/associationsInterface/index.ts new file mode 100644 index 0000000000..982cdab4d1 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/associationsInterface/index.ts @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementContext } from "../../api/serviceNetworkingManagementContext.js"; +import { + associationsInterfaceListByTrafficController, + associationsInterfaceDelete, + associationsInterfaceUpdate, + associationsInterfaceCreateOrUpdate, + associationsInterfaceGet, +} from "../../api/associationsInterface/index.js"; +import { Association, AssociationUpdate } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; +import { + AssociationsInterfaceListByTrafficControllerOptionalParams, + AssociationsInterfaceDeleteOptionalParams, + AssociationsInterfaceUpdateOptionalParams, + AssociationsInterfaceCreateOrUpdateOptionalParams, + AssociationsInterfaceGetOptionalParams, +} from "../../api/options.js"; + +/** Interface representing a AssociationsInterface operations. */ +export interface AssociationsInterfaceOperations { + /** List Association resources by TrafficController */ + listByTrafficController: ( + resourceGroupName: string, + trafficControllerName: string, + options?: AssociationsInterfaceListByTrafficControllerOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a Association */ + delete: ( + resourceGroupName: string, + trafficControllerName: string, + associationName: string, + options?: AssociationsInterfaceDeleteOptionalParams, + ) => PollerLike, void>; + /** Update a Association */ + update: ( + resourceGroupName: string, + trafficControllerName: string, + associationName: string, + properties: AssociationUpdate, + options?: AssociationsInterfaceUpdateOptionalParams, + ) => Promise; + /** Create a Association */ + createOrUpdate: ( + resourceGroupName: string, + trafficControllerName: string, + associationName: string, + resource: Association, + options?: AssociationsInterfaceCreateOrUpdateOptionalParams, + ) => PollerLike, Association>; + /** Get a Association */ + get: ( + resourceGroupName: string, + trafficControllerName: string, + associationName: string, + options?: AssociationsInterfaceGetOptionalParams, + ) => Promise; +} + +function _getAssociationsInterface( + context: ServiceNetworkingManagementContext, +) { + return { + listByTrafficController: ( + resourceGroupName: string, + trafficControllerName: string, + options?: AssociationsInterfaceListByTrafficControllerOptionalParams, + ) => + associationsInterfaceListByTrafficController( + context, + resourceGroupName, + trafficControllerName, + options, + ), + delete: ( + resourceGroupName: string, + trafficControllerName: string, + associationName: string, + options?: AssociationsInterfaceDeleteOptionalParams, + ) => + associationsInterfaceDelete( + context, + resourceGroupName, + trafficControllerName, + associationName, + options, + ), + update: ( + resourceGroupName: string, + trafficControllerName: string, + associationName: string, + properties: AssociationUpdate, + options?: AssociationsInterfaceUpdateOptionalParams, + ) => + associationsInterfaceUpdate( + context, + resourceGroupName, + trafficControllerName, + associationName, + properties, + options, + ), + createOrUpdate: ( + resourceGroupName: string, + trafficControllerName: string, + associationName: string, + resource: Association, + options?: AssociationsInterfaceCreateOrUpdateOptionalParams, + ) => + associationsInterfaceCreateOrUpdate( + context, + resourceGroupName, + trafficControllerName, + associationName, + resource, + options, + ), + get: ( + resourceGroupName: string, + trafficControllerName: string, + associationName: string, + options?: AssociationsInterfaceGetOptionalParams, + ) => + associationsInterfaceGet( + context, + resourceGroupName, + trafficControllerName, + associationName, + options, + ), + }; +} + +export function _getAssociationsInterfaceOperations( + context: ServiceNetworkingManagementContext, +): AssociationsInterfaceOperations { + return { + ..._getAssociationsInterface(context), + }; +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/frontendsInterface/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/frontendsInterface/index.ts new file mode 100644 index 0000000000..8c0fb6bf28 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/frontendsInterface/index.ts @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementContext } from "../../api/serviceNetworkingManagementContext.js"; +import { + frontendsInterfaceListByTrafficController, + frontendsInterfaceDelete, + frontendsInterfaceUpdate, + frontendsInterfaceCreateOrUpdate, + frontendsInterfaceGet, +} from "../../api/frontendsInterface/index.js"; +import { Frontend, FrontendUpdate } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; +import { + FrontendsInterfaceListByTrafficControllerOptionalParams, + FrontendsInterfaceDeleteOptionalParams, + FrontendsInterfaceUpdateOptionalParams, + FrontendsInterfaceCreateOrUpdateOptionalParams, + FrontendsInterfaceGetOptionalParams, +} from "../../api/options.js"; + +/** Interface representing a FrontendsInterface operations. */ +export interface FrontendsInterfaceOperations { + /** List Frontend resources by TrafficController */ + listByTrafficController: ( + resourceGroupName: string, + trafficControllerName: string, + options?: FrontendsInterfaceListByTrafficControllerOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a Frontend */ + delete: ( + resourceGroupName: string, + trafficControllerName: string, + frontendName: string, + options?: FrontendsInterfaceDeleteOptionalParams, + ) => PollerLike, void>; + /** Update a Frontend */ + update: ( + resourceGroupName: string, + trafficControllerName: string, + frontendName: string, + properties: FrontendUpdate, + options?: FrontendsInterfaceUpdateOptionalParams, + ) => Promise; + /** Create a Frontend */ + createOrUpdate: ( + resourceGroupName: string, + trafficControllerName: string, + frontendName: string, + resource: Frontend, + options?: FrontendsInterfaceCreateOrUpdateOptionalParams, + ) => PollerLike, Frontend>; + /** Get a Frontend */ + get: ( + resourceGroupName: string, + trafficControllerName: string, + frontendName: string, + options?: FrontendsInterfaceGetOptionalParams, + ) => Promise; +} + +function _getFrontendsInterface(context: ServiceNetworkingManagementContext) { + return { + listByTrafficController: ( + resourceGroupName: string, + trafficControllerName: string, + options?: FrontendsInterfaceListByTrafficControllerOptionalParams, + ) => + frontendsInterfaceListByTrafficController( + context, + resourceGroupName, + trafficControllerName, + options, + ), + delete: ( + resourceGroupName: string, + trafficControllerName: string, + frontendName: string, + options?: FrontendsInterfaceDeleteOptionalParams, + ) => + frontendsInterfaceDelete( + context, + resourceGroupName, + trafficControllerName, + frontendName, + options, + ), + update: ( + resourceGroupName: string, + trafficControllerName: string, + frontendName: string, + properties: FrontendUpdate, + options?: FrontendsInterfaceUpdateOptionalParams, + ) => + frontendsInterfaceUpdate( + context, + resourceGroupName, + trafficControllerName, + frontendName, + properties, + options, + ), + createOrUpdate: ( + resourceGroupName: string, + trafficControllerName: string, + frontendName: string, + resource: Frontend, + options?: FrontendsInterfaceCreateOrUpdateOptionalParams, + ) => + frontendsInterfaceCreateOrUpdate( + context, + resourceGroupName, + trafficControllerName, + frontendName, + resource, + options, + ), + get: ( + resourceGroupName: string, + trafficControllerName: string, + frontendName: string, + options?: FrontendsInterfaceGetOptionalParams, + ) => + frontendsInterfaceGet( + context, + resourceGroupName, + trafficControllerName, + frontendName, + options, + ), + }; +} + +export function _getFrontendsInterfaceOperations( + context: ServiceNetworkingManagementContext, +): FrontendsInterfaceOperations { + return { + ..._getFrontendsInterface(context), + }; +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/index.ts new file mode 100644 index 0000000000..08baeed98f --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/index.ts @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { AssociationsInterfaceOperations } from "./associationsInterface/index.js"; +export { FrontendsInterfaceOperations } from "./frontendsInterface/index.js"; +export { OperationsOperations } from "./operations/index.js"; +export { SecurityPoliciesInterfaceOperations } from "./securityPoliciesInterface/index.js"; +export { TrafficControllerInterfaceOperations } from "./trafficControllerInterface/index.js"; diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/operations/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/operations/index.ts new file mode 100644 index 0000000000..24db186a15 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/operations/index.ts @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementContext } from "../../api/serviceNetworkingManagementContext.js"; +import { operationsList } from "../../api/operations/index.js"; +import { Operation } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { OperationsListOptionalParams } from "../../api/options.js"; + +/** Interface representing a Operations operations. */ +export interface OperationsOperations { + /** List the operations for the provider */ + list: ( + options?: OperationsListOptionalParams, + ) => PagedAsyncIterableIterator; +} + +function _getOperations(context: ServiceNetworkingManagementContext) { + return { + list: (options?: OperationsListOptionalParams) => + operationsList(context, options), + }; +} + +export function _getOperationsOperations( + context: ServiceNetworkingManagementContext, +): OperationsOperations { + return { + ..._getOperations(context), + }; +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/securityPoliciesInterface/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/securityPoliciesInterface/index.ts new file mode 100644 index 0000000000..276f5e0b68 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/securityPoliciesInterface/index.ts @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementContext } from "../../api/serviceNetworkingManagementContext.js"; +import { + securityPoliciesInterfaceListByTrafficController, + securityPoliciesInterfaceDelete, + securityPoliciesInterfaceUpdate, + securityPoliciesInterfaceCreateOrUpdate, + securityPoliciesInterfaceGet, +} from "../../api/securityPoliciesInterface/index.js"; +import { SecurityPolicy, SecurityPolicyUpdate } from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; +import { + SecurityPoliciesInterfaceListByTrafficControllerOptionalParams, + SecurityPoliciesInterfaceDeleteOptionalParams, + SecurityPoliciesInterfaceUpdateOptionalParams, + SecurityPoliciesInterfaceCreateOrUpdateOptionalParams, + SecurityPoliciesInterfaceGetOptionalParams, +} from "../../api/options.js"; + +/** Interface representing a SecurityPoliciesInterface operations. */ +export interface SecurityPoliciesInterfaceOperations { + /** List SecurityPolicy resources by TrafficController */ + listByTrafficController: ( + resourceGroupName: string, + trafficControllerName: string, + options?: SecurityPoliciesInterfaceListByTrafficControllerOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a SecurityPolicy */ + delete: ( + resourceGroupName: string, + trafficControllerName: string, + securityPolicyName: string, + options?: SecurityPoliciesInterfaceDeleteOptionalParams, + ) => PollerLike, void>; + /** Update a SecurityPolicy */ + update: ( + resourceGroupName: string, + trafficControllerName: string, + securityPolicyName: string, + properties: SecurityPolicyUpdate, + options?: SecurityPoliciesInterfaceUpdateOptionalParams, + ) => Promise; + /** Create a SecurityPolicy */ + createOrUpdate: ( + resourceGroupName: string, + trafficControllerName: string, + securityPolicyName: string, + resource: SecurityPolicy, + options?: SecurityPoliciesInterfaceCreateOrUpdateOptionalParams, + ) => PollerLike, SecurityPolicy>; + /** Get a SecurityPolicy */ + get: ( + resourceGroupName: string, + trafficControllerName: string, + securityPolicyName: string, + options?: SecurityPoliciesInterfaceGetOptionalParams, + ) => Promise; +} + +function _getSecurityPoliciesInterface( + context: ServiceNetworkingManagementContext, +) { + return { + listByTrafficController: ( + resourceGroupName: string, + trafficControllerName: string, + options?: SecurityPoliciesInterfaceListByTrafficControllerOptionalParams, + ) => + securityPoliciesInterfaceListByTrafficController( + context, + resourceGroupName, + trafficControllerName, + options, + ), + delete: ( + resourceGroupName: string, + trafficControllerName: string, + securityPolicyName: string, + options?: SecurityPoliciesInterfaceDeleteOptionalParams, + ) => + securityPoliciesInterfaceDelete( + context, + resourceGroupName, + trafficControllerName, + securityPolicyName, + options, + ), + update: ( + resourceGroupName: string, + trafficControllerName: string, + securityPolicyName: string, + properties: SecurityPolicyUpdate, + options?: SecurityPoliciesInterfaceUpdateOptionalParams, + ) => + securityPoliciesInterfaceUpdate( + context, + resourceGroupName, + trafficControllerName, + securityPolicyName, + properties, + options, + ), + createOrUpdate: ( + resourceGroupName: string, + trafficControllerName: string, + securityPolicyName: string, + resource: SecurityPolicy, + options?: SecurityPoliciesInterfaceCreateOrUpdateOptionalParams, + ) => + securityPoliciesInterfaceCreateOrUpdate( + context, + resourceGroupName, + trafficControllerName, + securityPolicyName, + resource, + options, + ), + get: ( + resourceGroupName: string, + trafficControllerName: string, + securityPolicyName: string, + options?: SecurityPoliciesInterfaceGetOptionalParams, + ) => + securityPoliciesInterfaceGet( + context, + resourceGroupName, + trafficControllerName, + securityPolicyName, + options, + ), + }; +} + +export function _getSecurityPoliciesInterfaceOperations( + context: ServiceNetworkingManagementContext, +): SecurityPoliciesInterfaceOperations { + return { + ..._getSecurityPoliciesInterface(context), + }; +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/trafficControllerInterface/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/trafficControllerInterface/index.ts new file mode 100644 index 0000000000..628630add2 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/trafficControllerInterface/index.ts @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + TrafficControllerInterfaceListBySubscriptionOptionalParams, + TrafficControllerInterfaceListByResourceGroupOptionalParams, + TrafficControllerInterfaceDeleteOptionalParams, + TrafficControllerInterfaceUpdateOptionalParams, + TrafficControllerInterfaceCreateOrUpdateOptionalParams, + TrafficControllerInterfaceGetOptionalParams, +} from "../../api/options.js"; +import { ServiceNetworkingManagementContext } from "../../api/serviceNetworkingManagementContext.js"; +import { + trafficControllerInterfaceListBySubscription, + trafficControllerInterfaceListByResourceGroup, + trafficControllerInterfaceDelete, + trafficControllerInterfaceUpdate, + trafficControllerInterfaceCreateOrUpdate, + trafficControllerInterfaceGet, +} from "../../api/trafficControllerInterface/index.js"; +import { + TrafficController, + TrafficControllerUpdate, +} from "../../models/models.js"; +import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; +import { PollerLike, OperationState } from "@azure/core-lro"; + +/** Interface representing a TrafficControllerInterface operations. */ +export interface TrafficControllerInterfaceOperations { + /** List TrafficController resources by subscription ID */ + listBySubscription: ( + options?: TrafficControllerInterfaceListBySubscriptionOptionalParams, + ) => PagedAsyncIterableIterator; + /** List TrafficController resources by resource group */ + listByResourceGroup: ( + resourceGroupName: string, + options?: TrafficControllerInterfaceListByResourceGroupOptionalParams, + ) => PagedAsyncIterableIterator; + /** Delete a TrafficController */ + delete: ( + resourceGroupName: string, + trafficControllerName: string, + options?: TrafficControllerInterfaceDeleteOptionalParams, + ) => PollerLike, void>; + /** Update a TrafficController */ + update: ( + resourceGroupName: string, + trafficControllerName: string, + properties: TrafficControllerUpdate, + options?: TrafficControllerInterfaceUpdateOptionalParams, + ) => Promise; + /** Create a TrafficController */ + createOrUpdate: ( + resourceGroupName: string, + trafficControllerName: string, + resource: TrafficController, + options?: TrafficControllerInterfaceCreateOrUpdateOptionalParams, + ) => PollerLike, TrafficController>; + /** Get a TrafficController */ + get: ( + resourceGroupName: string, + trafficControllerName: string, + options?: TrafficControllerInterfaceGetOptionalParams, + ) => Promise; +} + +function _getTrafficControllerInterface( + context: ServiceNetworkingManagementContext, +) { + return { + listBySubscription: ( + options?: TrafficControllerInterfaceListBySubscriptionOptionalParams, + ) => trafficControllerInterfaceListBySubscription(context, options), + listByResourceGroup: ( + resourceGroupName: string, + options?: TrafficControllerInterfaceListByResourceGroupOptionalParams, + ) => + trafficControllerInterfaceListByResourceGroup( + context, + resourceGroupName, + options, + ), + delete: ( + resourceGroupName: string, + trafficControllerName: string, + options?: TrafficControllerInterfaceDeleteOptionalParams, + ) => + trafficControllerInterfaceDelete( + context, + resourceGroupName, + trafficControllerName, + options, + ), + update: ( + resourceGroupName: string, + trafficControllerName: string, + properties: TrafficControllerUpdate, + options?: TrafficControllerInterfaceUpdateOptionalParams, + ) => + trafficControllerInterfaceUpdate( + context, + resourceGroupName, + trafficControllerName, + properties, + options, + ), + createOrUpdate: ( + resourceGroupName: string, + trafficControllerName: string, + resource: TrafficController, + options?: TrafficControllerInterfaceCreateOrUpdateOptionalParams, + ) => + trafficControllerInterfaceCreateOrUpdate( + context, + resourceGroupName, + trafficControllerName, + resource, + options, + ), + get: ( + resourceGroupName: string, + trafficControllerName: string, + options?: TrafficControllerInterfaceGetOptionalParams, + ) => + trafficControllerInterfaceGet( + context, + resourceGroupName, + trafficControllerName, + options, + ), + }; +} + +export function _getTrafficControllerInterfaceOperations( + context: ServiceNetworkingManagementContext, +): TrafficControllerInterfaceOperations { + return { + ..._getTrafficControllerInterface(context), + }; +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/index.ts new file mode 100644 index 0000000000..8f6b91a7b0 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/index.ts @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + PageSettings, + ContinuablePage, + PagedAsyncIterableIterator, +} from "./static-helpers/pagingHelpers.js"; + +export { ServiceNetworkingManagementClient } from "./serviceNetworkingManagementClient.js"; +export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; +export { + Operation, + OperationDisplay, + KnownOrigin, + Origin, + KnownActionType, + ActionType, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, + TrafficController, + TrafficControllerProperties, + ResourceId, + SecurityPolicyConfigurations, + WafSecurityPolicy, + KnownProvisioningState, + ProvisioningState, + TrackedResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + TrafficControllerUpdate, + TrafficControllerUpdateProperties, + SecurityPolicy, + SecurityPolicyProperties, + KnownPolicyType, + PolicyType, + WafPolicy, + SecurityPolicyUpdate, + SecurityPolicyUpdateProperties, + Frontend, + FrontendProperties, + FrontendUpdate, + Association, + AssociationProperties, + KnownAssociationType, + AssociationType, + AssociationSubnet, + AssociationUpdate, + AssociationUpdateProperties, + AssociationSubnetUpdate, + KnownVersions, +} from "./models/index.js"; +export { + OperationsListOptionalParams, + TrafficControllerInterfaceListBySubscriptionOptionalParams, + TrafficControllerInterfaceListByResourceGroupOptionalParams, + TrafficControllerInterfaceDeleteOptionalParams, + TrafficControllerInterfaceUpdateOptionalParams, + TrafficControllerInterfaceCreateOrUpdateOptionalParams, + TrafficControllerInterfaceGetOptionalParams, + SecurityPoliciesInterfaceListByTrafficControllerOptionalParams, + SecurityPoliciesInterfaceDeleteOptionalParams, + SecurityPoliciesInterfaceUpdateOptionalParams, + SecurityPoliciesInterfaceCreateOrUpdateOptionalParams, + SecurityPoliciesInterfaceGetOptionalParams, + FrontendsInterfaceListByTrafficControllerOptionalParams, + FrontendsInterfaceDeleteOptionalParams, + FrontendsInterfaceUpdateOptionalParams, + FrontendsInterfaceCreateOrUpdateOptionalParams, + FrontendsInterfaceGetOptionalParams, + AssociationsInterfaceListByTrafficControllerOptionalParams, + AssociationsInterfaceDeleteOptionalParams, + AssociationsInterfaceUpdateOptionalParams, + AssociationsInterfaceCreateOrUpdateOptionalParams, + AssociationsInterfaceGetOptionalParams, + ServiceNetworkingManagementClientOptionalParams, +} from "./api/index.js"; +export { + AssociationsInterfaceOperations, + FrontendsInterfaceOperations, + OperationsOperations, + SecurityPoliciesInterfaceOperations, + TrafficControllerInterfaceOperations, +} from "./classic/index.js"; +export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/logger.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/logger.ts new file mode 100644 index 0000000000..01a02f54cd --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/logger.ts @@ -0,0 +1,5 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createClientLogger } from "@azure/logger"; +export const logger = createClientLogger("arm-servicenetworking"); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/models/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/models/index.ts new file mode 100644 index 0000000000..fdd6ebc336 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/models/index.ts @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +export { + Operation, + OperationDisplay, + KnownOrigin, + Origin, + KnownActionType, + ActionType, + ErrorResponse, + ErrorDetail, + ErrorAdditionalInfo, + TrafficController, + TrafficControllerProperties, + ResourceId, + SecurityPolicyConfigurations, + WafSecurityPolicy, + KnownProvisioningState, + ProvisioningState, + TrackedResource, + Resource, + SystemData, + KnownCreatedByType, + CreatedByType, + TrafficControllerUpdate, + TrafficControllerUpdateProperties, + SecurityPolicy, + SecurityPolicyProperties, + KnownPolicyType, + PolicyType, + WafPolicy, + SecurityPolicyUpdate, + SecurityPolicyUpdateProperties, + Frontend, + FrontendProperties, + FrontendUpdate, + Association, + AssociationProperties, + KnownAssociationType, + AssociationType, + AssociationSubnet, + AssociationUpdate, + AssociationUpdateProperties, + AssociationSubnetUpdate, + KnownVersions, +} from "./models.js"; diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/models/models.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/models/models.ts new file mode 100644 index 0000000000..c9932bff03 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/models/models.ts @@ -0,0 +1,987 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ +export interface _OperationListResult { + /** The Operation items on this page */ + value: Operation[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _operationListResultDeserializer( + item: any, +): _OperationListResult { + return { + value: operationArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function operationArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return operationDeserializer(item); + }); +} + +/** Details of a REST API operation, returned from the Resource Provider Operations API */ +export interface Operation { + /** The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" */ + readonly name?: string; + /** Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. */ + readonly isDataAction?: boolean; + /** Localized display information for this particular operation. */ + display?: OperationDisplay; + /** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ + readonly origin?: Origin; + /** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ + readonly actionType?: ActionType; +} + +export function operationDeserializer(item: any): Operation { + return { + name: item["name"], + isDataAction: item["isDataAction"], + display: !item["display"] + ? item["display"] + : operationDisplayDeserializer(item["display"]), + origin: item["origin"], + actionType: item["actionType"], + }; +} + +/** Localized display information for and operation. */ +export interface OperationDisplay { + /** The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". */ + readonly provider?: string; + /** The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". */ + readonly resource?: string; + /** The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". */ + readonly operation?: string; + /** The short, localized friendly description of the operation; suitable for tool tips and detailed views. */ + readonly description?: string; +} + +export function operationDisplayDeserializer(item: any): OperationDisplay { + return { + provider: item["provider"], + resource: item["resource"], + operation: item["operation"], + description: item["description"], + }; +} + +/** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ +export enum KnownOrigin { + /** Indicates the operation is initiated by a user. */ + user = "user", + /** Indicates the operation is initiated by a system. */ + system = "system", + /** Indicates the operation is initiated by a user or system. */ + "user,system" = "user,system", +} + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" \ + * {@link KnownOrigin} can be used interchangeably with Origin, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **user**: Indicates the operation is initiated by a user. \ + * **system**: Indicates the operation is initiated by a system. \ + * **user,system**: Indicates the operation is initiated by a user or system. + */ +export type Origin = string; + +/** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +export enum KnownActionType { + /** Actions are for internal-only APIs. */ + Internal = "Internal", +} + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. \ + * {@link KnownActionType} can be used interchangeably with ActionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Internal**: Actions are for internal-only APIs. + */ +export type ActionType = string; + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +export function errorResponseDeserializer(item: any): ErrorResponse { + return { + error: !item["error"] + ? item["error"] + : errorDetailDeserializer(item["error"]), + }; +} + +/** The error detail. */ +export interface ErrorDetail { + /** The error code. */ + readonly code?: string; + /** The error message. */ + readonly message?: string; + /** The error target. */ + readonly target?: string; + /** The error details. */ + readonly details?: ErrorDetail[]; + /** The error additional info. */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +export function errorDetailDeserializer(item: any): ErrorDetail { + return { + code: item["code"], + message: item["message"], + target: item["target"], + details: !item["details"] + ? item["details"] + : errorDetailArrayDeserializer(item["details"]), + additionalInfo: !item["additionalInfo"] + ? item["additionalInfo"] + : errorAdditionalInfoArrayDeserializer(item["additionalInfo"]), + }; +} + +export function errorDetailArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return errorDetailDeserializer(item); + }); +} + +export function errorAdditionalInfoArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return errorAdditionalInfoDeserializer(item); + }); +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** The additional info type. */ + readonly type?: string; + /** The additional info. */ + readonly info?: Record; +} + +export function errorAdditionalInfoDeserializer( + item: any, +): ErrorAdditionalInfo { + return { + type: item["type"], + info: !item["info"] + ? item["info"] + : _errorAdditionalInfoInfoDeserializer(item["info"]), + }; +} + +/** model interface _ErrorAdditionalInfoInfo */ +export interface _ErrorAdditionalInfoInfo {} + +export function _errorAdditionalInfoInfoDeserializer( + item: any, +): _ErrorAdditionalInfoInfo { + return item; +} + +/** Concrete tracked resource types can be created by aliasing this type using a specific property type. */ +export interface TrafficController extends TrackedResource { + /** The resource-specific properties for this resource. */ + properties?: TrafficControllerProperties; +} + +export function trafficControllerSerializer(item: TrafficController): any { + return { + tags: item["tags"], + location: item["location"], + properties: !item["properties"] + ? item["properties"] + : trafficControllerPropertiesSerializer(item["properties"]), + }; +} + +export function trafficControllerDeserializer(item: any): TrafficController { + return { + tags: item["tags"], + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : trafficControllerPropertiesDeserializer(item["properties"]), + }; +} + +/** Traffic Controller Properties. */ +export interface TrafficControllerProperties { + /** Configuration Endpoints. */ + readonly configurationEndpoints?: string[]; + /** Frontends References List */ + readonly frontends?: ResourceId[]; + /** Associations References List */ + readonly associations?: ResourceId[]; + /** Security Policies References List */ + readonly securityPolicies?: ResourceId[]; + /** Security Policy Configuration */ + securityPolicyConfigurations?: SecurityPolicyConfigurations; + /** The status of the last operation. */ + readonly provisioningState?: ProvisioningState; +} + +export function trafficControllerPropertiesSerializer( + item: TrafficControllerProperties, +): any { + return { + securityPolicyConfigurations: !item["securityPolicyConfigurations"] + ? item["securityPolicyConfigurations"] + : securityPolicyConfigurationsSerializer( + item["securityPolicyConfigurations"], + ), + }; +} + +export function trafficControllerPropertiesDeserializer( + item: any, +): TrafficControllerProperties { + return { + configurationEndpoints: !item["configurationEndpoints"] + ? item["configurationEndpoints"] + : item["configurationEndpoints"].map((p: any) => { + return p; + }), + frontends: !item["frontends"] + ? item["frontends"] + : resourceIdArrayDeserializer(item["frontends"]), + associations: !item["associations"] + ? item["associations"] + : resourceIdArrayDeserializer(item["associations"]), + securityPolicies: !item["securityPolicies"] + ? item["securityPolicies"] + : resourceIdArrayDeserializer(item["securityPolicies"]), + securityPolicyConfigurations: !item["securityPolicyConfigurations"] + ? item["securityPolicyConfigurations"] + : securityPolicyConfigurationsDeserializer( + item["securityPolicyConfigurations"], + ), + provisioningState: item["provisioningState"], + }; +} + +export function resourceIdArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return resourceIdDeserializer(item); + }); +} + +/** Resource ID definition used by parent to reference child resources. */ +export interface ResourceId { + /** Resource ID of child resource. */ + id: string; +} + +export function resourceIdDeserializer(item: any): ResourceId { + return { + id: item["id"], + }; +} + +/** SecurityPolicyConfigurations Subresource of Traffic Controller. */ +export interface SecurityPolicyConfigurations { + /** Contains reference to a WAF-type security policy that is applied at the Traffic Controller level. */ + wafSecurityPolicy?: WafSecurityPolicy; +} + +export function securityPolicyConfigurationsSerializer( + item: SecurityPolicyConfigurations, +): any { + return { + wafSecurityPolicy: !item["wafSecurityPolicy"] + ? item["wafSecurityPolicy"] + : wafSecurityPolicySerializer(item["wafSecurityPolicy"]), + }; +} + +export function securityPolicyConfigurationsDeserializer( + item: any, +): SecurityPolicyConfigurations { + return { + wafSecurityPolicy: !item["wafSecurityPolicy"] + ? item["wafSecurityPolicy"] + : wafSecurityPolicyDeserializer(item["wafSecurityPolicy"]), + }; +} + +/** Web Application Firewall Security Policy */ +export interface WafSecurityPolicy { + /** Resource ID of the Waf Security Policy */ + id: string; +} + +export function wafSecurityPolicySerializer(item: WafSecurityPolicy): any { + return { id: item["id"] }; +} + +export function wafSecurityPolicyDeserializer(item: any): WafSecurityPolicy { + return { + id: item["id"], + }; +} + +/** Resource Provisioning State Enum */ +export enum KnownProvisioningState { + /** Resource in Provisioning State */ + Provisioning = "Provisioning", + /** Resource in Updating State */ + Updating = "Updating", + /** Resource in Deleting State */ + Deleting = "Deleting", + /** Resource in Accepted State */ + Accepted = "Accepted", + /** Resource in Succeeded State */ + Succeeded = "Succeeded", + /** Resource in Failed State */ + Failed = "Failed", + /** Resource in Canceled State */ + Canceled = "Canceled", +} + +/** + * Resource Provisioning State Enum \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Provisioning**: Resource in Provisioning State \ + * **Updating**: Resource in Updating State \ + * **Deleting**: Resource in Deleting State \ + * **Accepted**: Resource in Accepted State \ + * **Succeeded**: Resource in Succeeded State \ + * **Failed**: Resource in Failed State \ + * **Canceled**: Resource in Canceled State + */ +export type ProvisioningState = string; + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export interface TrackedResource extends Resource { + /** Resource tags. */ + tags?: Record; + /** The geo-location where the resource lives */ + location: string; +} + +export function trackedResourceSerializer(item: TrackedResource): any { + return { tags: item["tags"], location: item["location"] }; +} + +export function trackedResourceDeserializer(item: any): TrackedResource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + tags: item["tags"], + location: item["location"], + }; +} + +/** Common fields that are returned in the response for all Azure Resource Manager resources */ +export interface Resource { + /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ + readonly id?: string; + /** The name of the resource */ + readonly name?: string; + /** The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" */ + readonly type?: string; + /** Azure Resource Manager metadata containing createdBy and modifiedBy information. */ + readonly systemData?: SystemData; +} + +export function resourceSerializer(item: Resource): any { + return item; +} + +export function resourceDeserializer(item: any): Resource { + return { + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + }; +} + +/** Metadata pertaining to creation and last modification of the resource. */ +export interface SystemData { + /** The identity that created the resource. */ + createdBy?: string; + /** The type of identity that created the resource. */ + createdByType?: CreatedByType; + /** The timestamp of resource creation (UTC). */ + createdAt?: Date; + /** The identity that last modified the resource. */ + lastModifiedBy?: string; + /** The type of identity that last modified the resource. */ + lastModifiedByType?: CreatedByType; + /** The timestamp of resource last modification (UTC) */ + lastModifiedAt?: Date; +} + +export function systemDataDeserializer(item: any): SystemData { + return { + createdBy: item["createdBy"], + createdByType: item["createdByType"], + createdAt: !item["createdAt"] + ? item["createdAt"] + : new Date(item["createdAt"]), + lastModifiedBy: item["lastModifiedBy"], + lastModifiedByType: item["lastModifiedByType"], + lastModifiedAt: !item["lastModifiedAt"] + ? item["lastModifiedAt"] + : new Date(item["lastModifiedAt"]), + }; +} + +/** The kind of entity that created the resource. */ +export enum KnownCreatedByType { + /** The entity was created by a user. */ + User = "User", + /** The entity was created by an application. */ + Application = "Application", + /** The entity was created by a managed identity. */ + ManagedIdentity = "ManagedIdentity", + /** The entity was created by a key. */ + Key = "Key", +} + +/** + * The kind of entity that created the resource. \ + * {@link KnowncreatedByType} can be used interchangeably with createdByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User**: The entity was created by a user. \ + * **Application**: The entity was created by an application. \ + * **ManagedIdentity**: The entity was created by a managed identity. \ + * **Key**: The entity was created by a key. + */ +export type CreatedByType = string; + +/** The type used for update operations of the TrafficController. */ +export interface TrafficControllerUpdate { + /** Resource tags. */ + tags?: Record; + /** The resource-specific properties for this resource. */ + properties?: TrafficControllerUpdateProperties; +} + +export function trafficControllerUpdateSerializer( + item: TrafficControllerUpdate, +): any { + return { + tags: item["tags"], + properties: !item["properties"] + ? item["properties"] + : trafficControllerUpdatePropertiesSerializer(item["properties"]), + }; +} + +/** The updatable properties of the TrafficController. */ +export interface TrafficControllerUpdateProperties { + /** Security Policy Configuration */ + securityPolicyConfigurations?: SecurityPolicyConfigurations; +} + +export function trafficControllerUpdatePropertiesSerializer( + item: TrafficControllerUpdateProperties, +): any { + return { + securityPolicyConfigurations: !item["securityPolicyConfigurations"] + ? item["securityPolicyConfigurations"] + : securityPolicyConfigurationsSerializer( + item["securityPolicyConfigurations"], + ), + }; +} + +/** The response of a TrafficController list operation. */ +export interface _TrafficControllerListResult { + /** The TrafficController items on this page */ + value: TrafficController[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _trafficControllerListResultDeserializer( + item: any, +): _TrafficControllerListResult { + return { + value: trafficControllerArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function trafficControllerArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return trafficControllerSerializer(item); + }); +} + +export function trafficControllerArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return trafficControllerDeserializer(item); + }); +} + +/** SecurityPolicy Subresource of Traffic Controller. */ +export interface SecurityPolicy extends TrackedResource { + /** The resource-specific properties for this resource. */ + properties?: SecurityPolicyProperties; +} + +export function securityPolicySerializer(item: SecurityPolicy): any { + return { + tags: item["tags"], + location: item["location"], + properties: !item["properties"] + ? item["properties"] + : securityPolicyPropertiesSerializer(item["properties"]), + }; +} + +export function securityPolicyDeserializer(item: any): SecurityPolicy { + return { + tags: item["tags"], + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : securityPolicyPropertiesDeserializer(item["properties"]), + }; +} + +/** SecurityPolicy Properties. */ +export interface SecurityPolicyProperties { + /** Type of the Traffic Controller Security Policy */ + readonly policyType?: PolicyType; + /** Web Application Firewall Policy of the Traffic Controller Security Policy */ + wafPolicy?: WafPolicy; + /** Provisioning State of Traffic Controller SecurityPolicy Resource */ + readonly provisioningState?: ProvisioningState; +} + +export function securityPolicyPropertiesSerializer( + item: SecurityPolicyProperties, +): any { + return { + wafPolicy: !item["wafPolicy"] + ? item["wafPolicy"] + : wafPolicySerializer(item["wafPolicy"]), + }; +} + +export function securityPolicyPropertiesDeserializer( + item: any, +): SecurityPolicyProperties { + return { + policyType: item["policyType"], + wafPolicy: !item["wafPolicy"] + ? item["wafPolicy"] + : wafPolicyDeserializer(item["wafPolicy"]), + provisioningState: item["provisioningState"], + }; +} + +/** Policy Type of the Security Policy */ +export enum KnownPolicyType { + /** Policy of Type WAF */ + WAF = "waf", +} + +/** + * Policy Type of the Security Policy \ + * {@link KnownPolicyType} can be used interchangeably with PolicyType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **waf**: Policy of Type WAF + */ +export type PolicyType = string; + +/** Web Application Firewall Policy */ +export interface WafPolicy { + /** Resource ID of the WAF */ + id: string; +} + +export function wafPolicySerializer(item: WafPolicy): any { + return { id: item["id"] }; +} + +export function wafPolicyDeserializer(item: any): WafPolicy { + return { + id: item["id"], + }; +} + +/** The type used for update operations of the SecurityPolicy. */ +export interface SecurityPolicyUpdate { + /** Resource tags. */ + tags?: Record; + /** The resource-specific properties for this resource. */ + properties?: SecurityPolicyUpdateProperties; +} + +export function securityPolicyUpdateSerializer( + item: SecurityPolicyUpdate, +): any { + return { + tags: item["tags"], + properties: !item["properties"] + ? item["properties"] + : securityPolicyUpdatePropertiesSerializer(item["properties"]), + }; +} + +/** The updatable properties of the SecurityPolicy. */ +export interface SecurityPolicyUpdateProperties { + /** Web Application Firewall Policy of the Traffic Controller Security Policy */ + wafPolicy?: WafPolicy; +} + +export function securityPolicyUpdatePropertiesSerializer( + item: SecurityPolicyUpdateProperties, +): any { + return { + wafPolicy: !item["wafPolicy"] + ? item["wafPolicy"] + : wafPolicySerializer(item["wafPolicy"]), + }; +} + +/** The response of a SecurityPolicy list operation. */ +export interface _SecurityPolicyListResult { + /** The SecurityPolicy items on this page */ + value: SecurityPolicy[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _securityPolicyListResultDeserializer( + item: any, +): _SecurityPolicyListResult { + return { + value: securityPolicyArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function securityPolicyArraySerializer( + result: Array, +): any[] { + return result.map((item) => { + return securityPolicySerializer(item); + }); +} + +export function securityPolicyArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return securityPolicyDeserializer(item); + }); +} + +/** Frontend Sub Resource of Traffic Controller. */ +export interface Frontend extends TrackedResource { + /** The resource-specific properties for this resource. */ + properties?: FrontendProperties; +} + +export function frontendSerializer(item: Frontend): any { + return { + tags: item["tags"], + location: item["location"], + properties: !item["properties"] + ? item["properties"] + : frontendPropertiesSerializer(item["properties"]), + }; +} + +export function frontendDeserializer(item: any): Frontend { + return { + tags: item["tags"], + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : frontendPropertiesDeserializer(item["properties"]), + }; +} + +/** Frontend Properties. */ +export interface FrontendProperties { + /** The Fully Qualified Domain Name of the DNS record associated to a Traffic Controller frontend. */ + readonly fqdn?: string; + /** Provisioning State of Traffic Controller Frontend Resource */ + readonly provisioningState?: ProvisioningState; +} + +export function frontendPropertiesSerializer(item: FrontendProperties): any { + return item; +} + +export function frontendPropertiesDeserializer(item: any): FrontendProperties { + return { + fqdn: item["fqdn"], + provisioningState: item["provisioningState"], + }; +} + +/** The type used for update operations of the Frontend. */ +export interface FrontendUpdate { + /** Resource tags. */ + tags?: Record; +} + +export function frontendUpdateSerializer(item: FrontendUpdate): any { + return { tags: item["tags"] }; +} + +/** The response of a Frontend list operation. */ +export interface _FrontendListResult { + /** The Frontend items on this page */ + value: Frontend[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _frontendListResultDeserializer( + item: any, +): _FrontendListResult { + return { + value: frontendArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function frontendArraySerializer(result: Array): any[] { + return result.map((item) => { + return frontendSerializer(item); + }); +} + +export function frontendArrayDeserializer(result: Array): any[] { + return result.map((item) => { + return frontendDeserializer(item); + }); +} + +/** Association Subresource of Traffic Controller */ +export interface Association extends TrackedResource { + /** The resource-specific properties for this resource. */ + properties?: AssociationProperties; +} + +export function associationSerializer(item: Association): any { + return { + tags: item["tags"], + location: item["location"], + properties: !item["properties"] + ? item["properties"] + : associationPropertiesSerializer(item["properties"]), + }; +} + +export function associationDeserializer(item: any): Association { + return { + tags: item["tags"], + location: item["location"], + id: item["id"], + name: item["name"], + type: item["type"], + systemData: !item["systemData"] + ? item["systemData"] + : systemDataDeserializer(item["systemData"]), + properties: !item["properties"] + ? item["properties"] + : associationPropertiesDeserializer(item["properties"]), + }; +} + +/** Association Properties. */ +export interface AssociationProperties { + /** Association Type */ + associationType: AssociationType; + /** Association Subnet */ + subnet?: AssociationSubnet; + /** Provisioning State of Traffic Controller Association Resource */ + readonly provisioningState?: ProvisioningState; +} + +export function associationPropertiesSerializer( + item: AssociationProperties, +): any { + return { + associationType: item["associationType"], + subnet: !item["subnet"] + ? item["subnet"] + : associationSubnetSerializer(item["subnet"]), + }; +} + +export function associationPropertiesDeserializer( + item: any, +): AssociationProperties { + return { + associationType: item["associationType"], + subnet: !item["subnet"] + ? item["subnet"] + : associationSubnetDeserializer(item["subnet"]), + provisioningState: item["provisioningState"], + }; +} + +/** Association Type Enum */ +export enum KnownAssociationType { + /** Association of Type Subnet */ + subnets = "subnets", +} + +/** + * Association Type Enum \ + * {@link KnownAssociationType} can be used interchangeably with AssociationType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **subnets**: Association of Type Subnet + */ +export type AssociationType = string; + +/** Association Subnet. */ +export interface AssociationSubnet { + /** Association ID. */ + id: string; +} + +export function associationSubnetSerializer(item: AssociationSubnet): any { + return { id: item["id"] }; +} + +export function associationSubnetDeserializer(item: any): AssociationSubnet { + return { + id: item["id"], + }; +} + +/** The type used for update operations of the Association. */ +export interface AssociationUpdate { + /** Resource tags. */ + tags?: Record; + /** The resource-specific properties for this resource. */ + properties?: AssociationUpdateProperties; +} + +export function associationUpdateSerializer(item: AssociationUpdate): any { + return { + tags: item["tags"], + properties: !item["properties"] + ? item["properties"] + : associationUpdatePropertiesSerializer(item["properties"]), + }; +} + +/** The updatable properties of the Association. */ +export interface AssociationUpdateProperties { + /** Association Type */ + associationType?: AssociationType; + /** Association Subnet */ + subnet?: AssociationSubnetUpdate; +} + +export function associationUpdatePropertiesSerializer( + item: AssociationUpdateProperties, +): any { + return { + associationType: item["associationType"], + subnet: !item["subnet"] + ? item["subnet"] + : associationSubnetUpdateSerializer(item["subnet"]), + }; +} + +/** Association Subnet. */ +export interface AssociationSubnetUpdate { + /** Association ID. */ + id: string; +} + +export function associationSubnetUpdateSerializer( + item: AssociationSubnetUpdate, +): any { + return { id: item["id"] }; +} + +/** The response of a Association list operation. */ +export interface _AssociationListResult { + /** The Association items on this page */ + value: Association[]; + /** The link to the next page of items */ + nextLink?: string; +} + +export function _associationListResultDeserializer( + item: any, +): _AssociationListResult { + return { + value: associationArrayDeserializer(item["value"]), + nextLink: item["nextLink"], + }; +} + +export function associationArraySerializer(result: Array): any[] { + return result.map((item) => { + return associationSerializer(item); + }); +} + +export function associationArrayDeserializer( + result: Array, +): any[] { + return result.map((item) => { + return associationDeserializer(item); + }); +} + +/** Api versions */ +export enum KnownVersions { + /** 2023-11-01 stable version */ + v2023_11_01 = "2023-11-01", + /** 2025-01-01 stable version */ + v2025_05_01 = "2025-01-01", +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/restorePollerHelpers.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/restorePollerHelpers.ts new file mode 100644 index 0000000000..e9566f4cb5 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/restorePollerHelpers.ts @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "./serviceNetworkingManagementClient.js"; +import { + _trafficControllerInterfaceDeleteDeserialize, + _trafficControllerInterfaceCreateOrUpdateDeserialize, +} from "./api/trafficControllerInterface/index.js"; +import { + _securityPoliciesInterfaceDeleteDeserialize, + _securityPoliciesInterfaceCreateOrUpdateDeserialize, +} from "./api/securityPoliciesInterface/index.js"; +import { + _frontendsInterfaceDeleteDeserialize, + _frontendsInterfaceCreateOrUpdateDeserialize, +} from "./api/frontendsInterface/index.js"; +import { + _associationsInterfaceDeleteDeserialize, + _associationsInterfaceCreateOrUpdateDeserialize, +} from "./api/associationsInterface/index.js"; +import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; +import { + OperationOptions, + PathUncheckedResponse, +} from "@azure-rest/core-client"; +import { AbortSignalLike } from "@azure/abort-controller"; +import { + PollerLike, + OperationState, + deserializeState, + ResourceLocationConfig, +} from "@azure/core-lro"; + +export interface RestorePollerOptions< + TResult, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +> extends OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** Deserialization function for raw response body */ + processResponseBody?: (result: TResponse) => Promise; +} + +/** + * Creates a poller from the serialized state of another poller. This can be + * useful when you want to create pollers on a different host or a poller + * needs to be constructed after the original one is not in scope. + */ +export function restorePoller( + client: ServiceNetworkingManagementClient, + serializedState: string, + sourceOperation: ( + ...args: any[] + ) => PollerLike, TResult>, + options?: RestorePollerOptions, +): PollerLike, TResult> { + const pollerConfig = deserializeState(serializedState).config; + const { initialRequestUrl, requestMethod, metadata } = pollerConfig; + if (!initialRequestUrl || !requestMethod) { + throw new Error( + `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`, + ); + } + const resourceLocationConfig = metadata?.["resourceLocationConfig"] as + | ResourceLocationConfig + | undefined; + const { deserializer, expectedStatuses = [] } = + getDeserializationHelper(initialRequestUrl, requestMethod) ?? {}; + const deserializeHelper = options?.processResponseBody ?? deserializer; + if (!deserializeHelper) { + throw new Error( + `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`, + ); + } + return getLongRunningPoller( + (client as any)["_client"] ?? client, + deserializeHelper as (result: TResponse) => Promise, + expectedStatuses, + { + updateIntervalInMs: options?.updateIntervalInMs, + abortSignal: options?.abortSignal, + resourceLocationConfig, + restoreFrom: serializedState, + initialRequestUrl, + }, + ); +} + +interface DeserializationHelper { + deserializer: Function; + expectedStatuses: string[]; +} + +const deserializeMap: Record = { + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}": + { + deserializer: _trafficControllerInterfaceDeleteDeserialize, + expectedStatuses: ["202", "204", "200"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}": + { + deserializer: _trafficControllerInterfaceCreateOrUpdateDeserialize, + expectedStatuses: ["200", "201"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/securityPolicies/{securityPolicyName}": + { + deserializer: _securityPoliciesInterfaceDeleteDeserialize, + expectedStatuses: ["202", "204", "200"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/securityPolicies/{securityPolicyName}": + { + deserializer: _securityPoliciesInterfaceCreateOrUpdateDeserialize, + expectedStatuses: ["200", "201"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/frontends/{frontendName}": + { + deserializer: _frontendsInterfaceDeleteDeserialize, + expectedStatuses: ["202", "204", "200"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/frontends/{frontendName}": + { + deserializer: _frontendsInterfaceCreateOrUpdateDeserialize, + expectedStatuses: ["200", "201"], + }, + "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/associations/{associationName}": + { + deserializer: _associationsInterfaceDeleteDeserialize, + expectedStatuses: ["202", "204", "200"], + }, + "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/associations/{associationName}": + { + deserializer: _associationsInterfaceCreateOrUpdateDeserialize, + expectedStatuses: ["200", "201"], + }, +}; + +function getDeserializationHelper( + urlStr: string, + method: string, +): DeserializationHelper | undefined { + const path = new URL(urlStr).pathname; + const pathParts = path.split("/"); + + // Traverse list to match the longest candidate + // matchedLen: the length of candidate path + // matchedValue: the matched status code array + let matchedLen = -1, + matchedValue: DeserializationHelper | undefined; + + // Iterate the responseMap to find a match + for (const [key, value] of Object.entries(deserializeMap)) { + // Extracting the path from the map key which is in format + // GET /path/foo + if (!key.startsWith(method)) { + continue; + } + const candidatePath = getPathFromMapKey(key); + // Get each part of the url path + const candidateParts = candidatePath.split("/"); + + // track if we have found a match to return the values found. + let found = true; + for ( + let i = candidateParts.length - 1, j = pathParts.length - 1; + i >= 1 && j >= 1; + i--, j-- + ) { + if ( + candidateParts[i]?.startsWith("{") && + candidateParts[i]?.indexOf("}") !== -1 + ) { + const start = candidateParts[i]!.indexOf("}") + 1, + end = candidateParts[i]?.length; + // If the current part of the candidate is a "template" part + // Try to use the suffix of pattern to match the path + // {guid} ==> $ + // {guid}:export ==> :export$ + const isMatched = new RegExp( + `${candidateParts[i]?.slice(start, end)}`, + ).test(pathParts[j] || ""); + + if (!isMatched) { + found = false; + break; + } + continue; + } + + // If the candidate part is not a template and + // the parts don't match mark the candidate as not found + // to move on with the next candidate path. + if (candidateParts[i] !== pathParts[j]) { + found = false; + break; + } + } + + // We finished evaluating the current candidate parts + // Update the matched value if and only if we found the longer pattern + if (found && candidatePath.length > matchedLen) { + matchedLen = candidatePath.length; + matchedValue = value; + } + } + + return matchedValue; +} + +function getPathFromMapKey(mapKey: string): string { + const pathStart = mapKey.indexOf("/"); + return mapKey.slice(pathStart); +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/serviceNetworkingManagementClient.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/serviceNetworkingManagementClient.ts new file mode 100644 index 0000000000..84ce8c7ca5 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/serviceNetworkingManagementClient.ts @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + _getOperationsOperations, + OperationsOperations, +} from "./classic/operations/index.js"; +import { + _getTrafficControllerInterfaceOperations, + TrafficControllerInterfaceOperations, +} from "./classic/trafficControllerInterface/index.js"; +import { + _getSecurityPoliciesInterfaceOperations, + SecurityPoliciesInterfaceOperations, +} from "./classic/securityPoliciesInterface/index.js"; +import { + _getFrontendsInterfaceOperations, + FrontendsInterfaceOperations, +} from "./classic/frontendsInterface/index.js"; +import { + _getAssociationsInterfaceOperations, + AssociationsInterfaceOperations, +} from "./classic/associationsInterface/index.js"; +import { + createServiceNetworkingManagement, + ServiceNetworkingManagementContext, + ServiceNetworkingManagementClientOptionalParams, +} from "./api/index.js"; +import { Pipeline } from "@azure/core-rest-pipeline"; +import { TokenCredential } from "@azure/core-auth"; + +export { ServiceNetworkingManagementClientOptionalParams } from "./api/serviceNetworkingManagementContext.js"; + +export class ServiceNetworkingManagementClient { + private _client: ServiceNetworkingManagementContext; + /** The pipeline used by this client to make requests */ + public readonly pipeline: Pipeline; + + /** Traffic Controller Provider management API. */ + constructor( + credential: TokenCredential, + subscriptionId: string, + options: ServiceNetworkingManagementClientOptionalParams = {}, + ) { + const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; + const userAgentPrefix = prefixFromOptions + ? `${prefixFromOptions} azsdk-js-client` + : `azsdk-js-client`; + this._client = createServiceNetworkingManagement( + credential, + subscriptionId, + { ...options, userAgentOptions: { userAgentPrefix } }, + ); + this.pipeline = this._client.pipeline; + this.operations = _getOperationsOperations(this._client); + this.trafficControllerInterface = _getTrafficControllerInterfaceOperations( + this._client, + ); + this.securityPoliciesInterface = _getSecurityPoliciesInterfaceOperations( + this._client, + ); + this.frontendsInterface = _getFrontendsInterfaceOperations(this._client); + this.associationsInterface = _getAssociationsInterfaceOperations( + this._client, + ); + } + + /** The operation groups for operations */ + public readonly operations: OperationsOperations; + /** The operation groups for trafficControllerInterface */ + public readonly trafficControllerInterface: TrafficControllerInterfaceOperations; + /** The operation groups for securityPoliciesInterface */ + public readonly securityPoliciesInterface: SecurityPoliciesInterfaceOperations; + /** The operation groups for frontendsInterface */ + public readonly frontendsInterface: FrontendsInterfaceOperations; + /** The operation groups for associationsInterface */ + public readonly associationsInterface: AssociationsInterfaceOperations; +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/static-helpers/pagingHelpers.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/static-helpers/pagingHelpers.ts new file mode 100644 index 0000000000..97a81e74e3 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/static-helpers/pagingHelpers.ts @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + Client, + createRestError, + PathUncheckedResponse, +} from "@azure-rest/core-client"; +import { RestError } from "@azure/core-rest-pipeline"; + +/** + * Options for the byPage method + */ +export interface PageSettings { + /** + * A reference to a specific page to start iterating from. + */ + continuationToken?: string; +} + +/** + * An interface that describes a page of results. + */ +export type ContinuablePage = TPage & { + /** + * The token that keeps track of where to continue the iterator + */ + continuationToken?: string; +}; + +/** + * An interface that allows async iterable iteration both to completion and by page. + */ +export interface PagedAsyncIterableIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * The next method, part of the iteration protocol + */ + next(): Promise>; + /** + * The connection to the async iterator, part of the iteration protocol + */ + [Symbol.asyncIterator](): PagedAsyncIterableIterator< + TElement, + TPage, + TPageSettings + >; + /** + * Return an AsyncIterableIterator that works a page at a time + */ + byPage: ( + settings?: TPageSettings, + ) => AsyncIterableIterator>; +} + +/** + * An interface that describes how to communicate with the service. + */ +export interface PagedResult< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +> { + /** + * Link to the first page of results. + */ + firstPageLink?: string; + /** + * A method that returns a page of results. + */ + getPage: ( + pageLink?: string, + ) => Promise<{ page: TPage; nextPageLink?: string } | undefined>; + /** + * a function to implement the `byPage` method on the paged async iterator. + */ + byPage?: ( + settings?: TPageSettings, + ) => AsyncIterableIterator>; + + /** + * A function to extract elements from a page. + */ + toElements?: (page: TPage) => TElement[]; +} + +/** + * Options for the paging helper + */ +export interface BuildPagedAsyncIteratorOptions { + itemName?: string; + nextLinkName?: string; +} + +/** + * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator + */ +export function buildPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, + TResponse extends PathUncheckedResponse = PathUncheckedResponse, +>( + client: Client, + getInitialResponse: () => PromiseLike, + processResponseBody: (result: TResponse) => PromiseLike, + expectedStatuses: string[], + options: BuildPagedAsyncIteratorOptions = {}, +): PagedAsyncIterableIterator { + const itemName = options.itemName ?? "value"; + const nextLinkName = options.nextLinkName ?? "nextLink"; + const pagedResult: PagedResult = { + getPage: async (pageLink?: string) => { + const result = + pageLink === undefined + ? await getInitialResponse() + : await client.pathUnchecked(pageLink).get(); + checkPagingRequest(result, expectedStatuses); + const results = await processResponseBody(result as TResponse); + const nextLink = getNextLink(results, nextLinkName); + const values = getElements(results, itemName) as TPage; + return { + page: values, + nextPageLink: nextLink, + }; + }, + byPage: (settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }, + }; + return getPagedAsyncIterator(pagedResult); +} + +/** + * returns an async iterator that iterates over results. It also has a `byPage` + * method that returns pages of items at once. + * + * @param pagedResult - an object that specifies how to get pages. + * @returns a paged async iterator that iterates over results. + */ + +function getPagedAsyncIterator< + TElement, + TPage = TElement[], + TPageSettings extends PageSettings = PageSettings, +>( + pagedResult: PagedResult, +): PagedAsyncIterableIterator { + const iter = getItemAsyncIterator( + pagedResult, + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: + pagedResult?.byPage ?? + ((settings?: TPageSettings) => { + const { continuationToken } = settings ?? {}; + return getPageAsyncIterator(pagedResult, { + pageLink: continuationToken, + }); + }), + }; +} + +async function* getItemAsyncIterator< + TElement, + TPage, + TPageSettings extends PageSettings, +>( + pagedResult: PagedResult, +): AsyncIterableIterator { + const pages = getPageAsyncIterator(pagedResult); + for await (const page of pages) { + yield* page as unknown as TElement[]; + } +} + +async function* getPageAsyncIterator< + TElement, + TPage, + TPageSettings extends PageSettings, +>( + pagedResult: PagedResult, + options: { + pageLink?: string; + } = {}, +): AsyncIterableIterator> { + const { pageLink } = options; + let response = await pagedResult.getPage( + pageLink ?? pagedResult.firstPageLink, + ); + if (!response) { + return; + } + let result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + while (response.nextPageLink) { + response = await pagedResult.getPage(response.nextPageLink); + if (!response) { + return; + } + result = response.page as ContinuablePage; + result.continuationToken = response.nextPageLink; + yield result; + } +} + +/** + * Gets for the value of nextLink in the body + */ +function getNextLink(body: unknown, nextLinkName?: string): string | undefined { + if (!nextLinkName) { + return undefined; + } + + const nextLink = (body as Record)[nextLinkName]; + + if ( + typeof nextLink !== "string" && + typeof nextLink !== "undefined" && + nextLink !== null + ) { + throw new RestError( + `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`, + ); + } + + if (nextLink === null) { + return undefined; + } + + return nextLink; +} + +/** + * Gets the elements of the current request in the body. + */ +function getElements(body: unknown, itemName: string): T[] { + const value = (body as Record)[itemName] as T[]; + if (!Array.isArray(value)) { + throw new RestError( + `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, + ); + } + + return value ?? []; +} + +/** + * Checks if a request failed + */ +function checkPagingRequest( + response: PathUncheckedResponse, + expectedStatuses: string[], +): void { + if (!expectedStatuses.includes(response.status)) { + throw createRestError( + `Pagination failed with unexpected statusCode ${response.status}`, + response, + ); + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/static-helpers/pollingHelpers.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/static-helpers/pollingHelpers.ts new file mode 100644 index 0000000000..2edbf783be --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/static-helpers/pollingHelpers.ts @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + PollerLike, + OperationState, + ResourceLocationConfig, + RunningOperation, + createHttpPoller, + OperationResponse, +} from "@azure/core-lro"; + +import { + Client, + PathUncheckedResponse, + createRestError, +} from "@azure-rest/core-client"; +import { AbortSignalLike } from "@azure/abort-controller"; + +export interface GetLongRunningPollerOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** + * The signal which can be used to abort requests. + */ + abortSignal?: AbortSignalLike; + /** + * The potential location of the result of the LRO if specified by the LRO extension in the swagger. + */ + resourceLocationConfig?: ResourceLocationConfig; + /** + * The original url of the LRO + * Should not be null when restoreFrom is set + */ + initialRequestUrl?: string; + /** + * A serialized poller which can be used to resume an existing paused Long-Running-Operation. + */ + restoreFrom?: string; + /** + * The function to get the initial response + */ + getInitialResponse?: () => PromiseLike; +} +export function getLongRunningPoller< + TResponse extends PathUncheckedResponse, + TResult = void, +>( + client: Client, + processResponseBody: (result: TResponse) => Promise, + expectedStatuses: string[], + options: GetLongRunningPollerOptions, +): PollerLike, TResult> { + const { restoreFrom, getInitialResponse } = options; + if (!restoreFrom && !getInitialResponse) { + throw new Error( + "Either restoreFrom or getInitialResponse must be specified", + ); + } + let initialResponse: TResponse | undefined = undefined; + const pollAbortController = new AbortController(); + const poller: RunningOperation = { + sendInitialRequest: async () => { + if (!getInitialResponse) { + throw new Error( + "getInitialResponse is required when initializing a new poller", + ); + } + initialResponse = await getInitialResponse(); + return getLroResponse(initialResponse, expectedStatuses); + }, + sendPollRequest: async ( + path: string, + pollOptions?: { + abortSignal?: AbortSignalLike; + }, + ) => { + // The poll request would both listen to the user provided abort signal and the poller's own abort signal + function abortListener(): void { + pollAbortController.abort(); + } + const abortSignal = pollAbortController.signal; + if (options.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (pollOptions?.abortSignal?.aborted) { + pollAbortController.abort(); + } else if (!abortSignal.aborted) { + options.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + pollOptions?.abortSignal?.addEventListener("abort", abortListener, { + once: true, + }); + } + let response; + try { + response = await client.pathUnchecked(path).get({ abortSignal }); + } finally { + options.abortSignal?.removeEventListener("abort", abortListener); + pollOptions?.abortSignal?.removeEventListener("abort", abortListener); + } + + return getLroResponse(response as TResponse, expectedStatuses); + }, + }; + return createHttpPoller(poller, { + intervalInMs: options?.updateIntervalInMs, + resourceLocationConfig: options?.resourceLocationConfig, + restoreFrom: options?.restoreFrom, + processResult: (result: unknown) => { + return processResponseBody(result as TResponse); + }, + }); +} +/** + * Converts a Rest Client response to a response that the LRO implementation understands + * @param response - a rest client http response + * @param deserializeFn - deserialize function to convert Rest response to modular output + * @returns - An LRO response that the LRO implementation understands + */ +function getLroResponse( + response: TResponse, + expectedStatuses: string[], +): OperationResponse { + if (!expectedStatuses.includes(response.status)) { + throw createRestError(response); + } + + return { + flatResponse: response, + rawResponse: { + ...response, + statusCode: Number.parseInt(response.status), + body: response.body, + }, + }; +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/test/public/sampleTest.spec.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/test/public/sampleTest.spec.ts new file mode 100644 index 0000000000..d4919ac91a --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/test/public/sampleTest.spec.ts @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { createRecorder } from "./utils/recordedClient.js"; +import { assert, beforeEach, afterEach, it, describe } from "vitest"; + +describe("My test", () => { + // let recorder: Recorder; + + beforeEach(async function () { + // recorder = await createRecorder(this); + }); + + afterEach(async function () { + // await recorder.stop(); + }); + + it("sample test", async function () { + assert.equal(1, 1); + }); +}); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/test/public/utils/recordedClient.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/test/public/utils/recordedClient.ts new file mode 100644 index 0000000000..6e425fdcfd --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/test/public/utils/recordedClient.ts @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { + Recorder, + RecorderStartOptions, + VitestTestContext, +} from "@azure-tools/test-recorder"; + +const replaceableVariables: Record = { + SUBSCRIPTION_ID: "azure_subscription_id", +}; + +const recorderEnvSetup: RecorderStartOptions = { + envSetupForPlayback: replaceableVariables, +}; + +/** + * creates the recorder and reads the environment variables from the `.env` file. + * Should be called first in the test suite to make sure environment variables are + * read before they are being used. + */ +export async function createRecorder( + context: VitestTestContext, +): Promise { + const recorder = new Recorder(context); + await recorder.start(recorderEnvSetup); + return recorder; +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/tsconfig.json b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/tsconfig.json new file mode 100644 index 0000000000..30099587a7 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "ES2017", + "module": "NodeNext", + "lib": [], + "declaration": true, + "declarationMap": true, + "inlineSources": true, + "sourceMap": true, + "importHelpers": true, + "strict": true, + "alwaysStrict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "forceConsistentCasingInFileNames": true, + "moduleResolution": "NodeNext", + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "paths": { "@azure/arm-servicenetworking": ["./src/index"] } + }, + "include": ["src/**/*.ts", "test/**/*.ts", "samples-dev/**/*.ts"] +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/vitest.browser.config.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/vitest.browser.config.ts new file mode 100644 index 0000000000..ffa15d2516 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/vitest.browser.config.ts @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { defineConfig } from "vitest/config"; +import { relativeRecordingsPath } from "@azure-tools/test-recorder"; + +process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath(); + +export default defineConfig({ + define: { + "process.env": process.env, + }, + test: { + reporters: ["basic", "junit"], + outputFile: { + junit: "test-results.browser.xml", + }, + browser: { + enabled: true, + headless: true, + name: "chromium", + provider: "playwright", + }, + fakeTimers: { + toFake: ["setTimeout", "Date"], + }, + watch: false, + include: ["test/**/*.spec.ts"], + coverage: { + include: ["test/**/*.spec.ts"], + provider: "istanbul", + reporter: ["text", "json", "html"], + reportsDirectory: "coverage-browser", + }, + testTimeout: 1200000, + hookTimeout: 1200000, + }, +}); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/vitest.config.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/vitest.config.ts new file mode 100644 index 0000000000..2cf5d0e02c --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/vitest.config.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { defineConfig } from "vitest/config"; +import { relativeRecordingsPath } from "@azure-tools/test-recorder"; + +export default defineConfig({ + test: { + reporters: ["basic", "junit"], + outputFile: { + junit: "test-results.browser.xml", + }, + fakeTimers: { + toFake: ["setTimeout", "Date"], + }, + watch: false, + include: ["test/**/*.spec.ts"], + exclude: ["test/**/browser/*.spec.ts"], + coverage: { + include: ["src/**/*.ts"], + exclude: [ + "src/**/*-browser.mts", + "src/**/*-react-native.mts", + "vitest*.config.ts", + "samples-dev/**/*.ts", + ], + provider: "istanbul", + reporter: ["text", "json", "html"], + reportsDirectory: "coverage", + }, + testTimeout: 1200000, + hookTimeout: 1200000, + }, +}); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/client.tsp b/packages/typespec-test/test/ServiceNetworking.Management/spec/client.tsp new file mode 100644 index 0000000000..668473769c --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/client.tsp @@ -0,0 +1,18 @@ +import "./main.tsp"; +import "@azure-tools/typespec-client-generator-core"; + +using Azure.ClientGenerator.Core; + +@@clientName(Microsoft.ServiceNetworking, "ServiceNetworkingMgmt", "python"); +@@clientName(Microsoft.ServiceNetworking, + "ServiceNetworkingManagementClient", + "javascript" +); +@@clientName(Microsoft.ServiceNetworking, + "TrafficControllerManagementClient", + "java" +); +@@clientNamespace(Microsoft.ServiceNetworking, + "com.azure.resourcemanager.servicenetworking", + "java" +); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationDelete.json new file mode 100644 index 0000000000..d67a519709 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationDelete.json @@ -0,0 +1,20 @@ +{ + "title": "Delete Association", + "operationId": "AssociationsInterface_Delete", + "parameters": { + "api-version": "2023-11-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "associationName": "as1" + }, + "responses": { + "202": { + "headers": { + "Retry-After": 3, + "location": "https://blobLocation.com" + } + }, + "204": {} + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationGet.json new file mode 100644 index 0000000000..f67a82d397 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationGet.json @@ -0,0 +1,28 @@ +{ + "title": "Get Association", + "operationId": "AssociationsInterface_Get", + "parameters": { + "api-version": "2023-11-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "associationName": "as1" + }, + "responses": { + "200": { + "body": { + "name": "as1", + "type": "Microsoft.ServiceNetworking/trafficControllers/associations", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", + "location": "NorthCentralUS", + "properties": { + "associationType": "subnets", + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" + }, + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationPatch.json new file mode 100644 index 0000000000..d6cbba4578 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationPatch.json @@ -0,0 +1,35 @@ +{ + "title": "Update Association", + "operationId": "AssociationsInterface_Update", + "parameters": { + "api-version": "2023-11-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "associationName": "as1", + "properties": { + "properties": { + "associationType": "subnets", + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" + } + } + } + }, + "responses": { + "200": { + "body": { + "name": "as1", + "type": "Microsoft.ServiceNetworking/trafficControllers/associations", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", + "location": "NorthCentralUS", + "properties": { + "associationType": "subnets", + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" + } + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationPut.json new file mode 100644 index 0000000000..3f9776f48c --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationPut.json @@ -0,0 +1,51 @@ +{ + "title": "Put Association", + "operationId": "AssociationsInterface_CreateOrUpdate", + "parameters": { + "api-version": "2023-11-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "associationName": "as1", + "resource": { + "location": "NorthCentralUS", + "properties": { + "associationType": "subnets", + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" + } + } + } + }, + "responses": { + "200": { + "body": { + "name": "associatedvnet-1", + "type": "Microsoft.ServiceNetworking/trafficControllers/associations", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", + "location": "NorthCentralUS", + "properties": { + "associationType": "subnets", + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" + }, + "provisioningState": "Accepted" + } + } + }, + "201": { + "body": { + "name": "associatedvnet-1", + "type": "Microsoft.ServiceNetworking/trafficControllers/associations", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", + "location": "NorthCentralUS", + "properties": { + "associationType": "subnets", + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" + } + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationsGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationsGet.json new file mode 100644 index 0000000000..0ce9360d8e --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationsGet.json @@ -0,0 +1,31 @@ +{ + "title": "Get Associations", + "operationId": "AssociationsInterface_ListByTrafficController", + "parameters": { + "api-version": "2023-11-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "name": "as1", + "type": "Microsoft.ServiceNetworking/trafficControllers/associations", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", + "location": "NorthCentralUS", + "properties": { + "associationType": "subnets", + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" + }, + "provisioningState": "Succeeded" + } + } + ] + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendDelete.json new file mode 100644 index 0000000000..08e0d5e826 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendDelete.json @@ -0,0 +1,20 @@ +{ + "title": "Delete Frontend", + "operationId": "FrontendsInterface_Delete", + "parameters": { + "api-version": "2023-11-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "frontendName": "fe1" + }, + "responses": { + "202": { + "headers": { + "Retry-After": 3, + "location": "https://blobLocation.com" + } + }, + "204": {} + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendGet.json new file mode 100644 index 0000000000..89c63abe81 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendGet.json @@ -0,0 +1,25 @@ +{ + "title": "Get Frontend", + "operationId": "FrontendsInterface_Get", + "parameters": { + "api-version": "2023-11-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "frontendName": "fe1" + }, + "responses": { + "200": { + "body": { + "name": "fe1", + "location": "NorthCentralUS", + "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", + "properties": { + "fqdn": "test.net", + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendPatch.json new file mode 100644 index 0000000000..251cf906d1 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendPatch.json @@ -0,0 +1,26 @@ +{ + "title": "Update Frontend", + "operationId": "FrontendsInterface_Update", + "parameters": { + "api-version": "2023-11-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "frontendName": "fe1", + "properties": {} + }, + "responses": { + "200": { + "body": { + "name": "fe1", + "location": "NorthCentralUS", + "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", + "properties": { + "fqdn": "test.net", + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendPut.json new file mode 100644 index 0000000000..d56c9b4499 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendPut.json @@ -0,0 +1,41 @@ +{ + "title": "Put Frontend", + "operationId": "FrontendsInterface_CreateOrUpdate", + "parameters": { + "api-version": "2023-11-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "frontendName": "fe1", + "resource": { + "location": "NorthCentralUS", + "properties": {} + } + }, + "responses": { + "200": { + "body": { + "name": "fe1", + "location": "NorthCentralUS", + "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", + "properties": { + "fqdn": "test.net", + "provisioningState": "Succeeded" + } + } + }, + "201": { + "body": { + "name": "fe1", + "location": "NorthCentralUS", + "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", + "properties": { + "fqdn": "test.net", + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendsGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendsGet.json new file mode 100644 index 0000000000..08dbeb1100 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendsGet.json @@ -0,0 +1,28 @@ +{ + "title": "Get Frontends", + "operationId": "FrontendsInterface_ListByTrafficController", + "parameters": { + "api-version": "2023-11-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "name": "fe1", + "location": "NorthCentralUS", + "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", + "properties": { + "fqdn": "test.net", + "provisioningState": "Succeeded" + } + } + ] + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/OperationsList.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/OperationsList.json new file mode 100644 index 0000000000..89f43a23b6 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/OperationsList.json @@ -0,0 +1,26 @@ +{ + "title": "Get Operations List", + "operationId": "Operations_List", + "parameters": { + "api-version": "2023-11-01" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "name": "Microsoft.ServiceNetworking/trafficControllers/read", + "isDataAction": false, + "display": { + "provider": "Microsoft Service Networking", + "resource": "Traffic Controller", + "operation": "Get Traffic Controller configuration", + "description": "Traffic Controller is a L7 Load Balancing solution for a Multi Cluster setup" + }, + "origin": "user,system" + } + ] + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerDelete.json new file mode 100644 index 0000000000..3037ebf88c --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerDelete.json @@ -0,0 +1,19 @@ +{ + "title": "Delete Traffic Controller", + "operationId": "TrafficControllerInterface_Delete", + "parameters": { + "api-version": "2023-11-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1" + }, + "responses": { + "202": { + "headers": { + "Retry-After": 3, + "location": "https://blobLocation.com" + } + }, + "204": {} + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerGet.json new file mode 100644 index 0000000000..25ec6b5db8 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerGet.json @@ -0,0 +1,39 @@ +{ + "operationId": "TrafficControllerInterface_Get", + "title": "Get Traffic Controller", + "parameters": { + "api-version": "2023-11-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1" + }, + "responses": { + "200": { + "body": { + "name": "tc1", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", + "type": "Microsoft.ServiceNetworking/trafficControllers", + "location": "NorthCentralUS", + "tags": { + "key1": "value1" + }, + "properties": { + "configurationEndpoints": [ + "abc.trafficcontroller.azure.net" + ], + "frontends": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" + } + ], + "associations": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" + } + ], + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerPatch.json new file mode 100644 index 0000000000..2dba4c176a --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerPatch.json @@ -0,0 +1,44 @@ +{ + "operationId": "TrafficControllerInterface_Update", + "title": "Patch Traffic Controller", + "parameters": { + "api-version": "2023-11-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "properties": { + "tags": { + "key1": "value1" + } + } + }, + "responses": { + "200": { + "body": { + "name": "tc1", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", + "type": "Microsoft.ServiceNetworking/trafficControllers", + "location": "NorthCentralUS", + "tags": { + "key1": "value1" + }, + "properties": { + "configurationEndpoints": [ + "abc.trafficcontroller.azure.net" + ], + "frontends": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" + } + ], + "associations": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" + } + ], + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerPut.json new file mode 100644 index 0000000000..269c1516ca --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerPut.json @@ -0,0 +1,72 @@ +{ + "operationId": "TrafficControllerInterface_CreateOrUpdate", + "title": "Put Traffic Controller", + "parameters": { + "api-version": "2023-11-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "resource": { + "location": "NorthCentralUS", + "tags": { + "key1": "value1" + } + } + }, + "responses": { + "200": { + "body": { + "name": "tc1", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", + "type": "Microsoft.ServiceNetworking/trafficControllers", + "location": "NorthCentralUS", + "tags": { + "key1": "value1" + }, + "properties": { + "configurationEndpoints": [ + "abc.trafficcontroller.azure.net" + ], + "frontends": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" + } + ], + "associations": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" + } + ], + "provisioningState": "Succeeded" + } + } + }, + "201": { + "body": { + "name": "tc1", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", + "type": "Microsoft.ServiceNetworking/trafficControllers", + "location": "NorthCentralUS", + "tags": { + "key1": "value1" + }, + "properties": { + "configurationEndpoints": [ + "abc.trafficcontroller.azure.net" + ], + "frontends": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" + } + ], + "associations": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" + } + ], + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllersGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllersGet.json new file mode 100644 index 0000000000..5639436de0 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllersGet.json @@ -0,0 +1,42 @@ +{ + "operationId": "TrafficControllerInterface_ListByResourceGroup", + "title": "Get Traffic Controllers", + "parameters": { + "api-version": "2023-11-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "name": "tc1", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", + "type": "Microsoft.ServiceNetworking/trafficControllers", + "location": "NorthCentralUS", + "tags": { + "key1": "value1" + }, + "properties": { + "configurationEndpoints": [ + "abc.trafficcontroller.azure.net" + ], + "frontends": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" + } + ], + "associations": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" + } + ], + "provisioningState": "Succeeded" + } + } + ] + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllersGetList.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllersGetList.json new file mode 100644 index 0000000000..eba2c88502 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllersGetList.json @@ -0,0 +1,41 @@ +{ + "operationId": "TrafficControllerInterface_ListBySubscription", + "title": "Get Traffic Controllers List", + "parameters": { + "api-version": "2023-11-01", + "subscriptionId": "subid" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "name": "tc1", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", + "type": "Microsoft.ServiceNetworking/trafficControllers", + "location": "NorthCentralUS", + "tags": { + "key1": "value1" + }, + "properties": { + "configurationEndpoints": [ + "abc.trafficcontroller.azure.net" + ], + "frontends": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" + } + ], + "associations": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" + } + ], + "provisioningState": "Succeeded" + } + } + ] + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationDelete.json new file mode 100644 index 0000000000..4bda79e734 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationDelete.json @@ -0,0 +1,20 @@ +{ + "title": "Delete Association", + "operationId": "AssociationsInterface_Delete", + "parameters": { + "api-version": "2024-05-01-preview", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "associationName": "as1" + }, + "responses": { + "202": { + "headers": { + "Retry-After": 3, + "location": "https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1" + } + }, + "204": {} + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationGet.json new file mode 100644 index 0000000000..d4caea970e --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationGet.json @@ -0,0 +1,28 @@ +{ + "title": "Get Association", + "operationId": "AssociationsInterface_Get", + "parameters": { + "api-version": "2024-05-01-preview", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "associationName": "as1" + }, + "responses": { + "200": { + "body": { + "name": "as1", + "type": "Microsoft.ServiceNetworking/trafficControllers/associations", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", + "location": "NorthCentralUS", + "properties": { + "associationType": "subnets", + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" + }, + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationPatch.json new file mode 100644 index 0000000000..0c5c80d812 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationPatch.json @@ -0,0 +1,35 @@ +{ + "title": "Update Association", + "operationId": "AssociationsInterface_Update", + "parameters": { + "api-version": "2024-05-01-preview", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "associationName": "as1", + "properties": { + "properties": { + "associationType": "subnets", + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" + } + } + } + }, + "responses": { + "200": { + "body": { + "name": "as1", + "type": "Microsoft.ServiceNetworking/trafficControllers/associations", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", + "location": "NorthCentralUS", + "properties": { + "associationType": "subnets", + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" + } + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationPut.json new file mode 100644 index 0000000000..e07ef2aef8 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationPut.json @@ -0,0 +1,51 @@ +{ + "title": "Put Association", + "operationId": "AssociationsInterface_CreateOrUpdate", + "parameters": { + "api-version": "2024-05-01-preview", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "associationName": "as1", + "resource": { + "location": "NorthCentralUS", + "properties": { + "associationType": "subnets", + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" + } + } + } + }, + "responses": { + "200": { + "body": { + "name": "associatedvnet-1", + "type": "Microsoft.ServiceNetworking/trafficControllers/associations", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", + "location": "NorthCentralUS", + "properties": { + "associationType": "subnets", + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" + }, + "provisioningState": "Accepted" + } + } + }, + "201": { + "body": { + "name": "associatedvnet-1", + "type": "Microsoft.ServiceNetworking/trafficControllers/associations", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", + "location": "NorthCentralUS", + "properties": { + "associationType": "subnets", + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" + } + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationsGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationsGet.json new file mode 100644 index 0000000000..ec481b0f9f --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationsGet.json @@ -0,0 +1,31 @@ +{ + "title": "Get Associations", + "operationId": "AssociationsInterface_ListByTrafficController", + "parameters": { + "api-version": "2024-05-01-preview", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "name": "as1", + "type": "Microsoft.ServiceNetworking/trafficControllers/associations", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", + "location": "NorthCentralUS", + "properties": { + "associationType": "subnets", + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" + }, + "provisioningState": "Succeeded" + } + } + ] + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendDelete.json new file mode 100644 index 0000000000..583d2073ca --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendDelete.json @@ -0,0 +1,20 @@ +{ + "title": "Delete Frontend", + "operationId": "FrontendsInterface_Delete", + "parameters": { + "api-version": "2024-05-01-preview", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "frontendName": "fe1" + }, + "responses": { + "202": { + "headers": { + "Retry-After": 3, + "location": "https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" + } + }, + "204": {} + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendGet.json new file mode 100644 index 0000000000..9c5659b2be --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendGet.json @@ -0,0 +1,25 @@ +{ + "title": "Get Frontend", + "operationId": "FrontendsInterface_Get", + "parameters": { + "api-version": "2024-05-01-preview", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "frontendName": "fe1" + }, + "responses": { + "200": { + "body": { + "name": "fe1", + "location": "NorthCentralUS", + "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", + "properties": { + "fqdn": "test.net", + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendPatch.json new file mode 100644 index 0000000000..28da65c447 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendPatch.json @@ -0,0 +1,26 @@ +{ + "title": "Update Frontend", + "operationId": "FrontendsInterface_Update", + "parameters": { + "api-version": "2024-05-01-preview", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "frontendName": "fe1", + "properties": {} + }, + "responses": { + "200": { + "body": { + "name": "fe1", + "location": "NorthCentralUS", + "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", + "properties": { + "fqdn": "test.net", + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendPut.json new file mode 100644 index 0000000000..4d389aab93 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendPut.json @@ -0,0 +1,41 @@ +{ + "title": "Put Frontend", + "operationId": "FrontendsInterface_CreateOrUpdate", + "parameters": { + "api-version": "2024-05-01-preview", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "frontendName": "fe1", + "resource": { + "location": "NorthCentralUS", + "properties": {} + } + }, + "responses": { + "200": { + "body": { + "name": "fe1", + "location": "NorthCentralUS", + "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", + "properties": { + "fqdn": "test.net", + "provisioningState": "Succeeded" + } + } + }, + "201": { + "body": { + "name": "fe1", + "location": "NorthCentralUS", + "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", + "properties": { + "fqdn": "test.net", + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendsGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendsGet.json new file mode 100644 index 0000000000..e6dcc4cf4a --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendsGet.json @@ -0,0 +1,28 @@ +{ + "title": "Get Frontends", + "operationId": "FrontendsInterface_ListByTrafficController", + "parameters": { + "api-version": "2024-05-01-preview", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "name": "fe1", + "location": "NorthCentralUS", + "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", + "properties": { + "fqdn": "test.net", + "provisioningState": "Succeeded" + } + } + ] + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/OperationsList.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/OperationsList.json new file mode 100644 index 0000000000..3f201f1622 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/OperationsList.json @@ -0,0 +1,26 @@ +{ + "title": "Get Operations List", + "operationId": "Operations_List", + "parameters": { + "api-version": "2024-05-01-preview" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "name": "Microsoft.ServiceNetworking/trafficControllers/read", + "isDataAction": false, + "display": { + "provider": "Microsoft Service Networking", + "resource": "Traffic Controller", + "operation": "Get Traffic Controller configuration", + "description": "Traffic Controller is a L7 Load Balancing solution for a Multi Cluster setup" + }, + "origin": "user,system" + } + ] + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPoliciesGetList.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPoliciesGetList.json new file mode 100644 index 0000000000..c1f973169e --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPoliciesGetList.json @@ -0,0 +1,31 @@ +{ + "title": "Get SecurityPolicies", + "operationId": "SecurityPoliciesInterface_ListByTrafficController", + "parameters": { + "api-version": "2024-05-01-preview", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "name": "waf-0", + "type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0", + "location": "eastus", + "properties": { + "policyType": "waf", + "wafPolicy": { + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" + }, + "provisioningState": "Succeeded" + } + } + ] + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyDelete.json new file mode 100644 index 0000000000..348aaea8e8 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyDelete.json @@ -0,0 +1,20 @@ +{ + "title": "Delete SecurityPolicy", + "operationId": "SecurityPoliciesInterface_Delete", + "parameters": { + "api-version": "2024-05-01-preview", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "securityPolicyName": "sp1" + }, + "responses": { + "202": { + "headers": { + "Retry-After": 3, + "location": "https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" + } + }, + "204": {} + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyGet.json new file mode 100644 index 0000000000..25ba7bc5d6 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyGet.json @@ -0,0 +1,28 @@ +{ + "title": "Get SecurityPolicy", + "operationId": "SecurityPoliciesInterface_Get", + "parameters": { + "api-version": "2024-05-01-preview", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "securityPolicyName": "sp1" + }, + "responses": { + "200": { + "body": { + "name": "waf-0", + "type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0", + "location": "eastus", + "properties": { + "policyType": "waf", + "wafPolicy": { + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" + }, + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyPatch.json new file mode 100644 index 0000000000..fbb8f7672c --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyPatch.json @@ -0,0 +1,35 @@ +{ + "title": "Update SecurityPolicy", + "operationId": "SecurityPoliciesInterface_Update", + "parameters": { + "api-version": "2024-05-01-preview", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "securityPolicyName": "sp1", + "properties": { + "properties": { + "wafPolicy": { + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" + } + } + } + }, + "responses": { + "200": { + "body": { + "name": "waf-0", + "type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0", + "location": "eastus", + "properties": { + "policyType": "waf", + "wafPolicy": { + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" + }, + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyPut.json new file mode 100644 index 0000000000..b28178d793 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyPut.json @@ -0,0 +1,51 @@ +{ + "title": "Put SecurityPolicy", + "operationId": "SecurityPoliciesInterface_CreateOrUpdate", + "parameters": { + "api-version": "2024-05-01-preview", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "securityPolicyName": "sp1", + "resource": { + "location": "NorthCentralUS", + "properties": { + "wafPolicy": { + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" + } + } + } + }, + "responses": { + "200": { + "body": { + "name": "waf-0", + "type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0", + "location": "eastus", + "properties": { + "policyType": "waf", + "wafPolicy": { + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" + }, + "provisioningState": "Succeeded" + } + } + }, + "201": { + "body": { + "name": "waf-0", + "type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0", + "location": "eastus", + "properties": { + "policyType": "waf", + "wafPolicy": { + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" + }, + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerDelete.json new file mode 100644 index 0000000000..3731d45552 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerDelete.json @@ -0,0 +1,19 @@ +{ + "title": "Delete Traffic Controller", + "operationId": "TrafficControllerInterface_Delete", + "parameters": { + "api-version": "2024-05-01-preview", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1" + }, + "responses": { + "202": { + "headers": { + "Retry-After": 3, + "location": "https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1" + } + }, + "204": {} + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerGet.json new file mode 100644 index 0000000000..be47be64ee --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerGet.json @@ -0,0 +1,39 @@ +{ + "operationId": "TrafficControllerInterface_Get", + "title": "Get Traffic Controller", + "parameters": { + "api-version": "2024-05-01-preview", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1" + }, + "responses": { + "200": { + "body": { + "name": "tc1", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", + "type": "Microsoft.ServiceNetworking/trafficControllers", + "location": "NorthCentralUS", + "tags": { + "key1": "value1" + }, + "properties": { + "configurationEndpoints": [ + "abc.trafficcontroller.azure.net" + ], + "frontends": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" + } + ], + "associations": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" + } + ], + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerPatch.json new file mode 100644 index 0000000000..7d0958ff0a --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerPatch.json @@ -0,0 +1,54 @@ +{ + "operationId": "TrafficControllerInterface_Update", + "title": "Patch Traffic Controller", + "parameters": { + "api-version": "2024-05-01-preview", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "properties": { + "tags": { + "key1": "value1" + } + } + }, + "responses": { + "200": { + "body": { + "name": "tc1", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", + "type": "Microsoft.ServiceNetworking/trafficControllers", + "location": "NorthCentralUS", + "tags": { + "key1": "value1" + }, + "properties": { + "configurationEndpoints": [ + "abc.trafficcontroller.azure.net" + ], + "frontends": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" + } + ], + "associations": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" + } + ], + "securityPolicies": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" + } + ], + "securityPolicyConfigurations": { + "wafSecurityPolicy": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/waf-0" + } + }, + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerPut.json new file mode 100644 index 0000000000..cec3b91344 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerPut.json @@ -0,0 +1,92 @@ +{ + "operationId": "TrafficControllerInterface_CreateOrUpdate", + "title": "Put Traffic Controller", + "parameters": { + "api-version": "2024-05-01-preview", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "resource": { + "location": "NorthCentralUS", + "tags": { + "key1": "value1" + } + } + }, + "responses": { + "200": { + "body": { + "name": "tc1", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", + "type": "Microsoft.ServiceNetworking/trafficControllers", + "location": "NorthCentralUS", + "tags": { + "key1": "value1" + }, + "properties": { + "configurationEndpoints": [ + "abc.trafficcontroller.azure.net" + ], + "frontends": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" + } + ], + "associations": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" + } + ], + "securityPolicies": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" + } + ], + "securityPolicyConfigurations": { + "wafSecurityPolicy": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/waf-0" + } + }, + "provisioningState": "Succeeded" + } + } + }, + "201": { + "body": { + "name": "tc1", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", + "type": "Microsoft.ServiceNetworking/trafficControllers", + "location": "NorthCentralUS", + "tags": { + "key1": "value1" + }, + "properties": { + "configurationEndpoints": [ + "abc.trafficcontroller.azure.net" + ], + "frontends": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" + } + ], + "associations": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" + } + ], + "securityPolicies": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" + } + ], + "securityPolicyConfigurations": { + "wafSecurityPolicy": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/waf-0" + } + }, + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllersGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllersGet.json new file mode 100644 index 0000000000..a144861b65 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllersGet.json @@ -0,0 +1,52 @@ +{ + "operationId": "TrafficControllerInterface_ListByResourceGroup", + "title": "Get Traffic Controllers", + "parameters": { + "api-version": "2024-05-01-preview", + "subscriptionId": "subid", + "resourceGroupName": "rg1" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "name": "tc1", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", + "type": "Microsoft.ServiceNetworking/trafficControllers", + "location": "NorthCentralUS", + "tags": { + "key1": "value1" + }, + "properties": { + "configurationEndpoints": [ + "abc.trafficcontroller.azure.net" + ], + "frontends": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" + } + ], + "associations": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" + } + ], + "securityPolicies": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" + } + ], + "securityPolicyConfigurations": { + "wafSecurityPolicy": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/waf-0" + } + }, + "provisioningState": "Succeeded" + } + } + ] + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllersGetList.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllersGetList.json new file mode 100644 index 0000000000..bb220e3f51 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllersGetList.json @@ -0,0 +1,51 @@ +{ + "operationId": "TrafficControllerInterface_ListBySubscription", + "title": "Get Traffic Controllers List", + "parameters": { + "api-version": "2024-05-01-preview", + "subscriptionId": "subid" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "name": "tc1", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", + "type": "Microsoft.ServiceNetworking/trafficControllers", + "location": "NorthCentralUS", + "tags": { + "key1": "value1" + }, + "properties": { + "configurationEndpoints": [ + "abc.trafficcontroller.azure.net" + ], + "frontends": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" + } + ], + "associations": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" + } + ], + "securityPolicies": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" + } + ], + "securityPolicyConfigurations": { + "wafSecurityPolicy": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/waf-0" + } + }, + "provisioningState": "Succeeded" + } + } + ] + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationDelete.json new file mode 100644 index 0000000000..903ca0eb16 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationDelete.json @@ -0,0 +1,20 @@ +{ + "title": "Delete Association", + "operationId": "AssociationsInterface_Delete", + "parameters": { + "api-version": "2025-01-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "associationName": "as1" + }, + "responses": { + "202": { + "headers": { + "Retry-After": 3, + "location": "https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1" + } + }, + "204": {} + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationGet.json new file mode 100644 index 0000000000..2e256d4104 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationGet.json @@ -0,0 +1,28 @@ +{ + "title": "Get Association", + "operationId": "AssociationsInterface_Get", + "parameters": { + "api-version": "2025-01-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "associationName": "as1" + }, + "responses": { + "200": { + "body": { + "name": "as1", + "type": "Microsoft.ServiceNetworking/trafficControllers/associations", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", + "location": "NorthCentralUS", + "properties": { + "associationType": "subnets", + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" + }, + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationPatch.json new file mode 100644 index 0000000000..1321971af3 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationPatch.json @@ -0,0 +1,35 @@ +{ + "title": "Update Association", + "operationId": "AssociationsInterface_Update", + "parameters": { + "api-version": "2025-01-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "associationName": "as1", + "properties": { + "properties": { + "associationType": "subnets", + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" + } + } + } + }, + "responses": { + "200": { + "body": { + "name": "as1", + "type": "Microsoft.ServiceNetworking/trafficControllers/associations", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", + "location": "NorthCentralUS", + "properties": { + "associationType": "subnets", + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" + } + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationPut.json new file mode 100644 index 0000000000..9e343dbdd2 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationPut.json @@ -0,0 +1,51 @@ +{ + "title": "Put Association", + "operationId": "AssociationsInterface_CreateOrUpdate", + "parameters": { + "api-version": "2025-01-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "associationName": "as1", + "resource": { + "location": "NorthCentralUS", + "properties": { + "associationType": "subnets", + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" + } + } + } + }, + "responses": { + "200": { + "body": { + "name": "associatedvnet-1", + "type": "Microsoft.ServiceNetworking/trafficControllers/associations", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", + "location": "NorthCentralUS", + "properties": { + "associationType": "subnets", + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" + }, + "provisioningState": "Accepted" + } + } + }, + "201": { + "body": { + "name": "associatedvnet-1", + "type": "Microsoft.ServiceNetworking/trafficControllers/associations", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", + "location": "NorthCentralUS", + "properties": { + "associationType": "subnets", + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" + } + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationsGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationsGet.json new file mode 100644 index 0000000000..e25d8de456 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationsGet.json @@ -0,0 +1,31 @@ +{ + "title": "Get Associations", + "operationId": "AssociationsInterface_ListByTrafficController", + "parameters": { + "api-version": "2025-01-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "name": "as1", + "type": "Microsoft.ServiceNetworking/trafficControllers/associations", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", + "location": "NorthCentralUS", + "properties": { + "associationType": "subnets", + "subnet": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" + }, + "provisioningState": "Succeeded" + } + } + ] + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendDelete.json new file mode 100644 index 0000000000..974efa94e9 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendDelete.json @@ -0,0 +1,20 @@ +{ + "title": "Delete Frontend", + "operationId": "FrontendsInterface_Delete", + "parameters": { + "api-version": "2025-01-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "frontendName": "fe1" + }, + "responses": { + "202": { + "headers": { + "Retry-After": 3, + "location": "https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" + } + }, + "204": {} + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendGet.json new file mode 100644 index 0000000000..fda822179e --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendGet.json @@ -0,0 +1,25 @@ +{ + "title": "Get Frontend", + "operationId": "FrontendsInterface_Get", + "parameters": { + "api-version": "2025-01-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "frontendName": "fe1" + }, + "responses": { + "200": { + "body": { + "name": "fe1", + "location": "NorthCentralUS", + "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", + "properties": { + "fqdn": "test.net", + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendPatch.json new file mode 100644 index 0000000000..fcb044dc7a --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendPatch.json @@ -0,0 +1,26 @@ +{ + "title": "Update Frontend", + "operationId": "FrontendsInterface_Update", + "parameters": { + "api-version": "2025-01-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "frontendName": "fe1", + "properties": {} + }, + "responses": { + "200": { + "body": { + "name": "fe1", + "location": "NorthCentralUS", + "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", + "properties": { + "fqdn": "test.net", + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendPut.json new file mode 100644 index 0000000000..f0295d22f8 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendPut.json @@ -0,0 +1,41 @@ +{ + "title": "Put Frontend", + "operationId": "FrontendsInterface_CreateOrUpdate", + "parameters": { + "api-version": "2025-01-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "frontendName": "fe1", + "resource": { + "location": "NorthCentralUS", + "properties": {} + } + }, + "responses": { + "200": { + "body": { + "name": "fe1", + "location": "NorthCentralUS", + "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", + "properties": { + "fqdn": "test.net", + "provisioningState": "Succeeded" + } + } + }, + "201": { + "body": { + "name": "fe1", + "location": "NorthCentralUS", + "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", + "properties": { + "fqdn": "test.net", + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendsGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendsGet.json new file mode 100644 index 0000000000..ddf66203e7 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendsGet.json @@ -0,0 +1,28 @@ +{ + "title": "Get Frontends", + "operationId": "FrontendsInterface_ListByTrafficController", + "parameters": { + "api-version": "2025-01-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "name": "fe1", + "location": "NorthCentralUS", + "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", + "properties": { + "fqdn": "test.net", + "provisioningState": "Succeeded" + } + } + ] + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/OperationsList.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/OperationsList.json new file mode 100644 index 0000000000..a67a7fd6f1 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/OperationsList.json @@ -0,0 +1,26 @@ +{ + "title": "Get Operations List", + "operationId": "Operations_List", + "parameters": { + "api-version": "2025-01-01" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "name": "Microsoft.ServiceNetworking/trafficControllers/read", + "isDataAction": false, + "display": { + "provider": "Microsoft Service Networking", + "resource": "Traffic Controller", + "operation": "Get Traffic Controller configuration", + "description": "Traffic Controller is a L7 Load Balancing solution for a Multi Cluster setup" + }, + "origin": "user,system" + } + ] + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPoliciesGetList.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPoliciesGetList.json new file mode 100644 index 0000000000..a4b712e4f3 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPoliciesGetList.json @@ -0,0 +1,31 @@ +{ + "title": "Get SecurityPolicies", + "operationId": "SecurityPoliciesInterface_ListByTrafficController", + "parameters": { + "api-version": "2025-01-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "name": "waf-0", + "type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0", + "location": "eastus", + "properties": { + "policyType": "waf", + "wafPolicy": { + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" + }, + "provisioningState": "Succeeded" + } + } + ] + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyDelete.json new file mode 100644 index 0000000000..e97ee911b7 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyDelete.json @@ -0,0 +1,20 @@ +{ + "title": "Delete SecurityPolicy", + "operationId": "SecurityPoliciesInterface_Delete", + "parameters": { + "api-version": "2025-01-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "securityPolicyName": "sp1" + }, + "responses": { + "202": { + "headers": { + "Retry-After": 3, + "location": "https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" + } + }, + "204": {} + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyGet.json new file mode 100644 index 0000000000..12ce5ca159 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyGet.json @@ -0,0 +1,28 @@ +{ + "title": "Get SecurityPolicy", + "operationId": "SecurityPoliciesInterface_Get", + "parameters": { + "api-version": "2025-01-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "securityPolicyName": "sp1" + }, + "responses": { + "200": { + "body": { + "name": "waf-0", + "type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0", + "location": "eastus", + "properties": { + "policyType": "waf", + "wafPolicy": { + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" + }, + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyPatch.json new file mode 100644 index 0000000000..7101b7543b --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyPatch.json @@ -0,0 +1,35 @@ +{ + "title": "Update SecurityPolicy", + "operationId": "SecurityPoliciesInterface_Update", + "parameters": { + "api-version": "2025-01-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "securityPolicyName": "sp1", + "properties": { + "properties": { + "wafPolicy": { + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" + } + } + } + }, + "responses": { + "200": { + "body": { + "name": "waf-0", + "type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0", + "location": "eastus", + "properties": { + "policyType": "waf", + "wafPolicy": { + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" + }, + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyPut.json new file mode 100644 index 0000000000..5364abfc44 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyPut.json @@ -0,0 +1,51 @@ +{ + "title": "Put SecurityPolicy", + "operationId": "SecurityPoliciesInterface_CreateOrUpdate", + "parameters": { + "api-version": "2025-01-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "securityPolicyName": "sp1", + "resource": { + "location": "NorthCentralUS", + "properties": { + "wafPolicy": { + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" + } + } + } + }, + "responses": { + "200": { + "body": { + "name": "waf-0", + "type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0", + "location": "eastus", + "properties": { + "policyType": "waf", + "wafPolicy": { + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" + }, + "provisioningState": "Succeeded" + } + } + }, + "201": { + "body": { + "name": "waf-0", + "type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies", + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0", + "location": "eastus", + "properties": { + "policyType": "waf", + "wafPolicy": { + "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" + }, + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerDelete.json new file mode 100644 index 0000000000..3be324a912 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerDelete.json @@ -0,0 +1,19 @@ +{ + "title": "Delete Traffic Controller", + "operationId": "TrafficControllerInterface_Delete", + "parameters": { + "api-version": "2025-01-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1" + }, + "responses": { + "202": { + "headers": { + "Retry-After": 3, + "location": "https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1" + } + }, + "204": {} + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerGet.json new file mode 100644 index 0000000000..52b5b6859f --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerGet.json @@ -0,0 +1,39 @@ +{ + "operationId": "TrafficControllerInterface_Get", + "title": "Get Traffic Controller", + "parameters": { + "api-version": "2025-01-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1" + }, + "responses": { + "200": { + "body": { + "name": "tc1", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", + "type": "Microsoft.ServiceNetworking/trafficControllers", + "location": "NorthCentralUS", + "tags": { + "key1": "value1" + }, + "properties": { + "configurationEndpoints": [ + "abc.trafficcontroller.azure.net" + ], + "frontends": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" + } + ], + "associations": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" + } + ], + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerPatch.json new file mode 100644 index 0000000000..2e4c2850c6 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerPatch.json @@ -0,0 +1,54 @@ +{ + "operationId": "TrafficControllerInterface_Update", + "title": "Patch Traffic Controller", + "parameters": { + "api-version": "2025-01-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "properties": { + "tags": { + "key1": "value1" + } + } + }, + "responses": { + "200": { + "body": { + "name": "tc1", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", + "type": "Microsoft.ServiceNetworking/trafficControllers", + "location": "NorthCentralUS", + "tags": { + "key1": "value1" + }, + "properties": { + "configurationEndpoints": [ + "abc.trafficcontroller.azure.net" + ], + "frontends": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" + } + ], + "associations": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" + } + ], + "securityPolicies": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" + } + ], + "securityPolicyConfigurations": { + "wafSecurityPolicy": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/waf-0" + } + }, + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerPut.json new file mode 100644 index 0000000000..83a824f6a8 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerPut.json @@ -0,0 +1,92 @@ +{ + "operationId": "TrafficControllerInterface_CreateOrUpdate", + "title": "Put Traffic Controller", + "parameters": { + "api-version": "2025-01-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1", + "trafficControllerName": "tc1", + "resource": { + "location": "NorthCentralUS", + "tags": { + "key1": "value1" + } + } + }, + "responses": { + "200": { + "body": { + "name": "tc1", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", + "type": "Microsoft.ServiceNetworking/trafficControllers", + "location": "NorthCentralUS", + "tags": { + "key1": "value1" + }, + "properties": { + "configurationEndpoints": [ + "abc.trafficcontroller.azure.net" + ], + "frontends": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" + } + ], + "associations": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" + } + ], + "securityPolicies": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" + } + ], + "securityPolicyConfigurations": { + "wafSecurityPolicy": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/waf-0" + } + }, + "provisioningState": "Succeeded" + } + } + }, + "201": { + "body": { + "name": "tc1", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", + "type": "Microsoft.ServiceNetworking/trafficControllers", + "location": "NorthCentralUS", + "tags": { + "key1": "value1" + }, + "properties": { + "configurationEndpoints": [ + "abc.trafficcontroller.azure.net" + ], + "frontends": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" + } + ], + "associations": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" + } + ], + "securityPolicies": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" + } + ], + "securityPolicyConfigurations": { + "wafSecurityPolicy": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/waf-0" + } + }, + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllersGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllersGet.json new file mode 100644 index 0000000000..f06dcbc2cb --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllersGet.json @@ -0,0 +1,52 @@ +{ + "operationId": "TrafficControllerInterface_ListByResourceGroup", + "title": "Get Traffic Controllers", + "parameters": { + "api-version": "2025-01-01", + "subscriptionId": "subid", + "resourceGroupName": "rg1" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "name": "tc1", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", + "type": "Microsoft.ServiceNetworking/trafficControllers", + "location": "NorthCentralUS", + "tags": { + "key1": "value1" + }, + "properties": { + "configurationEndpoints": [ + "abc.trafficcontroller.azure.net" + ], + "frontends": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" + } + ], + "associations": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" + } + ], + "securityPolicies": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" + } + ], + "securityPolicyConfigurations": { + "wafSecurityPolicy": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/waf-0" + } + }, + "provisioningState": "Succeeded" + } + } + ] + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllersGetList.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllersGetList.json new file mode 100644 index 0000000000..568692609f --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllersGetList.json @@ -0,0 +1,51 @@ +{ + "operationId": "TrafficControllerInterface_ListBySubscription", + "title": "Get Traffic Controllers List", + "parameters": { + "api-version": "2025-01-01", + "subscriptionId": "subid" + }, + "responses": { + "200": { + "body": { + "value": [ + { + "name": "tc1", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", + "type": "Microsoft.ServiceNetworking/trafficControllers", + "location": "NorthCentralUS", + "tags": { + "key1": "value1" + }, + "properties": { + "configurationEndpoints": [ + "abc.trafficcontroller.azure.net" + ], + "frontends": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" + } + ], + "associations": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" + } + ], + "securityPolicies": [ + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" + } + ], + "securityPolicyConfigurations": { + "wafSecurityPolicy": { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/waf-0" + } + }, + "provisioningState": "Succeeded" + } + } + ] + } + } + } +} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/main.tsp b/packages/typespec-test/test/ServiceNetworking.Management/spec/main.tsp new file mode 100644 index 0000000000..1d358a7928 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/main.tsp @@ -0,0 +1,328 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; + +/** Traffic Controller Provider management API. */ +@armProviderNamespace +@armCommonTypesVersion("v3") +@service({ + title: "TrafficController", +}) +@versioned(Versions) +namespace Microsoft.ServiceNetworking; + +/** Api versions */ +enum Versions { + /** 2023-11-01 stable version */ + v2023_11_01: "2023-11-01", + + /** 2024-05-01 preview version */ + @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + v2024_05_01_preview: "2024-05-01-preview", + + /** 2025-01-01 stable version */ + v2025_05_01: "2025-01-01", +} + +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Azure.Core; +using Azure.ResourceManager; + +//----------------------- Frontends ----------------------- +/** Frontend Sub Resource of Traffic Controller. */ +@parentResource(TrafficController) +model Frontend is TrackedResource { + /** Frontends */ + @key("frontendName") + @visibility("read") + @path + @segment("frontends") + @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") + name: string; +} + +/** Frontend Properties. */ +model FrontendProperties { + /** The Fully Qualified Domain Name of the DNS record associated to a Traffic Controller frontend. */ + @visibility("read") + fqdn?: string; + + /** Provisioning State of Traffic Controller Frontend Resource */ + @visibility("read") + provisioningState?: ProvisioningState; +} + +//----------------------- Associations ----------------------- +/** Association Subresource of Traffic Controller */ +@parentResource(TrafficController) +model Association is TrackedResource { + /** Name of Association */ + @key("associationName") + @visibility("read") + @path + @segment("associations") + @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") + name: string; +} + +/** The type used for update operations of the Association. */ +model AssociationUpdate { + /** Resource tags. */ + tags?: TrackedResource.tags; + + /** The resource-specific properties for this resource. */ + #suppress "@azure-tools/typespec-azure-core/no-private-usage" + @Azure.ResourceManager.Private.conditionalClientFlatten + properties?: AssociationUpdateProperties; +} + +/** The updatable properties of the Association. */ +model AssociationUpdateProperties { + /** Association Type */ + associationType?: AssociationType; + + /** Association Subnet */ + subnet?: AssociationSubnetUpdate; +} + +/** Association Subnet. */ +model AssociationSubnetUpdate { + /** Association ID. */ + id: string; +} + +/** Association Properties. */ +model AssociationProperties { + /** Association Type */ + associationType: AssociationType; + + /** Association Subnet */ + subnet?: AssociationSubnet; + + /** Provisioning State of Traffic Controller Association Resource */ + @visibility("read") + provisioningState?: ProvisioningState; +} + +/** Association Type Enum */ +union AssociationType { + string, + + /** Association of Type Subnet */ + "subnets", +} + +/** Association Subnet. */ +model AssociationSubnet { + /** Association ID. */ + id: string; +} +//----------------------- SecurityPolicy ----------------------- +/** SecurityPolicy Subresource of Traffic Controller. */ +@parentResource(TrafficController) +model SecurityPolicy is TrackedResource { + /** SecurityPolicy */ + @key("securityPolicyName") + @visibility("read") + @path + @segment("securityPolicies") + @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") + name: string; +} + +/** SecurityPolicy Properties. */ +model SecurityPolicyProperties { + /** Type of the Traffic Controller Security Policy */ + @visibility("read") + policyType?: PolicyType; + + /** Web Application Firewall Policy of the Traffic Controller Security Policy */ + wafPolicy?: WafPolicy; + + /** Provisioning State of Traffic Controller SecurityPolicy Resource */ + @visibility("read") + provisioningState?: ProvisioningState; +} + +/** Policy Type of the Security Policy */ +union PolicyType { + string, + + /** Policy of Type WAF */ + WAF: "waf", +} + +/** Web Application Firewall Policy */ +model WafPolicy { + /** Resource ID of the WAF */ + id: string; +} + +/** SecurityPolicyConfigurations Subresource of Traffic Controller. */ +@parentResource(TrafficController) +model SecurityPolicyConfigurations { + /** Contains reference to a WAF-type security policy that is applied at the Traffic Controller level. */ + wafSecurityPolicy?: WafSecurityPolicy; +} + +/** Web Application Firewall Security Policy */ +model WafSecurityPolicy { + /** Resource ID of the Waf Security Policy */ + id: string; +} + +//----------------------- Traffic Controller ----------------------- +@resource("trafficControllers") +model TrafficController is TrackedResource { + /** traffic controller name for path */ + @key("trafficControllerName") + @path + @segment("trafficControllers") + @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") + name: string; +} + +/** Traffic Controller Properties. */ +model TrafficControllerProperties { + /** Configuration Endpoints. */ + @visibility("read") + configurationEndpoints?: string[]; + + /** Frontends References List */ + @visibility("read") + frontends?: ResourceId[]; + + /** Associations References List */ + @visibility("read") + associations?: ResourceId[]; + + /** Security Policies References List */ + @visibility("read") + @added(Versions.v2024_05_01_preview) + securityPolicies?: ResourceId[]; + + /** Security Policy Configuration */ + @added(Versions.v2024_05_01_preview) + @OpenAPI.extension("x-ms-identifiers", []) + securityPolicyConfigurations?: SecurityPolicyConfigurations; + + /** The status of the last operation. */ + @visibility("read") + provisioningState?: ProvisioningState; +} + +/** Resource Provisioning State Enum */ +@lroStatus +union ProvisioningState { + string, + + /** Resource in Provisioning State */ + Provisioning: "Provisioning", + + /** Resource in Updating State */ + Updating: "Updating", + + /** Resource in Deleting State */ + Deleting: "Deleting", + + /** Resource in Accepted State */ + Accepted: "Accepted", + + /** Resource in Succeeded State */ + Succeeded: "Succeeded", + + /** Resource in Failed State */ + Failed: "Failed", + + /** Resource in Canceled State */ + Canceled: "Canceled", +} + +/** Resource ID definition used by parent to reference child resources. */ +model ResourceId { + /** Resource ID of child resource. */ + id: string; +} + +//----------------------- Paths ----------------------- +@armResourceOperations +interface AssociationsInterface { + get is ArmResourceRead; + #suppress "@azure-tools/typespec-azure-core/invalid-final-state" "MUST CHANGE ON NEXT UPDATE" + @Azure.Core.useFinalStateVia("azure-async-operation") + createOrUpdate is ArmResourceCreateOrReplaceAsync< + Association, + LroHeaders = Azure.Core.Foundations.RetryAfterHeader + >; + update is ArmCustomPatchSync; + delete is ArmResourceDeleteWithoutOkAsync; + listByTrafficController is ArmResourceListByParent; +} + +@armResourceOperations +interface FrontendsInterface { + get is ArmResourceRead; + #suppress "@azure-tools/typespec-azure-core/invalid-final-state" "MUST CHANGE ON NEXT UPDATE" + @Azure.Core.useFinalStateVia("azure-async-operation") + createOrUpdate is ArmResourceCreateOrReplaceAsync< + Frontend, + LroHeaders = Azure.Core.Foundations.RetryAfterHeader + >; + update is ArmCustomPatchSync< + Frontend, + Azure.ResourceManager.Foundations.ResourceUpdateModel< + Frontend, + FrontendProperties + > + >; + delete is ArmResourceDeleteWithoutOkAsync; + listByTrafficController is ArmResourceListByParent; +} + +@added(Versions.v2024_05_01_preview) +@armResourceOperations +interface SecurityPoliciesInterface { + get is ArmResourceRead; + #suppress "@azure-tools/typespec-azure-core/invalid-final-state" "MUST CHANGE ON NEXT UPDATE" + @Azure.Core.useFinalStateVia("azure-async-operation") + createOrUpdate is ArmResourceCreateOrReplaceAsync< + SecurityPolicy, + LroHeaders = Azure.Core.Foundations.RetryAfterHeader + >; + update is ArmCustomPatchSync< + SecurityPolicy, + Azure.ResourceManager.Foundations.ResourceUpdateModel< + SecurityPolicy, + SecurityPolicyProperties + > + >; + delete is ArmResourceDeleteWithoutOkAsync; + listByTrafficController is ArmResourceListByParent; +} + +@armResourceOperations +interface TrafficControllerInterface { + get is ArmResourceRead; + #suppress "@azure-tools/typespec-azure-core/invalid-final-state" "MUST CHANGE ON NEXT UPDATE" + @Azure.Core.useFinalStateVia("azure-async-operation") + createOrUpdate is ArmResourceCreateOrReplaceAsync< + TrafficController, + LroHeaders = Azure.Core.Foundations.RetryAfterHeader + >; + update is ArmCustomPatchSync< + TrafficController, + Azure.ResourceManager.Foundations.ResourceUpdateModel< + TrafficController, + TrafficControllerProperties + > + >; + delete is ArmResourceDeleteWithoutOkAsync; + listByResourceGroup is ArmResourceListByParent; + listBySubscription is ArmListBySubscription; +} + +interface Operations extends Azure.ResourceManager.Operations {} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/sdk-suppressions.yaml b/packages/typespec-test/test/ServiceNetworking.Management/spec/sdk-suppressions.yaml new file mode 100644 index 0000000000..2bfe216067 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/spec/sdk-suppressions.yaml @@ -0,0 +1,32 @@ +suppressions: + azure-sdk-for-js: + - package: "@azure/arm-servicenetworking" + breaking-changes: + - Enum KnownAssociationType no longer has value Subnets + - Enum KnownOrigin no longer has value System + - Enum KnownOrigin no longer has value User + - Enum KnownOrigin no longer has value UserSystem + - Interface AssociationsInterfaceCreateOrUpdateOptionalParams no longer has parameter resumeFrom + - Interface AssociationsInterfaceDeleteOptionalParams no longer has parameter resumeFrom + - Interface FrontendsInterfaceCreateOrUpdateOptionalParams no longer has parameter resumeFrom + - Interface FrontendsInterfaceDeleteOptionalParams no longer has parameter resumeFrom + - Interface TrafficControllerInterfaceCreateOrUpdateOptionalParams no longer has parameter resumeFrom + - Interface TrafficControllerInterfaceDeleteOptionalParams no longer has parameter resumeFrom + - Removed function getContinuationToken + - Removed operation AssociationsInterface.beginCreateOrUpdate + - Removed operation AssociationsInterface.beginCreateOrUpdateAndWait + - Removed operation AssociationsInterface.beginDelete + - Removed operation AssociationsInterface.beginDeleteAndWait + - Removed operation FrontendsInterface.beginCreateOrUpdate + - Removed operation FrontendsInterface.beginCreateOrUpdateAndWait + - Removed operation FrontendsInterface.beginDelete + - Removed operation FrontendsInterface.beginDeleteAndWait + - Removed operation TrafficControllerInterface.beginCreateOrUpdate + - Removed operation TrafficControllerInterface.beginCreateOrUpdateAndWait + - Removed operation TrafficControllerInterface.beginDelete + - Removed operation TrafficControllerInterface.beginDeleteAndWait + - Type of parameter subnet of interface AssociationUpdateProperties is changed from AssociationSubnetUpdate to AssociationSubnet + - "Type of parameter tags of interface AssociationUpdate is changed from {\n [propertyName: string]: string;\n } to Record" + - "Type of parameter tags of interface FrontendUpdate is changed from {\n [propertyName: string]: string;\n } to Record" + - "Type of parameter tags of interface TrackedResource is changed from {\n [propertyName: string]: string;\n } to Record" + - "Type of parameter tags of interface TrafficControllerUpdate is changed from {\n [propertyName: string]: string;\n } to Record" diff --git a/packages/typespec-test/test/ServiceNetworking.Management/tspconfig.yaml b/packages/typespec-test/test/ServiceNetworking.Management/tspconfig.yaml new file mode 100644 index 0000000000..511fcfb8c9 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/tspconfig.yaml @@ -0,0 +1,13 @@ +emit: ["@azure-tools/typespec-ts"] +options: + "@azure-tools/typespec-ts": + examples-directory: "{project-root}/spec/examples" + generateMetadata: true + generateTest: true + generateSample: true + azureSdkForJs: false + hierarchyClient: false + experimentalExtensibleEnums: true + "emitter-output-dir": "{project-root}/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking" + packageDetails: + name: "@azure/arm-servicenetworking" From e7a25d958cdb09c6a80ca783ce3c9c35a81a8280 Mon Sep 17 00:00:00 2001 From: Qiaoqiao Zhang Date: Wed, 12 Feb 2025 14:58:01 +0800 Subject: [PATCH 2/9] fix sample generation for hierarchy info --- .../arm-servicenetworking/LICENSE | 6 +- .../arm-servicenetworking/eslint.config.mjs | 2 - .../arm-servicenetworking/package.json | 77 ++- .../review/arm-servicenetworking.api.md | 444 ++++++++++++++++++ ...sociationsInterfaceCreateOrUpdateSample.ts | 29 +- ...erfaceAssociationsInterfaceDeleteSample.ts | 10 +- ...InterfaceAssociationsInterfaceGetSample.ts | 10 +- ...sInterfaceListByTrafficControllerSample.ts | 6 +- ...erfaceAssociationsInterfaceUpdateSample.ts | 27 +- ...eFrontendsInterfaceCreateOrUpdateSample.ts | 17 +- ...InterfaceFrontendsInterfaceDeleteSample.ts | 10 +- ...ndsInterfaceFrontendsInterfaceGetSample.ts | 10 +- ...sInterfaceListByTrafficControllerSample.ts | 6 +- ...InterfaceFrontendsInterfaceUpdateSample.ts | 6 +- .../operationsOperationsListSample.ts | 6 +- ...tyPoliciesInterfaceCreateOrUpdateSample.ts | 27 +- ...ceSecurityPoliciesInterfaceDeleteSample.ts | 10 +- ...rfaceSecurityPoliciesInterfaceGetSample.ts | 15 +- ...sInterfaceListByTrafficControllerSample.ts | 6 +- ...ceSecurityPoliciesInterfaceUpdateSample.ts | 25 +- ...ControllerInterfaceCreateOrUpdateSample.ts | 15 +- ...eTrafficControllerInterfaceDeleteSample.ts | 9 +- ...faceTrafficControllerInterfaceGetSample.ts | 10 +- ...ollerInterfaceListByResourceGroupSample.ts | 6 +- ...rollerInterfaceListBySubscriptionSample.ts | 6 +- ...eTrafficControllerInterfaceUpdateSample.ts | 13 +- .../typespec-ts/src/modular/emitSamples.ts | 45 +- 27 files changed, 656 insertions(+), 197 deletions(-) create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/review/arm-servicenetworking.api.md diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/LICENSE b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/LICENSE index 2ad4de7b17..63447fd8bb 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/LICENSE +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/LICENSE @@ -1,6 +1,6 @@ -The MIT License (MIT) +Copyright (c) Microsoft Corporation. -Copyright (c) 2025 Microsoft +MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -12,7 +12,7 @@ furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/eslint.config.mjs b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/eslint.config.mjs index ac1c3c967e..9396819633 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/eslint.config.mjs +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/eslint.config.mjs @@ -4,10 +4,8 @@ export default azsdkEslint.config([ { rules: { "@azure/azure-sdk/ts-modules-only-named": "warn", - "@azure/azure-sdk/ts-apiextractor-json-types": "warn", "@azure/azure-sdk/ts-package-json-types": "warn", "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", - "@azure/azure-sdk/ts-package-json-module": "off", "@azure/azure-sdk/ts-package-json-files-required": "off", "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", "tsdoc/syntax": "warn" diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/package.json b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/package.json index ea6cf25a15..b34d814488 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/package.json +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/package.json @@ -13,15 +13,34 @@ ".": "./src/index.ts", "./models": "./src/models/index.ts" }, - "dialects": ["esm", "commonjs"], - "esmDialects": ["browser", "react-native"], + "dialects": [ + "esm", + "commonjs" + ], + "esmDialects": [ + "browser", + "react-native" + ], "selfLink": false }, "type": "module", - "keywords": ["node", "azure", "cloud", "typescript", "browser", "isomorphic"], + "keywords": [ + "node", + "azure", + "cloud", + "typescript", + "browser", + "isomorphic" + ], "author": "Microsoft Corporation", "license": "MIT", - "files": ["dist", "README.md", "LICENSE", "review/*", "CHANGELOG.md"], + "files": [ + "dist", + "README.md", + "LICENSE", + "review/*", + "CHANGELOG.md" + ], "dependencies": { "@azure/core-util": "^1.9.2", "@azure-rest/core-client": "^2.3.1", @@ -40,10 +59,10 @@ "typescript": "~5.6.2", "tshy": "^2.0.0", "@azure/identity": "^4.2.1", - "@vitest/browser": "^2.0.5", - "@vitest/coverage-istanbul": "^2.0.5", + "@vitest/browser": "^3.0.3", + "@vitest/coverage-istanbul": "^3.0.3", "playwright": "^1.41.2", - "vitest": "^2.0.5", + "vitest": "^3.0.3", "@azure-tools/test-credential": "^2.0.0", "@azure-tools/test-recorder": "^4.0.0", "rimraf": "^5.0.5", @@ -65,5 +84,47 @@ "test:node": "npm run clean && tshy && npm run unit-test:node && npm run integration-test:node", "test": "npm run clean && tshy && npm run unit-test:node && npm run unit-test:browser && npm run integration-test", "build": "npm run clean && tshy && npm run extract-api" - } + }, + "exports": { + "./package.json": "./package.json", + ".": { + "browser": { + "types": "./dist/browser/index.d.ts", + "default": "./dist/browser/index.js" + }, + "react-native": { + "types": "./dist/react-native/index.d.ts", + "default": "./dist/react-native/index.js" + }, + "import": { + "types": "./dist/esm/index.d.ts", + "default": "./dist/esm/index.js" + }, + "require": { + "types": "./dist/commonjs/index.d.ts", + "default": "./dist/commonjs/index.js" + } + }, + "./models": { + "browser": { + "types": "./dist/browser/models/index.d.ts", + "default": "./dist/browser/models/index.js" + }, + "react-native": { + "types": "./dist/react-native/models/index.d.ts", + "default": "./dist/react-native/models/index.js" + }, + "import": { + "types": "./dist/esm/models/index.d.ts", + "default": "./dist/esm/models/index.js" + }, + "require": { + "types": "./dist/commonjs/models/index.d.ts", + "default": "./dist/commonjs/models/index.js" + } + } + }, + "main": "./dist/commonjs/index.js", + "types": "./dist/commonjs/index.d.ts", + "module": "./dist/esm/index.js" } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/review/arm-servicenetworking.api.md b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/review/arm-servicenetworking.api.md new file mode 100644 index 0000000000..a001065078 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/review/arm-servicenetworking.api.md @@ -0,0 +1,444 @@ +## API Report File for "@azure/arm-servicenetworking" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { AbortSignalLike } from '@azure/abort-controller'; +import { ClientOptions } from '@azure-rest/core-client'; +import { OperationOptions } from '@azure-rest/core-client'; +import { OperationState } from '@azure/core-lro'; +import { PathUncheckedResponse } from '@azure-rest/core-client'; +import { Pipeline } from '@azure/core-rest-pipeline'; +import { PollerLike } from '@azure/core-lro'; +import { TokenCredential } from '@azure/core-auth'; + +// @public +export type ActionType = string; + +// @public +export interface Association extends TrackedResource { + properties?: AssociationProperties; +} + +// @public +export interface AssociationProperties { + associationType: AssociationType; + readonly provisioningState?: ProvisioningState; + subnet?: AssociationSubnet; +} + +// @public +export interface AssociationsInterfaceCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface AssociationsInterfaceDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface AssociationsInterfaceGetOptionalParams extends OperationOptions { +} + +// @public +export interface AssociationsInterfaceListByTrafficControllerOptionalParams extends OperationOptions { +} + +// @public +export interface AssociationsInterfaceOperations { + createOrUpdate: (resourceGroupName: string, trafficControllerName: string, associationName: string, resource: Association, options?: AssociationsInterfaceCreateOrUpdateOptionalParams) => PollerLike, Association>; + delete: (resourceGroupName: string, trafficControllerName: string, associationName: string, options?: AssociationsInterfaceDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, trafficControllerName: string, associationName: string, options?: AssociationsInterfaceGetOptionalParams) => Promise; + listByTrafficController: (resourceGroupName: string, trafficControllerName: string, options?: AssociationsInterfaceListByTrafficControllerOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, trafficControllerName: string, associationName: string, properties: AssociationUpdate, options?: AssociationsInterfaceUpdateOptionalParams) => Promise; +} + +// @public +export interface AssociationsInterfaceUpdateOptionalParams extends OperationOptions { +} + +// @public +export interface AssociationSubnet { + id: string; +} + +// @public +export interface AssociationSubnetUpdate { + id: string; +} + +// @public +export type AssociationType = string; + +// @public +export interface AssociationUpdate { + properties?: AssociationUpdateProperties; + tags?: Record; +} + +// @public +export interface AssociationUpdateProperties { + associationType?: AssociationType; + subnet?: AssociationSubnetUpdate; +} + +// @public +export type ContinuablePage = TPage & { + continuationToken?: string; +}; + +// @public +export type CreatedByType = string; + +// @public +export interface ErrorAdditionalInfo { + readonly info?: Record; + readonly type?: string; +} + +// @public +export interface ErrorDetail { + readonly additionalInfo?: ErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: ErrorDetail[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetail; +} + +// @public +export interface Frontend extends TrackedResource { + properties?: FrontendProperties; +} + +// @public +export interface FrontendProperties { + readonly fqdn?: string; + readonly provisioningState?: ProvisioningState; +} + +// @public +export interface FrontendsInterfaceCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface FrontendsInterfaceDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface FrontendsInterfaceGetOptionalParams extends OperationOptions { +} + +// @public +export interface FrontendsInterfaceListByTrafficControllerOptionalParams extends OperationOptions { +} + +// @public +export interface FrontendsInterfaceOperations { + createOrUpdate: (resourceGroupName: string, trafficControllerName: string, frontendName: string, resource: Frontend, options?: FrontendsInterfaceCreateOrUpdateOptionalParams) => PollerLike, Frontend>; + delete: (resourceGroupName: string, trafficControllerName: string, frontendName: string, options?: FrontendsInterfaceDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, trafficControllerName: string, frontendName: string, options?: FrontendsInterfaceGetOptionalParams) => Promise; + listByTrafficController: (resourceGroupName: string, trafficControllerName: string, options?: FrontendsInterfaceListByTrafficControllerOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, trafficControllerName: string, frontendName: string, properties: FrontendUpdate, options?: FrontendsInterfaceUpdateOptionalParams) => Promise; +} + +// @public +export interface FrontendsInterfaceUpdateOptionalParams extends OperationOptions { +} + +// @public +export interface FrontendUpdate { + tags?: Record; +} + +// @public +export enum KnownActionType { + Internal = "Internal" +} + +// @public +export enum KnownAssociationType { + subnets = "subnets" +} + +// @public +export enum KnownCreatedByType { + Application = "Application", + Key = "Key", + ManagedIdentity = "ManagedIdentity", + User = "User" +} + +// @public +export enum KnownOrigin { + "user,system" = "user,system", + system = "system", + user = "user" +} + +// @public +export enum KnownPolicyType { + WAF = "waf" +} + +// @public +export enum KnownProvisioningState { + Accepted = "Accepted", + Canceled = "Canceled", + Deleting = "Deleting", + Failed = "Failed", + Provisioning = "Provisioning", + Succeeded = "Succeeded", + Updating = "Updating" +} + +// @public +export enum KnownVersions { + v2023_11_01 = "2023-11-01", + v2025_05_01 = "2025-01-01" +} + +// @public +export interface Operation { + readonly actionType?: ActionType; + display?: OperationDisplay; + readonly isDataAction?: boolean; + readonly name?: string; + readonly origin?: Origin; +} + +// @public +export interface OperationDisplay { + readonly description?: string; + readonly operation?: string; + readonly provider?: string; + readonly resource?: string; +} + +// @public +export interface OperationsListOptionalParams extends OperationOptions { +} + +// @public +export interface OperationsOperations { + list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; +} + +// @public +export type Origin = string; + +// @public +export interface PagedAsyncIterableIterator { + [Symbol.asyncIterator](): PagedAsyncIterableIterator; + byPage: (settings?: TPageSettings) => AsyncIterableIterator>; + next(): Promise>; +} + +// @public +export interface PageSettings { + continuationToken?: string; +} + +// @public +export type PolicyType = string; + +// @public +export type ProvisioningState = string; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface ResourceId { + id: string; +} + +// @public +export function restorePoller(client: ServiceNetworkingManagementClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; + +// @public (undocumented) +export interface RestorePollerOptions extends OperationOptions { + abortSignal?: AbortSignalLike; + processResponseBody?: (result: TResponse) => Promise; + updateIntervalInMs?: number; +} + +// @public +export interface SecurityPoliciesInterfaceCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface SecurityPoliciesInterfaceDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface SecurityPoliciesInterfaceGetOptionalParams extends OperationOptions { +} + +// @public +export interface SecurityPoliciesInterfaceListByTrafficControllerOptionalParams extends OperationOptions { +} + +// @public +export interface SecurityPoliciesInterfaceOperations { + createOrUpdate: (resourceGroupName: string, trafficControllerName: string, securityPolicyName: string, resource: SecurityPolicy, options?: SecurityPoliciesInterfaceCreateOrUpdateOptionalParams) => PollerLike, SecurityPolicy>; + delete: (resourceGroupName: string, trafficControllerName: string, securityPolicyName: string, options?: SecurityPoliciesInterfaceDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, trafficControllerName: string, securityPolicyName: string, options?: SecurityPoliciesInterfaceGetOptionalParams) => Promise; + listByTrafficController: (resourceGroupName: string, trafficControllerName: string, options?: SecurityPoliciesInterfaceListByTrafficControllerOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, trafficControllerName: string, securityPolicyName: string, properties: SecurityPolicyUpdate, options?: SecurityPoliciesInterfaceUpdateOptionalParams) => Promise; +} + +// @public +export interface SecurityPoliciesInterfaceUpdateOptionalParams extends OperationOptions { +} + +// @public +export interface SecurityPolicy extends TrackedResource { + properties?: SecurityPolicyProperties; +} + +// @public +export interface SecurityPolicyConfigurations { + wafSecurityPolicy?: WafSecurityPolicy; +} + +// @public +export interface SecurityPolicyProperties { + readonly policyType?: PolicyType; + readonly provisioningState?: ProvisioningState; + wafPolicy?: WafPolicy; +} + +// @public +export interface SecurityPolicyUpdate { + properties?: SecurityPolicyUpdateProperties; + tags?: Record; +} + +// @public +export interface SecurityPolicyUpdateProperties { + wafPolicy?: WafPolicy; +} + +// @public (undocumented) +export class ServiceNetworkingManagementClient { + constructor(credential: TokenCredential, subscriptionId: string, options?: ServiceNetworkingManagementClientOptionalParams); + readonly associationsInterface: AssociationsInterfaceOperations; + readonly frontendsInterface: FrontendsInterfaceOperations; + readonly operations: OperationsOperations; + readonly pipeline: Pipeline; + readonly securityPoliciesInterface: SecurityPoliciesInterfaceOperations; + readonly trafficControllerInterface: TrafficControllerInterfaceOperations; +} + +// @public +export interface ServiceNetworkingManagementClientOptionalParams extends ClientOptions { + apiVersion?: string; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface TrackedResource extends Resource { + location: string; + tags?: Record; +} + +// @public +export interface TrafficController extends TrackedResource { + properties?: TrafficControllerProperties; +} + +// @public +export interface TrafficControllerInterfaceCreateOrUpdateOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface TrafficControllerInterfaceDeleteOptionalParams extends OperationOptions { + updateIntervalInMs?: number; +} + +// @public +export interface TrafficControllerInterfaceGetOptionalParams extends OperationOptions { +} + +// @public +export interface TrafficControllerInterfaceListByResourceGroupOptionalParams extends OperationOptions { +} + +// @public +export interface TrafficControllerInterfaceListBySubscriptionOptionalParams extends OperationOptions { +} + +// @public +export interface TrafficControllerInterfaceOperations { + createOrUpdate: (resourceGroupName: string, trafficControllerName: string, resource: TrafficController, options?: TrafficControllerInterfaceCreateOrUpdateOptionalParams) => PollerLike, TrafficController>; + delete: (resourceGroupName: string, trafficControllerName: string, options?: TrafficControllerInterfaceDeleteOptionalParams) => PollerLike, void>; + get: (resourceGroupName: string, trafficControllerName: string, options?: TrafficControllerInterfaceGetOptionalParams) => Promise; + listByResourceGroup: (resourceGroupName: string, options?: TrafficControllerInterfaceListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; + listBySubscription: (options?: TrafficControllerInterfaceListBySubscriptionOptionalParams) => PagedAsyncIterableIterator; + update: (resourceGroupName: string, trafficControllerName: string, properties: TrafficControllerUpdate, options?: TrafficControllerInterfaceUpdateOptionalParams) => Promise; +} + +// @public +export interface TrafficControllerInterfaceUpdateOptionalParams extends OperationOptions { +} + +// @public +export interface TrafficControllerProperties { + readonly associations?: ResourceId[]; + readonly configurationEndpoints?: string[]; + readonly frontends?: ResourceId[]; + readonly provisioningState?: ProvisioningState; + readonly securityPolicies?: ResourceId[]; + securityPolicyConfigurations?: SecurityPolicyConfigurations; +} + +// @public +export interface TrafficControllerUpdate { + properties?: TrafficControllerUpdateProperties; + tags?: Record; +} + +// @public +export interface TrafficControllerUpdateProperties { + securityPolicyConfigurations?: SecurityPolicyConfigurations; +} + +// @public +export interface WafPolicy { + id: string; +} + +// @public +export interface WafSecurityPolicy { + id: string; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceCreateOrUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceCreateOrUpdateSample.ts index 3ec054708e..6ffd824da6 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceCreateOrUpdateSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceCreateOrUpdateSample.ts @@ -10,32 +10,31 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary create a Association * x-ms-original-file: 2025-01-01/AssociationPut.json */ -async function putAssociation() { +async function putAssociation(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "subid"; const client = new ServiceNetworkingManagementClient( credential, subscriptionId, ); - const result = - await client.associationsInterface.AssociationsInterface_createOrUpdate( - "rg1", - "tc1", - "as1", - { - location: "NorthCentralUS", - properties: { - associationType: "subnets", - subnet: { - id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet", - }, + const result = await client.associationsInterface.createOrUpdate( + "rg1", + "tc1", + "as1", + { + location: "NorthCentralUS", + properties: { + associationType: "subnets", + subnet: { + id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet", }, }, - ); + }, + ); console.log(result); } -async function main() { +async function main(): Promise { await putAssociation(); } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceDeleteSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceDeleteSample.ts index d815267fe2..e988ac66a2 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceDeleteSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceDeleteSample.ts @@ -10,21 +10,17 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary delete a Association * x-ms-original-file: 2025-01-01/AssociationDelete.json */ -async function deleteAssociation() { +async function deleteAssociation(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "subid"; const client = new ServiceNetworkingManagementClient( credential, subscriptionId, ); - await client.associationsInterface.AssociationsInterface_delete( - "rg1", - "tc1", - "as1", - ); + await client.associationsInterface.delete("rg1", "tc1", "as1"); } -async function main() { +async function main(): Promise { await deleteAssociation(); } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceGetSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceGetSample.ts index 78e680181d..59a96a004d 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceGetSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceGetSample.ts @@ -10,22 +10,18 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary get a Association * x-ms-original-file: 2025-01-01/AssociationGet.json */ -async function getAssociation() { +async function getAssociation(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "subid"; const client = new ServiceNetworkingManagementClient( credential, subscriptionId, ); - const result = await client.associationsInterface.AssociationsInterface_get( - "rg1", - "tc1", - "as1", - ); + const result = await client.associationsInterface.get("rg1", "tc1", "as1"); console.log(result); } -async function main() { +async function main(): Promise { await getAssociation(); } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceListByTrafficControllerSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceListByTrafficControllerSample.ts index 75360debff..5eab3f941e 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceListByTrafficControllerSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceListByTrafficControllerSample.ts @@ -10,7 +10,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary list Association resources by TrafficController * x-ms-original-file: 2025-01-01/AssociationsGet.json */ -async function getAssociations() { +async function getAssociations(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "subid"; const client = new ServiceNetworkingManagementClient( @@ -18,7 +18,7 @@ async function getAssociations() { subscriptionId, ); const resArray = new Array(); - for await (let item of client.associationsInterface.AssociationsInterface_listByTrafficController( + for await (let item of client.associationsInterface.listByTrafficController( "rg1", "tc1", )) { @@ -28,7 +28,7 @@ async function getAssociations() { console.log(resArray); } -async function main() { +async function main(): Promise { await getAssociations(); } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceUpdateSample.ts index dc5df3da22..1fbf49bd97 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceUpdateSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceUpdateSample.ts @@ -10,31 +10,30 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary update a Association * x-ms-original-file: 2025-01-01/AssociationPatch.json */ -async function updateAssociation() { +async function updateAssociation(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "subid"; const client = new ServiceNetworkingManagementClient( credential, subscriptionId, ); - const result = - await client.associationsInterface.AssociationsInterface_update( - "rg1", - "tc1", - "as1", - { - properties: { - associationType: "subnets", - subnet: { - id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet", - }, + const result = await client.associationsInterface.update( + "rg1", + "tc1", + "as1", + { + properties: { + associationType: "subnets", + subnet: { + id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet", }, }, - ); + }, + ); console.log(result); } -async function main() { +async function main(): Promise { await updateAssociation(); } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceCreateOrUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceCreateOrUpdateSample.ts index a80bffc40c..a2caaf847f 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceCreateOrUpdateSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceCreateOrUpdateSample.ts @@ -10,24 +10,23 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary create a Frontend * x-ms-original-file: 2025-01-01/FrontendPut.json */ -async function putFrontend() { +async function putFrontend(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "subid"; const client = new ServiceNetworkingManagementClient( credential, subscriptionId, ); - const result = - await client.frontendsInterface.FrontendsInterface_createOrUpdate( - "rg1", - "tc1", - "fe1", - { location: "NorthCentralUS", properties: {} }, - ); + const result = await client.frontendsInterface.createOrUpdate( + "rg1", + "tc1", + "fe1", + { location: "NorthCentralUS", properties: {} }, + ); console.log(result); } -async function main() { +async function main(): Promise { await putFrontend(); } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceDeleteSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceDeleteSample.ts index 049b636410..f3294e4006 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceDeleteSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceDeleteSample.ts @@ -10,21 +10,17 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary delete a Frontend * x-ms-original-file: 2025-01-01/FrontendDelete.json */ -async function deleteFrontend() { +async function deleteFrontend(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "subid"; const client = new ServiceNetworkingManagementClient( credential, subscriptionId, ); - await client.frontendsInterface.FrontendsInterface_delete( - "rg1", - "tc1", - "fe1", - ); + await client.frontendsInterface.delete("rg1", "tc1", "fe1"); } -async function main() { +async function main(): Promise { await deleteFrontend(); } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceGetSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceGetSample.ts index 9d292969a5..cb7d7038e5 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceGetSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceGetSample.ts @@ -10,22 +10,18 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary get a Frontend * x-ms-original-file: 2025-01-01/FrontendGet.json */ -async function getFrontend() { +async function getFrontend(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "subid"; const client = new ServiceNetworkingManagementClient( credential, subscriptionId, ); - const result = await client.frontendsInterface.FrontendsInterface_get( - "rg1", - "tc1", - "fe1", - ); + const result = await client.frontendsInterface.get("rg1", "tc1", "fe1"); console.log(result); } -async function main() { +async function main(): Promise { await getFrontend(); } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceListByTrafficControllerSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceListByTrafficControllerSample.ts index 12c35e344b..b33e3af518 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceListByTrafficControllerSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceListByTrafficControllerSample.ts @@ -10,7 +10,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary list Frontend resources by TrafficController * x-ms-original-file: 2025-01-01/FrontendsGet.json */ -async function getFrontends() { +async function getFrontends(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "subid"; const client = new ServiceNetworkingManagementClient( @@ -18,7 +18,7 @@ async function getFrontends() { subscriptionId, ); const resArray = new Array(); - for await (let item of client.frontendsInterface.FrontendsInterface_listByTrafficController( + for await (let item of client.frontendsInterface.listByTrafficController( "rg1", "tc1", )) { @@ -28,7 +28,7 @@ async function getFrontends() { console.log(resArray); } -async function main() { +async function main(): Promise { await getFrontends(); } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceUpdateSample.ts index da6eff8685..a3f4a350b2 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceUpdateSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceUpdateSample.ts @@ -10,14 +10,14 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary update a Frontend * x-ms-original-file: 2025-01-01/FrontendPatch.json */ -async function updateFrontend() { +async function updateFrontend(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "subid"; const client = new ServiceNetworkingManagementClient( credential, subscriptionId, ); - const result = await client.frontendsInterface.FrontendsInterface_update( + const result = await client.frontendsInterface.update( "rg1", "tc1", "fe1", @@ -26,7 +26,7 @@ async function updateFrontend() { console.log(result); } -async function main() { +async function main(): Promise { await updateFrontend(); } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/operationsOperationsListSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/operationsOperationsListSample.ts index 84a68a6a27..8787256f50 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/operationsOperationsListSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/operationsOperationsListSample.ts @@ -10,7 +10,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary list the operations for the provider * x-ms-original-file: 2025-01-01/OperationsList.json */ -async function getOperationsList() { +async function getOperationsList(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "00000000-0000-0000-0000-00000000000"; const client = new ServiceNetworkingManagementClient( @@ -18,14 +18,14 @@ async function getOperationsList() { subscriptionId, ); const resArray = new Array(); - for await (let item of client.operations.Operations_list()) { + for await (let item of client.operations.list()) { resArray.push(item); } console.log(resArray); } -async function main() { +async function main(): Promise { await getOperationsList(); } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceCreateOrUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceCreateOrUpdateSample.ts index b330bae64e..f2708e61c4 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceCreateOrUpdateSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceCreateOrUpdateSample.ts @@ -10,31 +10,30 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary create a SecurityPolicy * x-ms-original-file: 2025-01-01/SecurityPolicyPut.json */ -async function putSecurityPolicy() { +async function putSecurityPolicy(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "subid"; const client = new ServiceNetworkingManagementClient( credential, subscriptionId, ); - const result = - await client.securityPoliciesInterface.SecurityPoliciesInterface_createOrUpdate( - "rg1", - "tc1", - "sp1", - { - location: "NorthCentralUS", - properties: { - wafPolicy: { - id: "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0", - }, + const result = await client.securityPoliciesInterface.createOrUpdate( + "rg1", + "tc1", + "sp1", + { + location: "NorthCentralUS", + properties: { + wafPolicy: { + id: "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0", }, }, - ); + }, + ); console.log(result); } -async function main() { +async function main(): Promise { await putSecurityPolicy(); } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceDeleteSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceDeleteSample.ts index cd75193b2a..b63783a380 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceDeleteSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceDeleteSample.ts @@ -10,21 +10,17 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary delete a SecurityPolicy * x-ms-original-file: 2025-01-01/SecurityPolicyDelete.json */ -async function deleteSecurityPolicy() { +async function deleteSecurityPolicy(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "subid"; const client = new ServiceNetworkingManagementClient( credential, subscriptionId, ); - await client.securityPoliciesInterface.SecurityPoliciesInterface_delete( - "rg1", - "tc1", - "sp1", - ); + await client.securityPoliciesInterface.delete("rg1", "tc1", "sp1"); } -async function main() { +async function main(): Promise { await deleteSecurityPolicy(); } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceGetSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceGetSample.ts index da00dde36e..3d4b439403 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceGetSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceGetSample.ts @@ -10,23 +10,22 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary get a SecurityPolicy * x-ms-original-file: 2025-01-01/SecurityPolicyGet.json */ -async function getSecurityPolicy() { +async function getSecurityPolicy(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "subid"; const client = new ServiceNetworkingManagementClient( credential, subscriptionId, ); - const result = - await client.securityPoliciesInterface.SecurityPoliciesInterface_get( - "rg1", - "tc1", - "sp1", - ); + const result = await client.securityPoliciesInterface.get( + "rg1", + "tc1", + "sp1", + ); console.log(result); } -async function main() { +async function main(): Promise { await getSecurityPolicy(); } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceListByTrafficControllerSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceListByTrafficControllerSample.ts index 2222499db5..953a0fde95 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceListByTrafficControllerSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceListByTrafficControllerSample.ts @@ -10,7 +10,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary list SecurityPolicy resources by TrafficController * x-ms-original-file: 2025-01-01/SecurityPoliciesGetList.json */ -async function getSecurityPolicies() { +async function getSecurityPolicies(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "subid"; const client = new ServiceNetworkingManagementClient( @@ -18,7 +18,7 @@ async function getSecurityPolicies() { subscriptionId, ); const resArray = new Array(); - for await (let item of client.securityPoliciesInterface.SecurityPoliciesInterface_listByTrafficController( + for await (let item of client.securityPoliciesInterface.listByTrafficController( "rg1", "tc1", )) { @@ -28,7 +28,7 @@ async function getSecurityPolicies() { console.log(resArray); } -async function main() { +async function main(): Promise { await getSecurityPolicies(); } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceUpdateSample.ts index 2b3b78e2ad..38092cb526 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceUpdateSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceUpdateSample.ts @@ -10,30 +10,29 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary update a SecurityPolicy * x-ms-original-file: 2025-01-01/SecurityPolicyPatch.json */ -async function updateSecurityPolicy() { +async function updateSecurityPolicy(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "subid"; const client = new ServiceNetworkingManagementClient( credential, subscriptionId, ); - const result = - await client.securityPoliciesInterface.SecurityPoliciesInterface_update( - "rg1", - "tc1", - "sp1", - { - properties: { - wafPolicy: { - id: "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0", - }, + const result = await client.securityPoliciesInterface.update( + "rg1", + "tc1", + "sp1", + { + properties: { + wafPolicy: { + id: "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0", }, }, - ); + }, + ); console.log(result); } -async function main() { +async function main(): Promise { await updateSecurityPolicy(); } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceCreateOrUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceCreateOrUpdateSample.ts index 7c6ee77254..f72496173b 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceCreateOrUpdateSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceCreateOrUpdateSample.ts @@ -10,23 +10,22 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary create a TrafficController * x-ms-original-file: 2025-01-01/TrafficControllerPut.json */ -async function putTrafficController() { +async function putTrafficController(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "subid"; const client = new ServiceNetworkingManagementClient( credential, subscriptionId, ); - const result = - await client.trafficControllerInterface.TrafficControllerInterface_createOrUpdate( - "rg1", - "tc1", - { location: "NorthCentralUS", tags: { key1: "value1" } }, - ); + const result = await client.trafficControllerInterface.createOrUpdate( + "rg1", + "tc1", + { location: "NorthCentralUS", tags: { key1: "value1" } }, + ); console.log(result); } -async function main() { +async function main(): Promise { await putTrafficController(); } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceDeleteSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceDeleteSample.ts index 19d652e325..c65f924466 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceDeleteSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceDeleteSample.ts @@ -10,20 +10,17 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary delete a TrafficController * x-ms-original-file: 2025-01-01/TrafficControllerDelete.json */ -async function deleteTrafficController() { +async function deleteTrafficController(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "subid"; const client = new ServiceNetworkingManagementClient( credential, subscriptionId, ); - await client.trafficControllerInterface.TrafficControllerInterface_delete( - "rg1", - "tc1", - ); + await client.trafficControllerInterface.delete("rg1", "tc1"); } -async function main() { +async function main(): Promise { await deleteTrafficController(); } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceGetSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceGetSample.ts index d8f0101697..7197624b99 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceGetSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceGetSample.ts @@ -10,22 +10,18 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary get a TrafficController * x-ms-original-file: 2025-01-01/TrafficControllerGet.json */ -async function getTrafficController() { +async function getTrafficController(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "subid"; const client = new ServiceNetworkingManagementClient( credential, subscriptionId, ); - const result = - await client.trafficControllerInterface.TrafficControllerInterface_get( - "rg1", - "tc1", - ); + const result = await client.trafficControllerInterface.get("rg1", "tc1"); console.log(result); } -async function main() { +async function main(): Promise { await getTrafficController(); } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListByResourceGroupSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListByResourceGroupSample.ts index e8c0a270f7..bc97c1ecf1 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListByResourceGroupSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListByResourceGroupSample.ts @@ -10,7 +10,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary list TrafficController resources by resource group * x-ms-original-file: 2025-01-01/TrafficControllersGet.json */ -async function getTrafficControllers() { +async function getTrafficControllers(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "subid"; const client = new ServiceNetworkingManagementClient( @@ -18,7 +18,7 @@ async function getTrafficControllers() { subscriptionId, ); const resArray = new Array(); - for await (let item of client.trafficControllerInterface.TrafficControllerInterface_listByResourceGroup( + for await (let item of client.trafficControllerInterface.listByResourceGroup( "rg1", )) { resArray.push(item); @@ -27,7 +27,7 @@ async function getTrafficControllers() { console.log(resArray); } -async function main() { +async function main(): Promise { await getTrafficControllers(); } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListBySubscriptionSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListBySubscriptionSample.ts index 7fe574e327..1638b0ac37 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListBySubscriptionSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListBySubscriptionSample.ts @@ -10,7 +10,7 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary list TrafficController resources by subscription ID * x-ms-original-file: 2025-01-01/TrafficControllersGetList.json */ -async function getTrafficControllersList() { +async function getTrafficControllersList(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "subid"; const client = new ServiceNetworkingManagementClient( @@ -18,14 +18,14 @@ async function getTrafficControllersList() { subscriptionId, ); const resArray = new Array(); - for await (let item of client.trafficControllerInterface.TrafficControllerInterface_listBySubscription()) { + for await (let item of client.trafficControllerInterface.listBySubscription()) { resArray.push(item); } console.log(resArray); } -async function main() { +async function main(): Promise { await getTrafficControllersList(); } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceUpdateSample.ts index 4cb1602a3b..5f31dd4e80 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceUpdateSample.ts +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceUpdateSample.ts @@ -10,23 +10,20 @@ import { DefaultAzureCredential } from "@azure/identity"; * @summary update a TrafficController * x-ms-original-file: 2025-01-01/TrafficControllerPatch.json */ -async function patchTrafficController() { +async function patchTrafficController(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "subid"; const client = new ServiceNetworkingManagementClient( credential, subscriptionId, ); - const result = - await client.trafficControllerInterface.TrafficControllerInterface_update( - "rg1", - "tc1", - { tags: { key1: "value1" } }, - ); + const result = await client.trafficControllerInterface.update("rg1", "tc1", { + tags: { key1: "value1" }, + }); console.log(result); } -async function main() { +async function main(): Promise { await patchTrafficController(); } diff --git a/packages/typespec-ts/src/modular/emitSamples.ts b/packages/typespec-ts/src/modular/emitSamples.ts index 349ed44d33..9b2b4ddc44 100644 --- a/packages/typespec-ts/src/modular/emitSamples.ts +++ b/packages/typespec-ts/src/modular/emitSamples.ts @@ -33,6 +33,10 @@ import { hasKeyCredential, hasTokenCredential } from "../utils/credentialUtils.js"; +import { + getMethodHierarchiesMap, + ServiceOperation +} from "../utils/operationUtil.js"; /** * Interfaces for samples generations @@ -74,37 +78,26 @@ function emitClientSamples( client: SdkClientType, options: EmitSampleOptions ) { - for (const operationOrGroup of client.methods) { - // handle client-level methods - if (operationOrGroup.kind !== "clientaccessor") { - emitMethodSamples(dpgContext, operationOrGroup, options); - continue; - } - // handle operation group - let prefix = normalizeName( - operationOrGroup.response.name, - NameType.Property - ); - // append hierarchy prefix if hierarchyClient is enabled - if (dpgContext.rlcOptions?.hierarchyClient === true) { - prefix = - (options.classicalMethodPrefix - ? `${options.classicalMethodPrefix}.` - : "") + prefix; - } else if (dpgContext.rlcOptions?.enableOperationGroup === false) { - prefix = ""; + const methodMap = getMethodHierarchiesMap(dpgContext, client); + for (const [prefixKey, operations] of methodMap) { + const prefix = prefixKey + .split("/") + .map((name) => { + return normalizeName(name, NameType.Property); + }) + .join("."); + for (const op of operations) { + emitMethodSamples(dpgContext, op, { + ...options, + classicalMethodPrefix: prefix + }); } - - emitClientSamples(dpgContext, operationOrGroup.response, { - ...options, - classicalMethodPrefix: prefix - }); } } function emitMethodSamples( dpgContext: SdkContext, - method: SdkServiceMethod, + method: ServiceOperation, options: EmitSampleOptions ): SourceFile | undefined { const examples = method.operation.examples ?? []; @@ -194,7 +187,7 @@ function emitMethodSamples( ? `${options.classicalMethodPrefix}.` : ""; const isPaging = method.kind === "paging"; - const methodCall = `client.${prefix}${method.name}(${methodParams.join( + const methodCall = `client.${prefix}${normalizeName(method.oriName ?? "", NameType.Property)}(${methodParams.join( ", " )})`; if (isPaging) { From 26b66fa8cf32356498dc12c6476f0933478c8511 Mon Sep 17 00:00:00 2001 From: Qiaoqiao Zhang Date: Thu, 13 Feb 2025 11:03:48 +0800 Subject: [PATCH 3/9] fix sample name --- .../arm-servicenetworking/package.json | 71 ++----------------- ...sociationsInterfaceCreateOrUpdateSample.ts | 41 +++++++++++ .../associationsInterfaceDeleteSample.ts | 27 +++++++ .../associationsInterfaceGetSample.ts | 28 ++++++++ ...sInterfaceListByTrafficControllerSample.ts | 35 +++++++++ .../associationsInterfaceUpdateSample.ts | 40 +++++++++++ .../frontendsInterfaceCreateOrUpdateSample.ts | 33 +++++++++ .../frontendsInterfaceDeleteSample.ts | 27 +++++++ .../frontendsInterfaceGetSample.ts | 28 ++++++++ ...sInterfaceListByTrafficControllerSample.ts | 35 +++++++++ .../frontendsInterfaceUpdateSample.ts | 33 +++++++++ .../samples-dev/operationsListSample.ts | 32 +++++++++ ...tyPoliciesInterfaceCreateOrUpdateSample.ts | 40 +++++++++++ .../securityPoliciesInterfaceDeleteSample.ts | 27 +++++++ .../securityPoliciesInterfaceGetSample.ts | 32 +++++++++ ...sInterfaceListByTrafficControllerSample.ts | 35 +++++++++ .../securityPoliciesInterfaceUpdateSample.ts | 39 ++++++++++ ...ControllerInterfaceCreateOrUpdateSample.ts | 32 +++++++++ .../trafficControllerInterfaceDeleteSample.ts | 27 +++++++ .../trafficControllerInterfaceGetSample.ts | 28 ++++++++ ...ollerInterfaceListByResourceGroupSample.ts | 34 +++++++++ ...rollerInterfaceListBySubscriptionSample.ts | 32 +++++++++ .../trafficControllerInterfaceUpdateSample.ts | 30 ++++++++ .../typespec-ts/src/modular/emitSamples.ts | 9 ++- 24 files changed, 724 insertions(+), 71 deletions(-) create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceCreateOrUpdateSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceDeleteSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceGetSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceListByTrafficControllerSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceUpdateSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceCreateOrUpdateSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceDeleteSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceGetSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceListByTrafficControllerSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceUpdateSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/operationsListSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceCreateOrUpdateSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceDeleteSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceGetSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceListByTrafficControllerSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceUpdateSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceCreateOrUpdateSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceDeleteSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceGetSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceListByResourceGroupSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceListBySubscriptionSample.ts create mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceUpdateSample.ts diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/package.json b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/package.json index b34d814488..c19df2cdbe 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/package.json +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/package.json @@ -13,34 +13,15 @@ ".": "./src/index.ts", "./models": "./src/models/index.ts" }, - "dialects": [ - "esm", - "commonjs" - ], - "esmDialects": [ - "browser", - "react-native" - ], + "dialects": ["esm", "commonjs"], + "esmDialects": ["browser", "react-native"], "selfLink": false }, "type": "module", - "keywords": [ - "node", - "azure", - "cloud", - "typescript", - "browser", - "isomorphic" - ], + "keywords": ["node", "azure", "cloud", "typescript", "browser", "isomorphic"], "author": "Microsoft Corporation", "license": "MIT", - "files": [ - "dist", - "README.md", - "LICENSE", - "review/*", - "CHANGELOG.md" - ], + "files": ["dist", "README.md", "LICENSE", "review/*", "CHANGELOG.md"], "dependencies": { "@azure/core-util": "^1.9.2", "@azure-rest/core-client": "^2.3.1", @@ -84,47 +65,5 @@ "test:node": "npm run clean && tshy && npm run unit-test:node && npm run integration-test:node", "test": "npm run clean && tshy && npm run unit-test:node && npm run unit-test:browser && npm run integration-test", "build": "npm run clean && tshy && npm run extract-api" - }, - "exports": { - "./package.json": "./package.json", - ".": { - "browser": { - "types": "./dist/browser/index.d.ts", - "default": "./dist/browser/index.js" - }, - "react-native": { - "types": "./dist/react-native/index.d.ts", - "default": "./dist/react-native/index.js" - }, - "import": { - "types": "./dist/esm/index.d.ts", - "default": "./dist/esm/index.js" - }, - "require": { - "types": "./dist/commonjs/index.d.ts", - "default": "./dist/commonjs/index.js" - } - }, - "./models": { - "browser": { - "types": "./dist/browser/models/index.d.ts", - "default": "./dist/browser/models/index.js" - }, - "react-native": { - "types": "./dist/react-native/models/index.d.ts", - "default": "./dist/react-native/models/index.js" - }, - "import": { - "types": "./dist/esm/models/index.d.ts", - "default": "./dist/esm/models/index.js" - }, - "require": { - "types": "./dist/commonjs/models/index.d.ts", - "default": "./dist/commonjs/models/index.js" - } - } - }, - "main": "./dist/commonjs/index.js", - "types": "./dist/commonjs/index.d.ts", - "module": "./dist/esm/index.js" + } } diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceCreateOrUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceCreateOrUpdateSample.ts new file mode 100644 index 0000000000..6ffd824da6 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceCreateOrUpdateSample.ts @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a Association + * + * @summary create a Association + * x-ms-original-file: 2025-01-01/AssociationPut.json + */ +async function putAssociation(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = await client.associationsInterface.createOrUpdate( + "rg1", + "tc1", + "as1", + { + location: "NorthCentralUS", + properties: { + associationType: "subnets", + subnet: { + id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet", + }, + }, + }, + ); + console.log(result); +} + +async function main(): Promise { + await putAssociation(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceDeleteSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceDeleteSample.ts new file mode 100644 index 0000000000..e988ac66a2 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceDeleteSample.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a Association + * + * @summary delete a Association + * x-ms-original-file: 2025-01-01/AssociationDelete.json + */ +async function deleteAssociation(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + await client.associationsInterface.delete("rg1", "tc1", "as1"); +} + +async function main(): Promise { + await deleteAssociation(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceGetSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceGetSample.ts new file mode 100644 index 0000000000..59a96a004d --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceGetSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a Association + * + * @summary get a Association + * x-ms-original-file: 2025-01-01/AssociationGet.json + */ +async function getAssociation(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = await client.associationsInterface.get("rg1", "tc1", "as1"); + console.log(result); +} + +async function main(): Promise { + await getAssociation(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceListByTrafficControllerSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceListByTrafficControllerSample.ts new file mode 100644 index 0000000000..5eab3f941e --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceListByTrafficControllerSample.ts @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list Association resources by TrafficController + * + * @summary list Association resources by TrafficController + * x-ms-original-file: 2025-01-01/AssociationsGet.json + */ +async function getAssociations(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const resArray = new Array(); + for await (let item of client.associationsInterface.listByTrafficController( + "rg1", + "tc1", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await getAssociations(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceUpdateSample.ts new file mode 100644 index 0000000000..1fbf49bd97 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceUpdateSample.ts @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to update a Association + * + * @summary update a Association + * x-ms-original-file: 2025-01-01/AssociationPatch.json + */ +async function updateAssociation(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = await client.associationsInterface.update( + "rg1", + "tc1", + "as1", + { + properties: { + associationType: "subnets", + subnet: { + id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet", + }, + }, + }, + ); + console.log(result); +} + +async function main(): Promise { + await updateAssociation(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceCreateOrUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceCreateOrUpdateSample.ts new file mode 100644 index 0000000000..a2caaf847f --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceCreateOrUpdateSample.ts @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a Frontend + * + * @summary create a Frontend + * x-ms-original-file: 2025-01-01/FrontendPut.json + */ +async function putFrontend(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = await client.frontendsInterface.createOrUpdate( + "rg1", + "tc1", + "fe1", + { location: "NorthCentralUS", properties: {} }, + ); + console.log(result); +} + +async function main(): Promise { + await putFrontend(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceDeleteSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceDeleteSample.ts new file mode 100644 index 0000000000..f3294e4006 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceDeleteSample.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a Frontend + * + * @summary delete a Frontend + * x-ms-original-file: 2025-01-01/FrontendDelete.json + */ +async function deleteFrontend(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + await client.frontendsInterface.delete("rg1", "tc1", "fe1"); +} + +async function main(): Promise { + await deleteFrontend(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceGetSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceGetSample.ts new file mode 100644 index 0000000000..cb7d7038e5 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceGetSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a Frontend + * + * @summary get a Frontend + * x-ms-original-file: 2025-01-01/FrontendGet.json + */ +async function getFrontend(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = await client.frontendsInterface.get("rg1", "tc1", "fe1"); + console.log(result); +} + +async function main(): Promise { + await getFrontend(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceListByTrafficControllerSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceListByTrafficControllerSample.ts new file mode 100644 index 0000000000..b33e3af518 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceListByTrafficControllerSample.ts @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list Frontend resources by TrafficController + * + * @summary list Frontend resources by TrafficController + * x-ms-original-file: 2025-01-01/FrontendsGet.json + */ +async function getFrontends(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const resArray = new Array(); + for await (let item of client.frontendsInterface.listByTrafficController( + "rg1", + "tc1", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await getFrontends(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceUpdateSample.ts new file mode 100644 index 0000000000..a3f4a350b2 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceUpdateSample.ts @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to update a Frontend + * + * @summary update a Frontend + * x-ms-original-file: 2025-01-01/FrontendPatch.json + */ +async function updateFrontend(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = await client.frontendsInterface.update( + "rg1", + "tc1", + "fe1", + {}, + ); + console.log(result); +} + +async function main(): Promise { + await updateFrontend(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/operationsListSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/operationsListSample.ts new file mode 100644 index 0000000000..8787256f50 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/operationsListSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list the operations for the provider + * + * @summary list the operations for the provider + * x-ms-original-file: 2025-01-01/OperationsList.json + */ +async function getOperationsList(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-00000000000"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await getOperationsList(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceCreateOrUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceCreateOrUpdateSample.ts new file mode 100644 index 0000000000..f2708e61c4 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceCreateOrUpdateSample.ts @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a SecurityPolicy + * + * @summary create a SecurityPolicy + * x-ms-original-file: 2025-01-01/SecurityPolicyPut.json + */ +async function putSecurityPolicy(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = await client.securityPoliciesInterface.createOrUpdate( + "rg1", + "tc1", + "sp1", + { + location: "NorthCentralUS", + properties: { + wafPolicy: { + id: "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0", + }, + }, + }, + ); + console.log(result); +} + +async function main(): Promise { + await putSecurityPolicy(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceDeleteSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceDeleteSample.ts new file mode 100644 index 0000000000..b63783a380 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceDeleteSample.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a SecurityPolicy + * + * @summary delete a SecurityPolicy + * x-ms-original-file: 2025-01-01/SecurityPolicyDelete.json + */ +async function deleteSecurityPolicy(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + await client.securityPoliciesInterface.delete("rg1", "tc1", "sp1"); +} + +async function main(): Promise { + await deleteSecurityPolicy(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceGetSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceGetSample.ts new file mode 100644 index 0000000000..3d4b439403 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceGetSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a SecurityPolicy + * + * @summary get a SecurityPolicy + * x-ms-original-file: 2025-01-01/SecurityPolicyGet.json + */ +async function getSecurityPolicy(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = await client.securityPoliciesInterface.get( + "rg1", + "tc1", + "sp1", + ); + console.log(result); +} + +async function main(): Promise { + await getSecurityPolicy(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceListByTrafficControllerSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceListByTrafficControllerSample.ts new file mode 100644 index 0000000000..953a0fde95 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceListByTrafficControllerSample.ts @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list SecurityPolicy resources by TrafficController + * + * @summary list SecurityPolicy resources by TrafficController + * x-ms-original-file: 2025-01-01/SecurityPoliciesGetList.json + */ +async function getSecurityPolicies(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const resArray = new Array(); + for await (let item of client.securityPoliciesInterface.listByTrafficController( + "rg1", + "tc1", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await getSecurityPolicies(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceUpdateSample.ts new file mode 100644 index 0000000000..38092cb526 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceUpdateSample.ts @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to update a SecurityPolicy + * + * @summary update a SecurityPolicy + * x-ms-original-file: 2025-01-01/SecurityPolicyPatch.json + */ +async function updateSecurityPolicy(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = await client.securityPoliciesInterface.update( + "rg1", + "tc1", + "sp1", + { + properties: { + wafPolicy: { + id: "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0", + }, + }, + }, + ); + console.log(result); +} + +async function main(): Promise { + await updateSecurityPolicy(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceCreateOrUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceCreateOrUpdateSample.ts new file mode 100644 index 0000000000..f72496173b --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceCreateOrUpdateSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to create a TrafficController + * + * @summary create a TrafficController + * x-ms-original-file: 2025-01-01/TrafficControllerPut.json + */ +async function putTrafficController(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = await client.trafficControllerInterface.createOrUpdate( + "rg1", + "tc1", + { location: "NorthCentralUS", tags: { key1: "value1" } }, + ); + console.log(result); +} + +async function main(): Promise { + await putTrafficController(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceDeleteSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceDeleteSample.ts new file mode 100644 index 0000000000..c65f924466 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceDeleteSample.ts @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a TrafficController + * + * @summary delete a TrafficController + * x-ms-original-file: 2025-01-01/TrafficControllerDelete.json + */ +async function deleteTrafficController(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + await client.trafficControllerInterface.delete("rg1", "tc1"); +} + +async function main(): Promise { + await deleteTrafficController(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceGetSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceGetSample.ts new file mode 100644 index 0000000000..7197624b99 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceGetSample.ts @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to get a TrafficController + * + * @summary get a TrafficController + * x-ms-original-file: 2025-01-01/TrafficControllerGet.json + */ +async function getTrafficController(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = await client.trafficControllerInterface.get("rg1", "tc1"); + console.log(result); +} + +async function main(): Promise { + await getTrafficController(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceListByResourceGroupSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceListByResourceGroupSample.ts new file mode 100644 index 0000000000..bc97c1ecf1 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceListByResourceGroupSample.ts @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list TrafficController resources by resource group + * + * @summary list TrafficController resources by resource group + * x-ms-original-file: 2025-01-01/TrafficControllersGet.json + */ +async function getTrafficControllers(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const resArray = new Array(); + for await (let item of client.trafficControllerInterface.listByResourceGroup( + "rg1", + )) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await getTrafficControllers(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceListBySubscriptionSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceListBySubscriptionSample.ts new file mode 100644 index 0000000000..1638b0ac37 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceListBySubscriptionSample.ts @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list TrafficController resources by subscription ID + * + * @summary list TrafficController resources by subscription ID + * x-ms-original-file: 2025-01-01/TrafficControllersGetList.json + */ +async function getTrafficControllersList(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const resArray = new Array(); + for await (let item of client.trafficControllerInterface.listBySubscription()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await getTrafficControllersList(); +} + +main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceUpdateSample.ts new file mode 100644 index 0000000000..5f31dd4e80 --- /dev/null +++ b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceUpdateSample.ts @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to update a TrafficController + * + * @summary update a TrafficController + * x-ms-original-file: 2025-01-01/TrafficControllerPatch.json + */ +async function patchTrafficController(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "subid"; + const client = new ServiceNetworkingManagementClient( + credential, + subscriptionId, + ); + const result = await client.trafficControllerInterface.update("rg1", "tc1", { + tags: { key1: "value1" }, + }); + console.log(result); +} + +async function main(): Promise { + await patchTrafficController(); +} + +main().catch(console.error); diff --git a/packages/typespec-ts/src/modular/emitSamples.ts b/packages/typespec-ts/src/modular/emitSamples.ts index 9b2b4ddc44..5c7148f6c0 100644 --- a/packages/typespec-ts/src/modular/emitSamples.ts +++ b/packages/typespec-ts/src/modular/emitSamples.ts @@ -10,7 +10,6 @@ import { SdkHttpOperationExample, SdkHttpParameterExampleValue, SdkInitializationType, - SdkServiceMethod, SdkServiceOperation, SdkExampleValue } from "@azure-tools/typespec-client-generator-core"; @@ -106,7 +105,7 @@ function emitMethodSamples( } const project = useContext("outputProject"); const operationPrefix = `${options.classicalMethodPrefix ?? ""} ${ - method.name + method.oriName }`; const sampleFolder = join( dpgContext.generationPathDetail?.rootDir ?? "", @@ -205,7 +204,7 @@ function emitMethodSamples( } // Create a function declaration structure - const description = method.doc ?? `execute ${method.name}`; + const description = method.doc ?? `execute ${method.oriName}`; const normalizedDescription = description.charAt(0).toLowerCase() + description.slice(1); const functionDeclaration: FunctionDeclarationStructure = { @@ -245,7 +244,7 @@ function buildParameterValueMap(example: SdkHttpOperationExample) { function prepareExampleParameters( dpgContext: SdkContext, - method: SdkServiceMethod, + method: ServiceOperation, parameterMap: Record, topLevelClient: SdkClientType ): ExampleValue[] { @@ -277,7 +276,7 @@ function prepareExampleParameters( reportDiagnostic(dpgContext.program, { code: "required-sample-parameter", format: { - exampleName: method.name, + exampleName: method.oriName ?? method.name, paramName: param.name }, target: NoTarget From e91f8c0db9a6eda59efe1b6a960ec8983281faee Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Thu, 13 Feb 2025 11:34:30 +0800 Subject: [PATCH 4/9] update ut --- .../review/arm-servicenetworking.api.md | 444 ------------------ ...sociationsInterfaceCreateOrUpdateSample.ts | 41 -- ...erfaceAssociationsInterfaceDeleteSample.ts | 27 -- ...InterfaceAssociationsInterfaceGetSample.ts | 28 -- ...sInterfaceListByTrafficControllerSample.ts | 35 -- ...erfaceAssociationsInterfaceUpdateSample.ts | 40 -- ...eFrontendsInterfaceCreateOrUpdateSample.ts | 33 -- ...InterfaceFrontendsInterfaceDeleteSample.ts | 27 -- ...ndsInterfaceFrontendsInterfaceGetSample.ts | 28 -- ...sInterfaceListByTrafficControllerSample.ts | 35 -- ...InterfaceFrontendsInterfaceUpdateSample.ts | 33 -- .../operationsOperationsListSample.ts | 32 -- ...tyPoliciesInterfaceCreateOrUpdateSample.ts | 40 -- ...ceSecurityPoliciesInterfaceDeleteSample.ts | 27 -- ...rfaceSecurityPoliciesInterfaceGetSample.ts | 32 -- ...sInterfaceListByTrafficControllerSample.ts | 35 -- ...ceSecurityPoliciesInterfaceUpdateSample.ts | 39 -- ...ControllerInterfaceCreateOrUpdateSample.ts | 32 -- ...eTrafficControllerInterfaceDeleteSample.ts | 27 -- ...faceTrafficControllerInterfaceGetSample.ts | 28 -- ...ollerInterfaceListByResourceGroupSample.ts | 34 -- ...rollerInterfaceListBySubscriptionSample.ts | 32 -- ...eTrafficControllerInterfaceUpdateSample.ts | 30 -- .../tspconfig.yaml | 1 + .../disableHierarchy/enableOperationGroup.md | 4 +- .../disableHierarchyArmCurdOperations.md | 199 ++++++++ 26 files changed, 202 insertions(+), 1161 deletions(-) delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/review/arm-servicenetworking.api.md delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceCreateOrUpdateSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceDeleteSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceGetSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceListByTrafficControllerSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceUpdateSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceCreateOrUpdateSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceDeleteSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceGetSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceListByTrafficControllerSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceUpdateSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/operationsOperationsListSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceCreateOrUpdateSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceDeleteSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceGetSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceListByTrafficControllerSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceUpdateSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceCreateOrUpdateSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceDeleteSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceGetSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListByResourceGroupSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListBySubscriptionSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceUpdateSample.ts create mode 100644 packages/typespec-ts/test/modularUnit/scenarios/samples/operations/disableHierarchyArmCurdOperations.md diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/review/arm-servicenetworking.api.md b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/review/arm-servicenetworking.api.md deleted file mode 100644 index a001065078..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/review/arm-servicenetworking.api.md +++ /dev/null @@ -1,444 +0,0 @@ -## API Report File for "@azure/arm-servicenetworking" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { AbortSignalLike } from '@azure/abort-controller'; -import { ClientOptions } from '@azure-rest/core-client'; -import { OperationOptions } from '@azure-rest/core-client'; -import { OperationState } from '@azure/core-lro'; -import { PathUncheckedResponse } from '@azure-rest/core-client'; -import { Pipeline } from '@azure/core-rest-pipeline'; -import { PollerLike } from '@azure/core-lro'; -import { TokenCredential } from '@azure/core-auth'; - -// @public -export type ActionType = string; - -// @public -export interface Association extends TrackedResource { - properties?: AssociationProperties; -} - -// @public -export interface AssociationProperties { - associationType: AssociationType; - readonly provisioningState?: ProvisioningState; - subnet?: AssociationSubnet; -} - -// @public -export interface AssociationsInterfaceCreateOrUpdateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public -export interface AssociationsInterfaceDeleteOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public -export interface AssociationsInterfaceGetOptionalParams extends OperationOptions { -} - -// @public -export interface AssociationsInterfaceListByTrafficControllerOptionalParams extends OperationOptions { -} - -// @public -export interface AssociationsInterfaceOperations { - createOrUpdate: (resourceGroupName: string, trafficControllerName: string, associationName: string, resource: Association, options?: AssociationsInterfaceCreateOrUpdateOptionalParams) => PollerLike, Association>; - delete: (resourceGroupName: string, trafficControllerName: string, associationName: string, options?: AssociationsInterfaceDeleteOptionalParams) => PollerLike, void>; - get: (resourceGroupName: string, trafficControllerName: string, associationName: string, options?: AssociationsInterfaceGetOptionalParams) => Promise; - listByTrafficController: (resourceGroupName: string, trafficControllerName: string, options?: AssociationsInterfaceListByTrafficControllerOptionalParams) => PagedAsyncIterableIterator; - update: (resourceGroupName: string, trafficControllerName: string, associationName: string, properties: AssociationUpdate, options?: AssociationsInterfaceUpdateOptionalParams) => Promise; -} - -// @public -export interface AssociationsInterfaceUpdateOptionalParams extends OperationOptions { -} - -// @public -export interface AssociationSubnet { - id: string; -} - -// @public -export interface AssociationSubnetUpdate { - id: string; -} - -// @public -export type AssociationType = string; - -// @public -export interface AssociationUpdate { - properties?: AssociationUpdateProperties; - tags?: Record; -} - -// @public -export interface AssociationUpdateProperties { - associationType?: AssociationType; - subnet?: AssociationSubnetUpdate; -} - -// @public -export type ContinuablePage = TPage & { - continuationToken?: string; -}; - -// @public -export type CreatedByType = string; - -// @public -export interface ErrorAdditionalInfo { - readonly info?: Record; - readonly type?: string; -} - -// @public -export interface ErrorDetail { - readonly additionalInfo?: ErrorAdditionalInfo[]; - readonly code?: string; - readonly details?: ErrorDetail[]; - readonly message?: string; - readonly target?: string; -} - -// @public -export interface ErrorResponse { - error?: ErrorDetail; -} - -// @public -export interface Frontend extends TrackedResource { - properties?: FrontendProperties; -} - -// @public -export interface FrontendProperties { - readonly fqdn?: string; - readonly provisioningState?: ProvisioningState; -} - -// @public -export interface FrontendsInterfaceCreateOrUpdateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public -export interface FrontendsInterfaceDeleteOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public -export interface FrontendsInterfaceGetOptionalParams extends OperationOptions { -} - -// @public -export interface FrontendsInterfaceListByTrafficControllerOptionalParams extends OperationOptions { -} - -// @public -export interface FrontendsInterfaceOperations { - createOrUpdate: (resourceGroupName: string, trafficControllerName: string, frontendName: string, resource: Frontend, options?: FrontendsInterfaceCreateOrUpdateOptionalParams) => PollerLike, Frontend>; - delete: (resourceGroupName: string, trafficControllerName: string, frontendName: string, options?: FrontendsInterfaceDeleteOptionalParams) => PollerLike, void>; - get: (resourceGroupName: string, trafficControllerName: string, frontendName: string, options?: FrontendsInterfaceGetOptionalParams) => Promise; - listByTrafficController: (resourceGroupName: string, trafficControllerName: string, options?: FrontendsInterfaceListByTrafficControllerOptionalParams) => PagedAsyncIterableIterator; - update: (resourceGroupName: string, trafficControllerName: string, frontendName: string, properties: FrontendUpdate, options?: FrontendsInterfaceUpdateOptionalParams) => Promise; -} - -// @public -export interface FrontendsInterfaceUpdateOptionalParams extends OperationOptions { -} - -// @public -export interface FrontendUpdate { - tags?: Record; -} - -// @public -export enum KnownActionType { - Internal = "Internal" -} - -// @public -export enum KnownAssociationType { - subnets = "subnets" -} - -// @public -export enum KnownCreatedByType { - Application = "Application", - Key = "Key", - ManagedIdentity = "ManagedIdentity", - User = "User" -} - -// @public -export enum KnownOrigin { - "user,system" = "user,system", - system = "system", - user = "user" -} - -// @public -export enum KnownPolicyType { - WAF = "waf" -} - -// @public -export enum KnownProvisioningState { - Accepted = "Accepted", - Canceled = "Canceled", - Deleting = "Deleting", - Failed = "Failed", - Provisioning = "Provisioning", - Succeeded = "Succeeded", - Updating = "Updating" -} - -// @public -export enum KnownVersions { - v2023_11_01 = "2023-11-01", - v2025_05_01 = "2025-01-01" -} - -// @public -export interface Operation { - readonly actionType?: ActionType; - display?: OperationDisplay; - readonly isDataAction?: boolean; - readonly name?: string; - readonly origin?: Origin; -} - -// @public -export interface OperationDisplay { - readonly description?: string; - readonly operation?: string; - readonly provider?: string; - readonly resource?: string; -} - -// @public -export interface OperationsListOptionalParams extends OperationOptions { -} - -// @public -export interface OperationsOperations { - list: (options?: OperationsListOptionalParams) => PagedAsyncIterableIterator; -} - -// @public -export type Origin = string; - -// @public -export interface PagedAsyncIterableIterator { - [Symbol.asyncIterator](): PagedAsyncIterableIterator; - byPage: (settings?: TPageSettings) => AsyncIterableIterator>; - next(): Promise>; -} - -// @public -export interface PageSettings { - continuationToken?: string; -} - -// @public -export type PolicyType = string; - -// @public -export type ProvisioningState = string; - -// @public -export interface Resource { - readonly id?: string; - readonly name?: string; - readonly systemData?: SystemData; - readonly type?: string; -} - -// @public -export interface ResourceId { - id: string; -} - -// @public -export function restorePoller(client: ServiceNetworkingManagementClient, serializedState: string, sourceOperation: (...args: any[]) => PollerLike, TResult>, options?: RestorePollerOptions): PollerLike, TResult>; - -// @public (undocumented) -export interface RestorePollerOptions extends OperationOptions { - abortSignal?: AbortSignalLike; - processResponseBody?: (result: TResponse) => Promise; - updateIntervalInMs?: number; -} - -// @public -export interface SecurityPoliciesInterfaceCreateOrUpdateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public -export interface SecurityPoliciesInterfaceDeleteOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public -export interface SecurityPoliciesInterfaceGetOptionalParams extends OperationOptions { -} - -// @public -export interface SecurityPoliciesInterfaceListByTrafficControllerOptionalParams extends OperationOptions { -} - -// @public -export interface SecurityPoliciesInterfaceOperations { - createOrUpdate: (resourceGroupName: string, trafficControllerName: string, securityPolicyName: string, resource: SecurityPolicy, options?: SecurityPoliciesInterfaceCreateOrUpdateOptionalParams) => PollerLike, SecurityPolicy>; - delete: (resourceGroupName: string, trafficControllerName: string, securityPolicyName: string, options?: SecurityPoliciesInterfaceDeleteOptionalParams) => PollerLike, void>; - get: (resourceGroupName: string, trafficControllerName: string, securityPolicyName: string, options?: SecurityPoliciesInterfaceGetOptionalParams) => Promise; - listByTrafficController: (resourceGroupName: string, trafficControllerName: string, options?: SecurityPoliciesInterfaceListByTrafficControllerOptionalParams) => PagedAsyncIterableIterator; - update: (resourceGroupName: string, trafficControllerName: string, securityPolicyName: string, properties: SecurityPolicyUpdate, options?: SecurityPoliciesInterfaceUpdateOptionalParams) => Promise; -} - -// @public -export interface SecurityPoliciesInterfaceUpdateOptionalParams extends OperationOptions { -} - -// @public -export interface SecurityPolicy extends TrackedResource { - properties?: SecurityPolicyProperties; -} - -// @public -export interface SecurityPolicyConfigurations { - wafSecurityPolicy?: WafSecurityPolicy; -} - -// @public -export interface SecurityPolicyProperties { - readonly policyType?: PolicyType; - readonly provisioningState?: ProvisioningState; - wafPolicy?: WafPolicy; -} - -// @public -export interface SecurityPolicyUpdate { - properties?: SecurityPolicyUpdateProperties; - tags?: Record; -} - -// @public -export interface SecurityPolicyUpdateProperties { - wafPolicy?: WafPolicy; -} - -// @public (undocumented) -export class ServiceNetworkingManagementClient { - constructor(credential: TokenCredential, subscriptionId: string, options?: ServiceNetworkingManagementClientOptionalParams); - readonly associationsInterface: AssociationsInterfaceOperations; - readonly frontendsInterface: FrontendsInterfaceOperations; - readonly operations: OperationsOperations; - readonly pipeline: Pipeline; - readonly securityPoliciesInterface: SecurityPoliciesInterfaceOperations; - readonly trafficControllerInterface: TrafficControllerInterfaceOperations; -} - -// @public -export interface ServiceNetworkingManagementClientOptionalParams extends ClientOptions { - apiVersion?: string; -} - -// @public -export interface SystemData { - createdAt?: Date; - createdBy?: string; - createdByType?: CreatedByType; - lastModifiedAt?: Date; - lastModifiedBy?: string; - lastModifiedByType?: CreatedByType; -} - -// @public -export interface TrackedResource extends Resource { - location: string; - tags?: Record; -} - -// @public -export interface TrafficController extends TrackedResource { - properties?: TrafficControllerProperties; -} - -// @public -export interface TrafficControllerInterfaceCreateOrUpdateOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public -export interface TrafficControllerInterfaceDeleteOptionalParams extends OperationOptions { - updateIntervalInMs?: number; -} - -// @public -export interface TrafficControllerInterfaceGetOptionalParams extends OperationOptions { -} - -// @public -export interface TrafficControllerInterfaceListByResourceGroupOptionalParams extends OperationOptions { -} - -// @public -export interface TrafficControllerInterfaceListBySubscriptionOptionalParams extends OperationOptions { -} - -// @public -export interface TrafficControllerInterfaceOperations { - createOrUpdate: (resourceGroupName: string, trafficControllerName: string, resource: TrafficController, options?: TrafficControllerInterfaceCreateOrUpdateOptionalParams) => PollerLike, TrafficController>; - delete: (resourceGroupName: string, trafficControllerName: string, options?: TrafficControllerInterfaceDeleteOptionalParams) => PollerLike, void>; - get: (resourceGroupName: string, trafficControllerName: string, options?: TrafficControllerInterfaceGetOptionalParams) => Promise; - listByResourceGroup: (resourceGroupName: string, options?: TrafficControllerInterfaceListByResourceGroupOptionalParams) => PagedAsyncIterableIterator; - listBySubscription: (options?: TrafficControllerInterfaceListBySubscriptionOptionalParams) => PagedAsyncIterableIterator; - update: (resourceGroupName: string, trafficControllerName: string, properties: TrafficControllerUpdate, options?: TrafficControllerInterfaceUpdateOptionalParams) => Promise; -} - -// @public -export interface TrafficControllerInterfaceUpdateOptionalParams extends OperationOptions { -} - -// @public -export interface TrafficControllerProperties { - readonly associations?: ResourceId[]; - readonly configurationEndpoints?: string[]; - readonly frontends?: ResourceId[]; - readonly provisioningState?: ProvisioningState; - readonly securityPolicies?: ResourceId[]; - securityPolicyConfigurations?: SecurityPolicyConfigurations; -} - -// @public -export interface TrafficControllerUpdate { - properties?: TrafficControllerUpdateProperties; - tags?: Record; -} - -// @public -export interface TrafficControllerUpdateProperties { - securityPolicyConfigurations?: SecurityPolicyConfigurations; -} - -// @public -export interface WafPolicy { - id: string; -} - -// @public -export interface WafSecurityPolicy { - id: string; -} - -// (No @packageDocumentation comment for this package) - -``` diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceCreateOrUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceCreateOrUpdateSample.ts deleted file mode 100644 index 6ffd824da6..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceCreateOrUpdateSample.ts +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to create a Association - * - * @summary create a Association - * x-ms-original-file: 2025-01-01/AssociationPut.json - */ -async function putAssociation(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.associationsInterface.createOrUpdate( - "rg1", - "tc1", - "as1", - { - location: "NorthCentralUS", - properties: { - associationType: "subnets", - subnet: { - id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet", - }, - }, - }, - ); - console.log(result); -} - -async function main(): Promise { - await putAssociation(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceDeleteSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceDeleteSample.ts deleted file mode 100644 index e988ac66a2..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceDeleteSample.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to delete a Association - * - * @summary delete a Association - * x-ms-original-file: 2025-01-01/AssociationDelete.json - */ -async function deleteAssociation(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - await client.associationsInterface.delete("rg1", "tc1", "as1"); -} - -async function main(): Promise { - await deleteAssociation(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceGetSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceGetSample.ts deleted file mode 100644 index 59a96a004d..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceGetSample.ts +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to get a Association - * - * @summary get a Association - * x-ms-original-file: 2025-01-01/AssociationGet.json - */ -async function getAssociation(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.associationsInterface.get("rg1", "tc1", "as1"); - console.log(result); -} - -async function main(): Promise { - await getAssociation(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceListByTrafficControllerSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceListByTrafficControllerSample.ts deleted file mode 100644 index 5eab3f941e..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceListByTrafficControllerSample.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list Association resources by TrafficController - * - * @summary list Association resources by TrafficController - * x-ms-original-file: 2025-01-01/AssociationsGet.json - */ -async function getAssociations(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (let item of client.associationsInterface.listByTrafficController( - "rg1", - "tc1", - )) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main(): Promise { - await getAssociations(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceUpdateSample.ts deleted file mode 100644 index 1fbf49bd97..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceAssociationsInterfaceUpdateSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to update a Association - * - * @summary update a Association - * x-ms-original-file: 2025-01-01/AssociationPatch.json - */ -async function updateAssociation(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.associationsInterface.update( - "rg1", - "tc1", - "as1", - { - properties: { - associationType: "subnets", - subnet: { - id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet", - }, - }, - }, - ); - console.log(result); -} - -async function main(): Promise { - await updateAssociation(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceCreateOrUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceCreateOrUpdateSample.ts deleted file mode 100644 index a2caaf847f..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceCreateOrUpdateSample.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to create a Frontend - * - * @summary create a Frontend - * x-ms-original-file: 2025-01-01/FrontendPut.json - */ -async function putFrontend(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.frontendsInterface.createOrUpdate( - "rg1", - "tc1", - "fe1", - { location: "NorthCentralUS", properties: {} }, - ); - console.log(result); -} - -async function main(): Promise { - await putFrontend(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceDeleteSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceDeleteSample.ts deleted file mode 100644 index f3294e4006..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceDeleteSample.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to delete a Frontend - * - * @summary delete a Frontend - * x-ms-original-file: 2025-01-01/FrontendDelete.json - */ -async function deleteFrontend(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - await client.frontendsInterface.delete("rg1", "tc1", "fe1"); -} - -async function main(): Promise { - await deleteFrontend(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceGetSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceGetSample.ts deleted file mode 100644 index cb7d7038e5..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceGetSample.ts +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to get a Frontend - * - * @summary get a Frontend - * x-ms-original-file: 2025-01-01/FrontendGet.json - */ -async function getFrontend(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.frontendsInterface.get("rg1", "tc1", "fe1"); - console.log(result); -} - -async function main(): Promise { - await getFrontend(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceListByTrafficControllerSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceListByTrafficControllerSample.ts deleted file mode 100644 index b33e3af518..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceListByTrafficControllerSample.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list Frontend resources by TrafficController - * - * @summary list Frontend resources by TrafficController - * x-ms-original-file: 2025-01-01/FrontendsGet.json - */ -async function getFrontends(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (let item of client.frontendsInterface.listByTrafficController( - "rg1", - "tc1", - )) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main(): Promise { - await getFrontends(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceUpdateSample.ts deleted file mode 100644 index a3f4a350b2..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceFrontendsInterfaceUpdateSample.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to update a Frontend - * - * @summary update a Frontend - * x-ms-original-file: 2025-01-01/FrontendPatch.json - */ -async function updateFrontend(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.frontendsInterface.update( - "rg1", - "tc1", - "fe1", - {}, - ); - console.log(result); -} - -async function main(): Promise { - await updateFrontend(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/operationsOperationsListSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/operationsOperationsListSample.ts deleted file mode 100644 index 8787256f50..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/operationsOperationsListSample.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list the operations for the provider - * - * @summary list the operations for the provider - * x-ms-original-file: 2025-01-01/OperationsList.json - */ -async function getOperationsList(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "00000000-0000-0000-0000-00000000000"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main(): Promise { - await getOperationsList(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceCreateOrUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceCreateOrUpdateSample.ts deleted file mode 100644 index f2708e61c4..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceCreateOrUpdateSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to create a SecurityPolicy - * - * @summary create a SecurityPolicy - * x-ms-original-file: 2025-01-01/SecurityPolicyPut.json - */ -async function putSecurityPolicy(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.securityPoliciesInterface.createOrUpdate( - "rg1", - "tc1", - "sp1", - { - location: "NorthCentralUS", - properties: { - wafPolicy: { - id: "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0", - }, - }, - }, - ); - console.log(result); -} - -async function main(): Promise { - await putSecurityPolicy(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceDeleteSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceDeleteSample.ts deleted file mode 100644 index b63783a380..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceDeleteSample.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to delete a SecurityPolicy - * - * @summary delete a SecurityPolicy - * x-ms-original-file: 2025-01-01/SecurityPolicyDelete.json - */ -async function deleteSecurityPolicy(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - await client.securityPoliciesInterface.delete("rg1", "tc1", "sp1"); -} - -async function main(): Promise { - await deleteSecurityPolicy(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceGetSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceGetSample.ts deleted file mode 100644 index 3d4b439403..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceGetSample.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to get a SecurityPolicy - * - * @summary get a SecurityPolicy - * x-ms-original-file: 2025-01-01/SecurityPolicyGet.json - */ -async function getSecurityPolicy(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.securityPoliciesInterface.get( - "rg1", - "tc1", - "sp1", - ); - console.log(result); -} - -async function main(): Promise { - await getSecurityPolicy(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceListByTrafficControllerSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceListByTrafficControllerSample.ts deleted file mode 100644 index 953a0fde95..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceListByTrafficControllerSample.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list SecurityPolicy resources by TrafficController - * - * @summary list SecurityPolicy resources by TrafficController - * x-ms-original-file: 2025-01-01/SecurityPoliciesGetList.json - */ -async function getSecurityPolicies(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (let item of client.securityPoliciesInterface.listByTrafficController( - "rg1", - "tc1", - )) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main(): Promise { - await getSecurityPolicies(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceUpdateSample.ts deleted file mode 100644 index 38092cb526..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceSecurityPoliciesInterfaceUpdateSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to update a SecurityPolicy - * - * @summary update a SecurityPolicy - * x-ms-original-file: 2025-01-01/SecurityPolicyPatch.json - */ -async function updateSecurityPolicy(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.securityPoliciesInterface.update( - "rg1", - "tc1", - "sp1", - { - properties: { - wafPolicy: { - id: "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0", - }, - }, - }, - ); - console.log(result); -} - -async function main(): Promise { - await updateSecurityPolicy(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceCreateOrUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceCreateOrUpdateSample.ts deleted file mode 100644 index f72496173b..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceCreateOrUpdateSample.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to create a TrafficController - * - * @summary create a TrafficController - * x-ms-original-file: 2025-01-01/TrafficControllerPut.json - */ -async function putTrafficController(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.trafficControllerInterface.createOrUpdate( - "rg1", - "tc1", - { location: "NorthCentralUS", tags: { key1: "value1" } }, - ); - console.log(result); -} - -async function main(): Promise { - await putTrafficController(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceDeleteSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceDeleteSample.ts deleted file mode 100644 index c65f924466..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceDeleteSample.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to delete a TrafficController - * - * @summary delete a TrafficController - * x-ms-original-file: 2025-01-01/TrafficControllerDelete.json - */ -async function deleteTrafficController(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - await client.trafficControllerInterface.delete("rg1", "tc1"); -} - -async function main(): Promise { - await deleteTrafficController(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceGetSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceGetSample.ts deleted file mode 100644 index 7197624b99..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceGetSample.ts +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to get a TrafficController - * - * @summary get a TrafficController - * x-ms-original-file: 2025-01-01/TrafficControllerGet.json - */ -async function getTrafficController(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.trafficControllerInterface.get("rg1", "tc1"); - console.log(result); -} - -async function main(): Promise { - await getTrafficController(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListByResourceGroupSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListByResourceGroupSample.ts deleted file mode 100644 index bc97c1ecf1..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListByResourceGroupSample.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list TrafficController resources by resource group - * - * @summary list TrafficController resources by resource group - * x-ms-original-file: 2025-01-01/TrafficControllersGet.json - */ -async function getTrafficControllers(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (let item of client.trafficControllerInterface.listByResourceGroup( - "rg1", - )) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main(): Promise { - await getTrafficControllers(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListBySubscriptionSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListBySubscriptionSample.ts deleted file mode 100644 index 1638b0ac37..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceListBySubscriptionSample.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list TrafficController resources by subscription ID - * - * @summary list TrafficController resources by subscription ID - * x-ms-original-file: 2025-01-01/TrafficControllersGetList.json - */ -async function getTrafficControllersList(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (let item of client.trafficControllerInterface.listBySubscription()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main(): Promise { - await getTrafficControllersList(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceUpdateSample.ts deleted file mode 100644 index 5f31dd4e80..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceTrafficControllerInterfaceUpdateSample.ts +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to update a TrafficController - * - * @summary update a TrafficController - * x-ms-original-file: 2025-01-01/TrafficControllerPatch.json - */ -async function patchTrafficController(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.trafficControllerInterface.update("rg1", "tc1", { - tags: { key1: "value1" }, - }); - console.log(result); -} - -async function main(): Promise { - await patchTrafficController(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/tspconfig.yaml b/packages/typespec-test/test/ServiceNetworking.Management/tspconfig.yaml index 511fcfb8c9..05e7747c8e 100644 --- a/packages/typespec-test/test/ServiceNetworking.Management/tspconfig.yaml +++ b/packages/typespec-test/test/ServiceNetworking.Management/tspconfig.yaml @@ -8,6 +8,7 @@ options: azureSdkForJs: false hierarchyClient: false experimentalExtensibleEnums: true + enableOperationGroup: true "emitter-output-dir": "{project-root}/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking" packageDetails: name: "@azure/arm-servicenetworking" diff --git a/packages/typespec-ts/test/modularUnit/scenarios/samples/client/disableHierarchy/enableOperationGroup.md b/packages/typespec-ts/test/modularUnit/scenarios/samples/client/disableHierarchy/enableOperationGroup.md index bb2c1a394b..6357be9bd8 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/samples/client/disableHierarchy/enableOperationGroup.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/samples/client/disableHierarchy/enableOperationGroup.md @@ -98,7 +98,7 @@ Raw json files. Generated samples. ```ts samples -/** This file path is /samples-dev/cFooSample.ts */ +/** This file path is /samples-dev/bCFooSample.ts */ import { TestingClient } from "@azure/internal-test"; /** @@ -109,7 +109,7 @@ import { TestingClient } from "@azure/internal-test"; */ async function foo(): Promise { const client = new TestingClient(); - const result = await client.c.foo({ prop2: "body name" }); + const result = await client.b.c.foo({ prop2: "body name" }); console.log(result); } diff --git a/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/disableHierarchyArmCurdOperations.md b/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/disableHierarchyArmCurdOperations.md new file mode 100644 index 0000000000..1a9a366a93 --- /dev/null +++ b/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/disableHierarchyArmCurdOperations.md @@ -0,0 +1,199 @@ +# Should generate samples for ARM operations disabled hierarchy client + +Sample generation should arm template and operations successfully disabled hierarchy client. + +## TypeSpec + +This is tsp definition. + +```tsp +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Azure.Core; +using Azure.ResourceManager; + +/** Microsoft.Contoso Resource Provider management API. */ +@armProviderNamespace +@service({ + title: "Microsoft.Contoso management service", +}) +@versioned(Microsoft.Contoso.Versions) +namespace Microsoft.Contoso; + +/** The available API versions. */ +enum Versions { + /** 2021-10-01-preview version */ + @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) + @useDependency(Azure.Core.Versions.v1_0_Preview_2) + @armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5) + v2021_10_01_preview: "2021-10-01-preview", +} + +interface Operations extends Azure.ResourceManager.Operations {} + +/** Employee resource */ +model Employee is TrackedResource { + ...ResourceNameParameter; +} + +/** Employee properties */ +model EmployeeProperties { + /** Age of employee */ + age?: int32; + + /** City of employee */ + city?: string; + + /** Profile of employee */ + @encode("base64url") + profile?: bytes; + + /** The status of the last operation. */ + @visibility("read") + provisioningState?: ProvisioningState; +} + +/** The resource provisioning state. */ +@lroStatus +union ProvisioningState { + ResourceProvisioningState, + + /** The resource is being provisioned */ + Provisioning: "Provisioning", + + /** The resource is updating */ + Updating: "Updating", + + /** The resource is being deleted */ + Deleting: "Deleting", + + /** The resource create request has been accepted */ + Accepted: "Accepted", + + string, +} + +@armResourceOperations +interface Employees { + get is ArmResourceRead; + createOrUpdate is ArmResourceCreateOrReplaceAsync; + delete is ArmResourceDeleteWithoutOkAsync; +} +``` +This is the tspconfig.yaml. + +```yaml +hierarchyClient: false +``` + +## Example + +Raw json files. + +```json for Operations_List +{ + "title": "Operations_List", + "operationId": "Operations_List", + "parameters": { + "api-version": "2021-10-01-preview" + }, + "responses": { + "200": { + "body": {} + } + } +} +``` + +Generate samples for arm cases: + +```ts samples + +``` + +Raw json files. + +```json for Employees_CreateOrUpdate +{ + "title": "Employees_CreateOrUpdate", + "operationId": "Employees_CreateOrUpdate", + "parameters": { + "api-version": "2021-10-01-preview", + "subscriptionId": "11809CA1-E126-4017-945E-AA795CD5C5A9", + "resourceGroupName": "rgopenapi", + "employeeName": "9KF-f-8b", + "resource": { + "properties": { + "age": 30, + "city": "gydhnntudughbmxlkyzrskcdkotrxn", + "profile": "ms" + }, + "tags": { + "key2913": "urperxmkkhhkp" + }, + "location": "itajgxyqozseoygnl" + } + }, + "responses": { + "200": {} + } +} +``` + +Generate samples for arm cases: + +```ts samples + +``` + +Raw json files. + +```json for Employees_Delete +{ + "title": "Employees_Delete", + "operationId": "Employees_Delete", + "parameters": { + "api-version": "2021-10-01-preview", + "subscriptionId": "11809CA1-E126-4017-945E-AA795CD5C5A9", + "resourceGroupName": "rgopenapi", + "employeeName": "5vX--BxSu3ux48rI4O9OQ569" + }, + "responses": { + "202": {} + } +} +``` + +Generate samples for arm cases: + +```ts samples +/** This file path is /samples-dev/employeesDeleteSample.ts */ +import { ContosoClient } from "@azure/internal-test"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to delete a Employee + * + * @summary delete a Employee + * x-ms-original-file: 2021-10-01-preview/json_for_Employees_Delete.json + */ +async function employeesDelete(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11809CA1-E126-4017-945E-AA795CD5C5A9"; + const client = new ContosoClient(credential, subscriptionId); + await client.employees.delete("rgopenapi", "5vX--BxSu3ux48rI4O9OQ569"); +} + +async function main(): Promise { + await employeesDelete(); +} + +main().catch(console.error); +``` From 994f90679867a60de84fefff86985b2af94a501e Mon Sep 17 00:00:00 2001 From: Qiaoqiao Zhang Date: Thu, 13 Feb 2025 14:50:06 +0800 Subject: [PATCH 5/9] fix operation name missing --- .../typespec-ts/src/modular/emitSamples.ts | 7 ++- .../samples/operations/armCurdOperations.md | 30 ++++----- .../disableHierarchyArmCurdOperations.md | 63 ++++++++++++++++++- .../samples/operations/dpgCurdOperations.md | 56 ++++++++--------- .../operations/multipleExamplesInOneFile.md | 42 +++++-------- 5 files changed, 122 insertions(+), 76 deletions(-) diff --git a/packages/typespec-ts/src/modular/emitSamples.ts b/packages/typespec-ts/src/modular/emitSamples.ts index 5c7148f6c0..6042e54c68 100644 --- a/packages/typespec-ts/src/modular/emitSamples.ts +++ b/packages/typespec-ts/src/modular/emitSamples.ts @@ -105,7 +105,7 @@ function emitMethodSamples( } const project = useContext("outputProject"); const operationPrefix = `${options.classicalMethodPrefix ?? ""} ${ - method.oriName + method.oriName ?? method.name }`; const sampleFolder = join( dpgContext.generationPathDetail?.rootDir ?? "", @@ -186,7 +186,7 @@ function emitMethodSamples( ? `${options.classicalMethodPrefix}.` : ""; const isPaging = method.kind === "paging"; - const methodCall = `client.${prefix}${normalizeName(method.oriName ?? "", NameType.Property)}(${methodParams.join( + const methodCall = `client.${prefix}${normalizeName(method.oriName ?? method.name, NameType.Property)}(${methodParams.join( ", " )})`; if (isPaging) { @@ -204,7 +204,8 @@ function emitMethodSamples( } // Create a function declaration structure - const description = method.doc ?? `execute ${method.oriName}`; + const description = + method.doc ?? `execute ${method.oriName ?? method.name}`; const normalizedDescription = description.charAt(0).toLowerCase() + description.slice(1); const functionDeclaration: FunctionDeclarationStructure = { diff --git a/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/armCurdOperations.md b/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/armCurdOperations.md index d386c36bbe..336b5ad30a 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/armCurdOperations.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/armCurdOperations.md @@ -110,7 +110,7 @@ Raw json files. Generate samples for arm cases: ```ts samples -/** This file path is /samples-dev/operationsListSample.ts */ +/** This file path is /samples-dev/listSample.ts */ import { ContosoClient } from "@azure/internal-test"; import { DefaultAzureCredential } from "@azure/identity"; @@ -125,7 +125,7 @@ async function operationsList(): Promise { const subscriptionId = "00000000-0000-0000-0000-00000000000"; const client = new ContosoClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.operations.list()) { + for await (let item of client.list()) { resArray.push(item); } @@ -171,7 +171,7 @@ Raw json files. Generate samples for arm cases: ```ts samples -/** This file path is /samples-dev/employeesCreateOrUpdateSample.ts */ +/** This file path is /samples-dev/createOrUpdateSample.ts */ import { ContosoClient } from "@azure/internal-test"; import { DefaultAzureCredential } from "@azure/identity"; @@ -185,19 +185,15 @@ async function employeesCreateOrUpdate(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "11809CA1-E126-4017-945E-AA795CD5C5A9"; const client = new ContosoClient(credential, subscriptionId); - const result = await client.employees.createOrUpdate( - "rgopenapi", - "9KF-f-8b", - { - properties: { - age: 30, - city: "gydhnntudughbmxlkyzrskcdkotrxn", - profile: "ms", - }, - tags: { key2913: "urperxmkkhhkp" }, - location: "itajgxyqozseoygnl", + const result = await client.createOrUpdate("rgopenapi", "9KF-f-8b", { + properties: { + age: 30, + city: "gydhnntudughbmxlkyzrskcdkotrxn", + profile: "ms", }, - ); + tags: { key2913: "urperxmkkhhkp" }, + location: "itajgxyqozseoygnl", + }); console.log(result); } @@ -229,7 +225,7 @@ Raw json files. Generate samples for arm cases: ```ts samples -/** This file path is /samples-dev/employeesDeleteSample.ts */ +/** This file path is /samples-dev/deleteSample.ts */ import { ContosoClient } from "@azure/internal-test"; import { DefaultAzureCredential } from "@azure/identity"; @@ -243,7 +239,7 @@ async function employeesDelete(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "11809CA1-E126-4017-945E-AA795CD5C5A9"; const client = new ContosoClient(credential, subscriptionId); - await client.employees.delete("rgopenapi", "5vX--BxSu3ux48rI4O9OQ569"); + await client.delete("rgopenapi", "5vX--BxSu3ux48rI4O9OQ569"); } async function main(): Promise { diff --git a/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/disableHierarchyArmCurdOperations.md b/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/disableHierarchyArmCurdOperations.md index 1a9a366a93..f2f384f33b 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/disableHierarchyArmCurdOperations.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/disableHierarchyArmCurdOperations.md @@ -1,4 +1,4 @@ -# Should generate samples for ARM operations disabled hierarchy client +# only: Should generate samples for ARM operations disabled hierarchy client Sample generation should arm template and operations successfully disabled hierarchy client. @@ -87,6 +87,7 @@ interface Employees { delete is ArmResourceDeleteWithoutOkAsync; } ``` + This is the tspconfig.yaml. ```yaml @@ -115,7 +116,33 @@ Raw json files. Generate samples for arm cases: ```ts samples +/** This file path is /samples-dev/listSample.ts */ +import { ContosoClient } from "@azure/internal-test"; +import { DefaultAzureCredential } from "@azure/identity"; + +/** + * This sample demonstrates how to list the operations for the provider + * + * @summary list the operations for the provider + * x-ms-original-file: 2021-10-01-preview/json_for_Operations_List.json + */ +async function operationsList(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "00000000-0000-0000-0000-00000000000"; + const client = new ContosoClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.list()) { + resArray.push(item); + } + + console.log(resArray); +} + +async function main(): Promise { + await operationsList(); +} +main().catch(console.error); ``` Raw json files. @@ -150,7 +177,37 @@ Raw json files. Generate samples for arm cases: ```ts samples +/** This file path is /samples-dev/createOrUpdateSample.ts */ +import { ContosoClient } from "@azure/internal-test"; +import { DefaultAzureCredential } from "@azure/identity"; +/** + * This sample demonstrates how to create a Employee + * + * @summary create a Employee + * x-ms-original-file: 2021-10-01-preview/json_for_Employees_CreateOrUpdate.json + */ +async function employeesCreateOrUpdate(): Promise { + const credential = new DefaultAzureCredential(); + const subscriptionId = "11809CA1-E126-4017-945E-AA795CD5C5A9"; + const client = new ContosoClient(credential, subscriptionId); + const result = await client.createOrUpdate("rgopenapi", "9KF-f-8b", { + properties: { + age: 30, + city: "gydhnntudughbmxlkyzrskcdkotrxn", + profile: "ms" + }, + tags: { key2913: "urperxmkkhhkp" }, + location: "itajgxyqozseoygnl" + }); + console.log(result); +} + +async function main(): Promise { + await employeesCreateOrUpdate(); +} + +main().catch(console.error); ``` Raw json files. @@ -174,7 +231,7 @@ Raw json files. Generate samples for arm cases: ```ts samples -/** This file path is /samples-dev/employeesDeleteSample.ts */ +/** This file path is /samples-dev/deleteSample.ts */ import { ContosoClient } from "@azure/internal-test"; import { DefaultAzureCredential } from "@azure/identity"; @@ -188,7 +245,7 @@ async function employeesDelete(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "11809CA1-E126-4017-945E-AA795CD5C5A9"; const client = new ContosoClient(credential, subscriptionId); - await client.employees.delete("rgopenapi", "5vX--BxSu3ux48rI4O9OQ569"); + await client.delete("rgopenapi", "5vX--BxSu3ux48rI4O9OQ569"); } async function main(): Promise { diff --git a/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/dpgCurdOperations.md b/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/dpgCurdOperations.md index a2bf2f7297..bad65a6c09 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/dpgCurdOperations.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/dpgCurdOperations.md @@ -126,32 +126,38 @@ Raw json files. Generate samples for dpg cases: ```ts samples -/** This file path is /samples-dev/widgetsCreateOrUpdateWidgetSample.ts */ +/** This file path is /samples-dev/listWidgetsSample.ts */ import { WidgetManagerClient } from "@azure/internal-test"; import { DefaultAzureCredential } from "@azure/identity"; /** - * This sample demonstrates how to creates or updates a Widget asynchronously. + * This sample demonstrates how to list Widget resources * - * @summary creates or updates a Widget asynchronously. - * x-ms-original-file: 2021-10-01-preview/json_for_Widgets_CreateOrUpdateWidget.json + * @summary list Widget resources + * x-ms-original-file: 2021-10-01-preview/json_for_Widgets_ListWidgets.json */ -async function widgetsCreateOrUpdateWidget(): Promise { +async function widgetsListWidgets(): Promise { const credential = new DefaultAzureCredential(); const client = new WidgetManagerClient(credential); - const result = await client.widgets.createOrUpdateWidget("name1", { - manufacturerId: "manufacturer id1", - }); - console.log(result); + const resArray = new Array(); + for await (let item of client.listWidgets({ + top: 8, + skip: 15, + maxpagesize: 27, + })) { + resArray.push(item); + } + + console.log(resArray); } async function main(): Promise { - await widgetsCreateOrUpdateWidget(); + await widgetsListWidgets(); } main().catch(console.error); -/** This file path is /samples-dev/widgetsDeleteWidgetSample.ts */ +/** This file path is /samples-dev/deleteWidgetSample.ts */ import { WidgetManagerClient } from "@azure/internal-test"; import { DefaultAzureCredential } from "@azure/identity"; @@ -164,7 +170,7 @@ import { DefaultAzureCredential } from "@azure/identity"; async function deleteWidgetByWidgetNameUsingLongRunningOperation(): Promise { const credential = new DefaultAzureCredential(); const client = new WidgetManagerClient(credential); - const result = await client.widgets.deleteWidget("searchbox"); + const result = await client.deleteWidget("searchbox"); console.log(result); } @@ -174,33 +180,27 @@ async function main(): Promise { main().catch(console.error); -/** This file path is /samples-dev/widgetsListWidgetsSample.ts */ +/** This file path is /samples-dev/createOrUpdateWidgetSample.ts */ import { WidgetManagerClient } from "@azure/internal-test"; import { DefaultAzureCredential } from "@azure/identity"; /** - * This sample demonstrates how to list Widget resources + * This sample demonstrates how to creates or updates a Widget asynchronously. * - * @summary list Widget resources - * x-ms-original-file: 2021-10-01-preview/json_for_Widgets_ListWidgets.json + * @summary creates or updates a Widget asynchronously. + * x-ms-original-file: 2021-10-01-preview/json_for_Widgets_CreateOrUpdateWidget.json */ -async function widgetsListWidgets(): Promise { +async function widgetsCreateOrUpdateWidget(): Promise { const credential = new DefaultAzureCredential(); const client = new WidgetManagerClient(credential); - const resArray = new Array(); - for await (let item of client.widgets.listWidgets({ - top: 8, - skip: 15, - maxpagesize: 27, - })) { - resArray.push(item); - } - - console.log(resArray); + const result = await client.createOrUpdateWidget("name1", { + manufacturerId: "manufacturer id1", + }); + console.log(result); } async function main(): Promise { - await widgetsListWidgets(); + await widgetsCreateOrUpdateWidget(); } main().catch(console.error); diff --git a/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/multipleExamplesInOneFile.md b/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/multipleExamplesInOneFile.md index 345b92dc7a..9c71aa3289 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/multipleExamplesInOneFile.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/multipleExamplesInOneFile.md @@ -149,7 +149,7 @@ Raw json files. Generate one file for multiple samples: ```ts samples -/** This file path is /samples-dev/employeesCreateOrUpdateSample.ts */ +/** This file path is /samples-dev/createOrUpdateSample.ts */ import { ContosoClient } from "@azure/internal-test"; import { DefaultAzureCredential } from "@azure/identity"; @@ -163,19 +163,15 @@ async function employeesCreateOrUpdateMaxage(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "11809CA1-E126-4017-945E-AA795CD5C5A9"; const client = new ContosoClient(credential, subscriptionId); - const result = await client.employees.createOrUpdate( - "rgopenapi", - "9KF-f-8b", - { - properties: { - age: 110, - city: "gydhnntudughbmxlkyzrskcdkotrxn", - profile: "ms", - }, - tags: { key2913: "urperxmkkhhkp" }, - location: "itajgxyqozseoygnl", + const result = await client.createOrUpdate("rgopenapi", "9KF-f-8b", { + properties: { + age: 110, + city: "gydhnntudughbmxlkyzrskcdkotrxn", + profile: "ms", }, - ); + tags: { key2913: "urperxmkkhhkp" }, + location: "itajgxyqozseoygnl", + }); console.log(result); } @@ -189,19 +185,15 @@ async function employeesCreateOrUpdateMinage(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "11809CA1-E126-4017-945E-AA795CD5C5A9"; const client = new ContosoClient(credential, subscriptionId); - const result = await client.employees.createOrUpdate( - "rgopenapi", - "9KF-f-8b", - { - properties: { - age: 1, - city: "gydhnntudughbmxlkyzrskcdkotrxn", - profile: "ms", - }, - tags: { key2913: "urperxmkkhhkp" }, - location: "itajgxyqozseoygnl", + const result = await client.createOrUpdate("rgopenapi", "9KF-f-8b", { + properties: { + age: 1, + city: "gydhnntudughbmxlkyzrskcdkotrxn", + profile: "ms", }, - ); + tags: { key2913: "urperxmkkhhkp" }, + location: "itajgxyqozseoygnl", + }); console.log(result); } From 80301932917a0456a452d729407a529034aa41ec Mon Sep 17 00:00:00 2001 From: Qiaoqiao Zhang Date: Thu, 13 Feb 2025 14:55:04 +0800 Subject: [PATCH 6/9] fix hierarchy false operation group true --- packages/typespec-ts/src/utils/operationUtil.ts | 14 +++++++++----- .../disableHierarchy/enableOperationGroup.md | 4 ++-- .../disableHierarchyArmCurdOperations.md | 6 +++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/packages/typespec-ts/src/utils/operationUtil.ts b/packages/typespec-ts/src/utils/operationUtil.ts index 9958b8ce22..f530aba2dc 100644 --- a/packages/typespec-ts/src/utils/operationUtil.ts +++ b/packages/typespec-ts/src/utils/operationUtil.ts @@ -290,9 +290,9 @@ export function extractOperationLroDetail( const metadata = getLroMetadata(dpgContext.program, operation.operation); precedence = metadata?.finalStep && - metadata.finalStep.kind === "pollingSuccessProperty" && - metadata?.finalStep.target && - metadata?.finalStep?.target?.name === "result" + metadata.finalStep.kind === "pollingSuccessProperty" && + metadata?.finalStep.target && + metadata?.finalStep?.target?.name === "result" ? OPERATION_LRO_HIGH_PRIORITY : OPERATION_LRO_LOW_PRIORITY; } @@ -576,7 +576,11 @@ export function getMethodHierarchiesMap( if (!method) { continue; } - const prefixes = method[0]; + const prefixes = + context.rlcOptions?.hierarchyClient === false && + context.rlcOptions?.enableOperationGroup + ? [method[0][method[0].length - 1] as string] + : method[0]; const operationOrGroup = method[1]; if (operationOrGroup.kind === "clientaccessor") { @@ -586,7 +590,7 @@ export function getMethodHierarchiesMap( } else { const prefixKey = context.rlcOptions?.hierarchyClient || - context.rlcOptions?.enableOperationGroup + context.rlcOptions?.enableOperationGroup ? prefixes.join("/") : ""; const groupName = prefixes diff --git a/packages/typespec-ts/test/modularUnit/scenarios/samples/client/disableHierarchy/enableOperationGroup.md b/packages/typespec-ts/test/modularUnit/scenarios/samples/client/disableHierarchy/enableOperationGroup.md index 6357be9bd8..bb2c1a394b 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/samples/client/disableHierarchy/enableOperationGroup.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/samples/client/disableHierarchy/enableOperationGroup.md @@ -98,7 +98,7 @@ Raw json files. Generated samples. ```ts samples -/** This file path is /samples-dev/bCFooSample.ts */ +/** This file path is /samples-dev/cFooSample.ts */ import { TestingClient } from "@azure/internal-test"; /** @@ -109,7 +109,7 @@ import { TestingClient } from "@azure/internal-test"; */ async function foo(): Promise { const client = new TestingClient(); - const result = await client.b.c.foo({ prop2: "body name" }); + const result = await client.c.foo({ prop2: "body name" }); console.log(result); } diff --git a/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/disableHierarchyArmCurdOperations.md b/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/disableHierarchyArmCurdOperations.md index f2f384f33b..a7d6cef7ac 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/disableHierarchyArmCurdOperations.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/disableHierarchyArmCurdOperations.md @@ -1,4 +1,4 @@ -# only: Should generate samples for ARM operations disabled hierarchy client +# Should generate samples for ARM operations disabled hierarchy client Sample generation should arm template and operations successfully disabled hierarchy client. @@ -195,10 +195,10 @@ async function employeesCreateOrUpdate(): Promise { properties: { age: 30, city: "gydhnntudughbmxlkyzrskcdkotrxn", - profile: "ms" + profile: "ms", }, tags: { key2913: "urperxmkkhhkp" }, - location: "itajgxyqozseoygnl" + location: "itajgxyqozseoygnl", }); console.log(result); } From 404968746da2e535917f494d1919eae58e34f0c0 Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Thu, 13 Feb 2025 15:44:47 +0800 Subject: [PATCH 7/9] remove servicenetworking smoke --- .../arm-servicenetworking/LICENSE | 21 - .../arm-servicenetworking/README.md | 106 -- .../arm-servicenetworking/api-extractor.json | 18 - .../arm-servicenetworking/eslint.config.mjs | 14 - .../arm-servicenetworking/package.json | 69 -- .../arm-servicenetworking/rollup.config.js | 118 --- .../arm-servicenetworking/sample.env | 1 - ...sociationsInterfaceCreateOrUpdateSample.ts | 41 - .../associationsInterfaceDeleteSample.ts | 27 - .../associationsInterfaceGetSample.ts | 28 - ...sInterfaceListByTrafficControllerSample.ts | 35 - .../associationsInterfaceUpdateSample.ts | 40 - .../frontendsInterfaceCreateOrUpdateSample.ts | 33 - .../frontendsInterfaceDeleteSample.ts | 27 - .../frontendsInterfaceGetSample.ts | 28 - ...sInterfaceListByTrafficControllerSample.ts | 35 - .../frontendsInterfaceUpdateSample.ts | 33 - .../samples-dev/operationsListSample.ts | 32 - ...tyPoliciesInterfaceCreateOrUpdateSample.ts | 40 - .../securityPoliciesInterfaceDeleteSample.ts | 27 - .../securityPoliciesInterfaceGetSample.ts | 32 - ...sInterfaceListByTrafficControllerSample.ts | 35 - .../securityPoliciesInterfaceUpdateSample.ts | 39 - ...ControllerInterfaceCreateOrUpdateSample.ts | 32 - .../trafficControllerInterfaceDeleteSample.ts | 27 - .../trafficControllerInterfaceGetSample.ts | 28 - ...ollerInterfaceListByResourceGroupSample.ts | 34 - ...rollerInterfaceListBySubscriptionSample.ts | 32 - .../trafficControllerInterfaceUpdateSample.ts | 30 - .../src/api/associationsInterface/index.ts | 353 ------- .../src/api/frontendsInterface/index.ts | 353 ------- .../arm-servicenetworking/src/api/index.ts | 62 -- .../src/api/operations/index.ts | 66 -- .../arm-servicenetworking/src/api/options.ts | 114 -- .../api/securityPoliciesInterface/index.ts | 361 ------- .../api/serviceNetworkingManagementContext.ts | 70 -- .../api/trafficControllerInterface/index.ts | 392 ------- .../classic/associationsInterface/index.ts | 143 --- .../src/classic/frontendsInterface/index.ts | 141 --- .../src/classic/index.ts | 8 - .../src/classic/operations/index.ts | 31 - .../securityPoliciesInterface/index.ts | 143 --- .../trafficControllerInterface/index.ts | 140 --- .../arm-servicenetworking/src/index.ts | 88 -- .../arm-servicenetworking/src/logger.ts | 5 - .../arm-servicenetworking/src/models/index.ts | 47 - .../src/models/models.ts | 987 ------------------ .../src/restorePollerHelpers.ts | 216 ---- .../src/serviceNetworkingManagementClient.ts | 78 -- .../src/static-helpers/pagingHelpers.ts | 274 ----- .../src/static-helpers/pollingHelpers.ts | 137 --- .../test/public/sampleTest.spec.ts | 21 - .../test/public/utils/recordedClient.ts | 29 - .../arm-servicenetworking/tsconfig.json | 24 - .../vitest.browser.config.ts | 38 - .../arm-servicenetworking/vitest.config.ts | 34 - .../spec/client.tsp | 18 - .../2023-11-01/AssociationDelete.json | 20 - .../examples/2023-11-01/AssociationGet.json | 28 - .../examples/2023-11-01/AssociationPatch.json | 35 - .../examples/2023-11-01/AssociationPut.json | 51 - .../examples/2023-11-01/AssociationsGet.json | 31 - .../examples/2023-11-01/FrontendDelete.json | 20 - .../spec/examples/2023-11-01/FrontendGet.json | 25 - .../examples/2023-11-01/FrontendPatch.json | 26 - .../spec/examples/2023-11-01/FrontendPut.json | 41 - .../examples/2023-11-01/FrontendsGet.json | 28 - .../examples/2023-11-01/OperationsList.json | 26 - .../2023-11-01/TrafficControllerDelete.json | 19 - .../2023-11-01/TrafficControllerGet.json | 39 - .../2023-11-01/TrafficControllerPatch.json | 44 - .../2023-11-01/TrafficControllerPut.json | 72 -- .../2023-11-01/TrafficControllersGet.json | 42 - .../2023-11-01/TrafficControllersGetList.json | 41 - .../2024-05-01-preview/AssociationDelete.json | 20 - .../2024-05-01-preview/AssociationGet.json | 28 - .../2024-05-01-preview/AssociationPatch.json | 35 - .../2024-05-01-preview/AssociationPut.json | 51 - .../2024-05-01-preview/AssociationsGet.json | 31 - .../2024-05-01-preview/FrontendDelete.json | 20 - .../2024-05-01-preview/FrontendGet.json | 25 - .../2024-05-01-preview/FrontendPatch.json | 26 - .../2024-05-01-preview/FrontendPut.json | 41 - .../2024-05-01-preview/FrontendsGet.json | 28 - .../2024-05-01-preview/OperationsList.json | 26 - .../SecurityPoliciesGetList.json | 31 - .../SecurityPolicyDelete.json | 20 - .../2024-05-01-preview/SecurityPolicyGet.json | 28 - .../SecurityPolicyPatch.json | 35 - .../2024-05-01-preview/SecurityPolicyPut.json | 51 - .../TrafficControllerDelete.json | 19 - .../TrafficControllerGet.json | 39 - .../TrafficControllerPatch.json | 54 - .../TrafficControllerPut.json | 92 -- .../TrafficControllersGet.json | 52 - .../TrafficControllersGetList.json | 51 - .../2025-01-01/AssociationDelete.json | 20 - .../examples/2025-01-01/AssociationGet.json | 28 - .../examples/2025-01-01/AssociationPatch.json | 35 - .../examples/2025-01-01/AssociationPut.json | 51 - .../examples/2025-01-01/AssociationsGet.json | 31 - .../examples/2025-01-01/FrontendDelete.json | 20 - .../spec/examples/2025-01-01/FrontendGet.json | 25 - .../examples/2025-01-01/FrontendPatch.json | 26 - .../spec/examples/2025-01-01/FrontendPut.json | 41 - .../examples/2025-01-01/FrontendsGet.json | 28 - .../examples/2025-01-01/OperationsList.json | 26 - .../2025-01-01/SecurityPoliciesGetList.json | 31 - .../2025-01-01/SecurityPolicyDelete.json | 20 - .../2025-01-01/SecurityPolicyGet.json | 28 - .../2025-01-01/SecurityPolicyPatch.json | 35 - .../2025-01-01/SecurityPolicyPut.json | 51 - .../2025-01-01/TrafficControllerDelete.json | 19 - .../2025-01-01/TrafficControllerGet.json | 39 - .../2025-01-01/TrafficControllerPatch.json | 54 - .../2025-01-01/TrafficControllerPut.json | 92 -- .../2025-01-01/TrafficControllersGet.json | 52 - .../2025-01-01/TrafficControllersGetList.json | 51 - .../spec/main.tsp | 328 ------ .../spec/sdk-suppressions.yaml | 32 - .../tspconfig.yaml | 14 - 121 files changed, 8003 deletions(-) delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/LICENSE delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/README.md delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/api-extractor.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/eslint.config.mjs delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/package.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/rollup.config.js delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/sample.env delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceCreateOrUpdateSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceDeleteSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceGetSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceListByTrafficControllerSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceUpdateSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceCreateOrUpdateSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceDeleteSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceGetSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceListByTrafficControllerSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceUpdateSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/operationsListSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceCreateOrUpdateSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceDeleteSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceGetSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceListByTrafficControllerSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceUpdateSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceCreateOrUpdateSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceDeleteSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceGetSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceListByResourceGroupSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceListBySubscriptionSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceUpdateSample.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/associationsInterface/index.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/frontendsInterface/index.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/index.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/operations/index.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/options.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/securityPoliciesInterface/index.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/serviceNetworkingManagementContext.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/trafficControllerInterface/index.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/associationsInterface/index.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/frontendsInterface/index.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/index.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/operations/index.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/securityPoliciesInterface/index.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/trafficControllerInterface/index.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/index.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/logger.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/models/index.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/models/models.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/restorePollerHelpers.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/serviceNetworkingManagementClient.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/static-helpers/pagingHelpers.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/static-helpers/pollingHelpers.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/test/public/sampleTest.spec.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/test/public/utils/recordedClient.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/tsconfig.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/vitest.browser.config.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/vitest.config.ts delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/client.tsp delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationDelete.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationGet.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationPatch.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationPut.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationsGet.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendDelete.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendGet.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendPatch.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendPut.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendsGet.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/OperationsList.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerDelete.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerGet.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerPatch.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerPut.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllersGet.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllersGetList.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationDelete.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationGet.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationPatch.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationPut.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationsGet.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendDelete.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendGet.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendPatch.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendPut.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendsGet.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/OperationsList.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPoliciesGetList.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyDelete.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyGet.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyPatch.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyPut.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerDelete.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerGet.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerPatch.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerPut.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllersGet.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllersGetList.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationDelete.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationGet.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationPatch.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationPut.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationsGet.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendDelete.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendGet.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendPatch.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendPut.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendsGet.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/OperationsList.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPoliciesGetList.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyDelete.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyGet.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyPatch.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyPut.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerDelete.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerGet.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerPatch.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerPut.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllersGet.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllersGetList.json delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/main.tsp delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/spec/sdk-suppressions.yaml delete mode 100644 packages/typespec-test/test/ServiceNetworking.Management/tspconfig.yaml diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/LICENSE b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/LICENSE deleted file mode 100644 index 63447fd8bb..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) Microsoft Corporation. - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/README.md b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/README.md deleted file mode 100644 index b794a4e301..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/README.md +++ /dev/null @@ -1,106 +0,0 @@ -# Azure ServiceNetworking client library for JavaScript - -This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure ServiceNetworking client. - -Traffic Controller Provider management API. - -Key links: - -- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/servicenetworking/arm-servicenetworking) -- [Package (NPM)](https://www.npmjs.com/package/@azure/arm-servicenetworking) -- [API reference documentation](https://learn.microsoft.com/javascript/api/@azure/arm-servicenetworking?view=azure-node-preview) -- [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/servicenetworking/arm-servicenetworking/samples) - -## Getting started - -### Currently supported environments - -- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule) -- Latest versions of Safari, Chrome, Edge and Firefox. - -See our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details. - -### Prerequisites - -- An [Azure subscription][azure_sub]. - -### Install the `@azure/arm-servicenetworking` package - -Install the Azure ServiceNetworking client library for JavaScript with `npm`: - -```bash -npm install @azure/arm-servicenetworking -``` - -### Create and authenticate a `ServiceNetworkingClient` - -To create a client object to access the Azure ServiceNetworking API, you will need the `endpoint` of your Azure ServiceNetworking resource and a `credential`. The Azure ServiceNetworking client can use Azure Active Directory credentials to authenticate. -You can find the endpoint for your Azure ServiceNetworking resource in the [Azure Portal][azure_portal]. - -You can authenticate with Azure Active Directory using a credential from the [@azure/identity][azure_identity] library or [an existing AAD Token](https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token). - -To use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package: - -```bash -npm install @azure/identity -``` - -You will also need to **register a new AAD application and grant access to Azure ServiceNetworking** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). - -For more information about how to create an Azure AD Application check out [this guide](https://learn.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). - -```javascript -const { ServiceNetworkingClient } = require("@azure/arm-servicenetworking"); -const { DefaultAzureCredential } = require("@azure/identity"); -// For client-side applications running in the browser, use InteractiveBrowserCredential instead of DefaultAzureCredential. See https://aka.ms/azsdk/js/identity/examples for more details. - -const subscriptionId = "00000000-0000-0000-0000-000000000000"; -const client = new ServiceNetworkingClient(new DefaultAzureCredential(), subscriptionId); - -// For client-side applications running in the browser, use this code instead: -// const credential = new InteractiveBrowserCredential({ -// tenantId: "", -// clientId: "" -// }); -// const client = new ServiceNetworkingClient(credential, subscriptionId); -``` - - -### JavaScript Bundle -To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling). - -## Key concepts - -### ServiceNetworkingClient - -`ServiceNetworkingClient` is the primary interface for developers using the Azure ServiceNetworking client library. Explore the methods on this client object to understand the different features of the Azure ServiceNetworking service that you can access. - -## Troubleshooting - -### Logging - -Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: - -```javascript -const { setLogLevel } = require("@azure/logger"); -setLogLevel("info"); -``` - -For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). - -## Next steps - -Please take a look at the [samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/servicenetworking/arm-servicenetworking/samples) directory for detailed examples on how to use this library. - -## Contributing - -If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. - -## Related projects - -- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) - -[azure_sub]: https://azure.microsoft.com/free/ -[azure_portal]: https://portal.azure.com -[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity -[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/api-extractor.json b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/api-extractor.json deleted file mode 100644 index ae4c926254..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/api-extractor.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", - "mainEntryPointFilePath": "./dist/esm/index.d.ts", - "docModel": { "enabled": true }, - "apiReport": { "enabled": true, "reportFolder": "./review" }, - "dtsRollup": { - "enabled": true, - "untrimmedFilePath": "", - "publicTrimmedFilePath": "./types/arm-servicenetworking.d.ts" - }, - "messages": { - "tsdocMessageReporting": { "default": { "logLevel": "none" } }, - "extractorMessageReporting": { - "ae-missing-release-tag": { "logLevel": "none" }, - "ae-unresolved-link": { "logLevel": "none" } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/eslint.config.mjs b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/eslint.config.mjs deleted file mode 100644 index 9396819633..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/eslint.config.mjs +++ /dev/null @@ -1,14 +0,0 @@ -import azsdkEslint from "@azure/eslint-plugin-azure-sdk"; - -export default azsdkEslint.config([ - { - rules: { - "@azure/azure-sdk/ts-modules-only-named": "warn", - "@azure/azure-sdk/ts-package-json-types": "warn", - "@azure/azure-sdk/ts-package-json-engine-is-present": "warn", - "@azure/azure-sdk/ts-package-json-files-required": "off", - "@azure/azure-sdk/ts-package-json-main-is-cjs": "off", - "tsdoc/syntax": "warn" - } - } -]); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/package.json b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/package.json deleted file mode 100644 index c19df2cdbe..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@azure/arm-servicenetworking", - "version": "1.0.0-beta.1", - "description": "A generated SDK for ServiceNetworkingClient.", - "engines": { - "node": ">=18.0.0" - }, - "sideEffects": false, - "autoPublish": false, - "tshy": { - "exports": { - "./package.json": "./package.json", - ".": "./src/index.ts", - "./models": "./src/models/index.ts" - }, - "dialects": ["esm", "commonjs"], - "esmDialects": ["browser", "react-native"], - "selfLink": false - }, - "type": "module", - "keywords": ["node", "azure", "cloud", "typescript", "browser", "isomorphic"], - "author": "Microsoft Corporation", - "license": "MIT", - "files": ["dist", "README.md", "LICENSE", "review/*", "CHANGELOG.md"], - "dependencies": { - "@azure/core-util": "^1.9.2", - "@azure-rest/core-client": "^2.3.1", - "@azure/core-auth": "^1.6.0", - "@azure/core-rest-pipeline": "^1.5.0", - "@azure/logger": "^1.0.0", - "tslib": "^2.6.2", - "@azure/core-lro": "^3.1.0", - "@azure/abort-controller": "^2.1.2" - }, - "devDependencies": { - "dotenv": "^16.0.0", - "@microsoft/api-extractor": "^7.40.3", - "@types/node": "^18.0.0", - "eslint": "^9.9.0", - "typescript": "~5.6.2", - "tshy": "^2.0.0", - "@azure/identity": "^4.2.1", - "@vitest/browser": "^3.0.3", - "@vitest/coverage-istanbul": "^3.0.3", - "playwright": "^1.41.2", - "vitest": "^3.0.3", - "@azure-tools/test-credential": "^2.0.0", - "@azure-tools/test-recorder": "^4.0.0", - "rimraf": "^5.0.5", - "mkdirp": "^3.0.1" - }, - "scripts": { - "clean": "rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log", - "extract-api": "rimraf review && mkdirp ./review && api-extractor run --local", - "pack": "npm pack 2>&1", - "lint": "eslint package.json api-extractor.json src", - "lint:fix": "eslint package.json api-extractor.json src --fix --fix-type [problem,suggestion]", - "unit-test": "npm run unit-test:node && npm run unit-test:browser", - "unit-test:browser": "vitest -c vitest.browser.config.ts", - "unit-test:node": "vitest -c vitest.config.ts", - "integration-test": "npm run integration-test:node && npm run integration-test:browser", - "integration-test:browser": "echo skipped", - "integration-test:node": "echo skipped", - "test:browser": "npm run clean && npm run build:test && npm run unit-test:browser && npm run integration-test:browser", - "test:node": "npm run clean && tshy && npm run unit-test:node && npm run integration-test:node", - "test": "npm run clean && tshy && npm run unit-test:node && npm run unit-test:browser && npm run integration-test", - "build": "npm run clean && tshy && npm run extract-api" - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/rollup.config.js b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/rollup.config.js deleted file mode 100644 index 843de501bf..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/rollup.config.js +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import nodeResolve from "@rollup/plugin-node-resolve"; -import cjs from "@rollup/plugin-commonjs"; -import sourcemaps from "rollup-plugin-sourcemaps"; -import multiEntry from "@rollup/plugin-multi-entry"; -import json from "@rollup/plugin-json"; - -import nodeBuiltins from "builtin-modules"; - -// #region Warning Handler - -/** - * A function that can determine whether a rollup warning should be ignored. If - * the function returns `true`, then the warning will not be displayed. - */ - -function ignoreNiseSinonEval(warning) { - return ( - warning.code === "EVAL" && - warning.id && - (warning.id.includes("node_modules/nise") || - warning.id.includes("node_modules/sinon")) === true - ); -} - -function ignoreChaiCircularDependency(warning) { - return ( - warning.code === "CIRCULAR_DEPENDENCY" && - warning.importer && - warning.importer.includes("node_modules/chai") === true - ); -} - -const warningInhibitors = [ignoreChaiCircularDependency, ignoreNiseSinonEval]; - -/** - * Construct a warning handler for the shared rollup configuration - * that ignores certain warnings that are not relevant to testing. - */ -function makeOnWarnForTesting() { - return (warning, warn) => { - // If every inhibitor returns false (i.e. no inhibitors), then show the warning - if (warningInhibitors.every((inhib) => !inhib(warning))) { - warn(warning); - } - }; -} - -// #endregion - -function makeBrowserTestConfig() { - const config = { - input: { - include: ["dist-esm/test/**/*.spec.js"], - exclude: ["dist-esm/test/**/node/**"], - }, - output: { - file: `dist-test/index.browser.js`, - format: "umd", - sourcemap: true, - }, - preserveSymlinks: false, - plugins: [ - multiEntry({ exports: false }), - nodeResolve({ - mainFields: ["module", "browser"], - }), - cjs(), - json(), - sourcemaps(), - //viz({ filename: "dist-test/browser-stats.html", sourcemap: true }) - ], - onwarn: makeOnWarnForTesting(), - // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0, - // rollup started respecting the "sideEffects" field in package.json. Since - // our package.json sets "sideEffects=false", this also applies to test - // code, which causes all tests to be removed by tree-shaking. - treeshake: false, - }; - - return config; -} - -const defaultConfigurationOptions = { - disableBrowserBundle: false, -}; - -export function makeConfig(pkg, options) { - options = { - ...defaultConfigurationOptions, - ...(options || {}), - }; - - const baseConfig = { - // Use the package's module field if it has one - input: pkg["module"] || "dist-esm/src/index.js", - external: [ - ...nodeBuiltins, - ...Object.keys(pkg.dependencies), - ...Object.keys(pkg.devDependencies), - ], - output: { file: "dist/index.js", format: "cjs", sourcemap: true }, - preserveSymlinks: false, - plugins: [sourcemaps(), nodeResolve()], - }; - - const config = [baseConfig]; - - if (!options.disableBrowserBundle) { - config.push(makeBrowserTestConfig()); - } - - return config; -} - -export default makeConfig(require("./package.json")); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/sample.env b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/sample.env deleted file mode 100644 index 508439fc7d..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/sample.env +++ /dev/null @@ -1 +0,0 @@ -# Feel free to add your own environment variables. \ No newline at end of file diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceCreateOrUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceCreateOrUpdateSample.ts deleted file mode 100644 index 6ffd824da6..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceCreateOrUpdateSample.ts +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to create a Association - * - * @summary create a Association - * x-ms-original-file: 2025-01-01/AssociationPut.json - */ -async function putAssociation(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.associationsInterface.createOrUpdate( - "rg1", - "tc1", - "as1", - { - location: "NorthCentralUS", - properties: { - associationType: "subnets", - subnet: { - id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet", - }, - }, - }, - ); - console.log(result); -} - -async function main(): Promise { - await putAssociation(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceDeleteSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceDeleteSample.ts deleted file mode 100644 index e988ac66a2..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceDeleteSample.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to delete a Association - * - * @summary delete a Association - * x-ms-original-file: 2025-01-01/AssociationDelete.json - */ -async function deleteAssociation(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - await client.associationsInterface.delete("rg1", "tc1", "as1"); -} - -async function main(): Promise { - await deleteAssociation(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceGetSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceGetSample.ts deleted file mode 100644 index 59a96a004d..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceGetSample.ts +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to get a Association - * - * @summary get a Association - * x-ms-original-file: 2025-01-01/AssociationGet.json - */ -async function getAssociation(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.associationsInterface.get("rg1", "tc1", "as1"); - console.log(result); -} - -async function main(): Promise { - await getAssociation(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceListByTrafficControllerSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceListByTrafficControllerSample.ts deleted file mode 100644 index 5eab3f941e..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceListByTrafficControllerSample.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list Association resources by TrafficController - * - * @summary list Association resources by TrafficController - * x-ms-original-file: 2025-01-01/AssociationsGet.json - */ -async function getAssociations(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (let item of client.associationsInterface.listByTrafficController( - "rg1", - "tc1", - )) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main(): Promise { - await getAssociations(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceUpdateSample.ts deleted file mode 100644 index 1fbf49bd97..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/associationsInterfaceUpdateSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to update a Association - * - * @summary update a Association - * x-ms-original-file: 2025-01-01/AssociationPatch.json - */ -async function updateAssociation(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.associationsInterface.update( - "rg1", - "tc1", - "as1", - { - properties: { - associationType: "subnets", - subnet: { - id: "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet", - }, - }, - }, - ); - console.log(result); -} - -async function main(): Promise { - await updateAssociation(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceCreateOrUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceCreateOrUpdateSample.ts deleted file mode 100644 index a2caaf847f..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceCreateOrUpdateSample.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to create a Frontend - * - * @summary create a Frontend - * x-ms-original-file: 2025-01-01/FrontendPut.json - */ -async function putFrontend(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.frontendsInterface.createOrUpdate( - "rg1", - "tc1", - "fe1", - { location: "NorthCentralUS", properties: {} }, - ); - console.log(result); -} - -async function main(): Promise { - await putFrontend(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceDeleteSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceDeleteSample.ts deleted file mode 100644 index f3294e4006..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceDeleteSample.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to delete a Frontend - * - * @summary delete a Frontend - * x-ms-original-file: 2025-01-01/FrontendDelete.json - */ -async function deleteFrontend(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - await client.frontendsInterface.delete("rg1", "tc1", "fe1"); -} - -async function main(): Promise { - await deleteFrontend(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceGetSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceGetSample.ts deleted file mode 100644 index cb7d7038e5..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceGetSample.ts +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to get a Frontend - * - * @summary get a Frontend - * x-ms-original-file: 2025-01-01/FrontendGet.json - */ -async function getFrontend(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.frontendsInterface.get("rg1", "tc1", "fe1"); - console.log(result); -} - -async function main(): Promise { - await getFrontend(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceListByTrafficControllerSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceListByTrafficControllerSample.ts deleted file mode 100644 index b33e3af518..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceListByTrafficControllerSample.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list Frontend resources by TrafficController - * - * @summary list Frontend resources by TrafficController - * x-ms-original-file: 2025-01-01/FrontendsGet.json - */ -async function getFrontends(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (let item of client.frontendsInterface.listByTrafficController( - "rg1", - "tc1", - )) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main(): Promise { - await getFrontends(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceUpdateSample.ts deleted file mode 100644 index a3f4a350b2..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/frontendsInterfaceUpdateSample.ts +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to update a Frontend - * - * @summary update a Frontend - * x-ms-original-file: 2025-01-01/FrontendPatch.json - */ -async function updateFrontend(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.frontendsInterface.update( - "rg1", - "tc1", - "fe1", - {}, - ); - console.log(result); -} - -async function main(): Promise { - await updateFrontend(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/operationsListSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/operationsListSample.ts deleted file mode 100644 index 8787256f50..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/operationsListSample.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list the operations for the provider - * - * @summary list the operations for the provider - * x-ms-original-file: 2025-01-01/OperationsList.json - */ -async function getOperationsList(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "00000000-0000-0000-0000-00000000000"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (let item of client.operations.list()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main(): Promise { - await getOperationsList(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceCreateOrUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceCreateOrUpdateSample.ts deleted file mode 100644 index f2708e61c4..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceCreateOrUpdateSample.ts +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to create a SecurityPolicy - * - * @summary create a SecurityPolicy - * x-ms-original-file: 2025-01-01/SecurityPolicyPut.json - */ -async function putSecurityPolicy(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.securityPoliciesInterface.createOrUpdate( - "rg1", - "tc1", - "sp1", - { - location: "NorthCentralUS", - properties: { - wafPolicy: { - id: "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0", - }, - }, - }, - ); - console.log(result); -} - -async function main(): Promise { - await putSecurityPolicy(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceDeleteSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceDeleteSample.ts deleted file mode 100644 index b63783a380..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceDeleteSample.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to delete a SecurityPolicy - * - * @summary delete a SecurityPolicy - * x-ms-original-file: 2025-01-01/SecurityPolicyDelete.json - */ -async function deleteSecurityPolicy(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - await client.securityPoliciesInterface.delete("rg1", "tc1", "sp1"); -} - -async function main(): Promise { - await deleteSecurityPolicy(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceGetSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceGetSample.ts deleted file mode 100644 index 3d4b439403..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceGetSample.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to get a SecurityPolicy - * - * @summary get a SecurityPolicy - * x-ms-original-file: 2025-01-01/SecurityPolicyGet.json - */ -async function getSecurityPolicy(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.securityPoliciesInterface.get( - "rg1", - "tc1", - "sp1", - ); - console.log(result); -} - -async function main(): Promise { - await getSecurityPolicy(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceListByTrafficControllerSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceListByTrafficControllerSample.ts deleted file mode 100644 index 953a0fde95..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceListByTrafficControllerSample.ts +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list SecurityPolicy resources by TrafficController - * - * @summary list SecurityPolicy resources by TrafficController - * x-ms-original-file: 2025-01-01/SecurityPoliciesGetList.json - */ -async function getSecurityPolicies(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (let item of client.securityPoliciesInterface.listByTrafficController( - "rg1", - "tc1", - )) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main(): Promise { - await getSecurityPolicies(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceUpdateSample.ts deleted file mode 100644 index 38092cb526..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/securityPoliciesInterfaceUpdateSample.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to update a SecurityPolicy - * - * @summary update a SecurityPolicy - * x-ms-original-file: 2025-01-01/SecurityPolicyPatch.json - */ -async function updateSecurityPolicy(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.securityPoliciesInterface.update( - "rg1", - "tc1", - "sp1", - { - properties: { - wafPolicy: { - id: "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0", - }, - }, - }, - ); - console.log(result); -} - -async function main(): Promise { - await updateSecurityPolicy(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceCreateOrUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceCreateOrUpdateSample.ts deleted file mode 100644 index f72496173b..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceCreateOrUpdateSample.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to create a TrafficController - * - * @summary create a TrafficController - * x-ms-original-file: 2025-01-01/TrafficControllerPut.json - */ -async function putTrafficController(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.trafficControllerInterface.createOrUpdate( - "rg1", - "tc1", - { location: "NorthCentralUS", tags: { key1: "value1" } }, - ); - console.log(result); -} - -async function main(): Promise { - await putTrafficController(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceDeleteSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceDeleteSample.ts deleted file mode 100644 index c65f924466..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceDeleteSample.ts +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to delete a TrafficController - * - * @summary delete a TrafficController - * x-ms-original-file: 2025-01-01/TrafficControllerDelete.json - */ -async function deleteTrafficController(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - await client.trafficControllerInterface.delete("rg1", "tc1"); -} - -async function main(): Promise { - await deleteTrafficController(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceGetSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceGetSample.ts deleted file mode 100644 index 7197624b99..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceGetSample.ts +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to get a TrafficController - * - * @summary get a TrafficController - * x-ms-original-file: 2025-01-01/TrafficControllerGet.json - */ -async function getTrafficController(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.trafficControllerInterface.get("rg1", "tc1"); - console.log(result); -} - -async function main(): Promise { - await getTrafficController(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceListByResourceGroupSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceListByResourceGroupSample.ts deleted file mode 100644 index bc97c1ecf1..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceListByResourceGroupSample.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list TrafficController resources by resource group - * - * @summary list TrafficController resources by resource group - * x-ms-original-file: 2025-01-01/TrafficControllersGet.json - */ -async function getTrafficControllers(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (let item of client.trafficControllerInterface.listByResourceGroup( - "rg1", - )) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main(): Promise { - await getTrafficControllers(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceListBySubscriptionSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceListBySubscriptionSample.ts deleted file mode 100644 index 1638b0ac37..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceListBySubscriptionSample.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to list TrafficController resources by subscription ID - * - * @summary list TrafficController resources by subscription ID - * x-ms-original-file: 2025-01-01/TrafficControllersGetList.json - */ -async function getTrafficControllersList(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const resArray = new Array(); - for await (let item of client.trafficControllerInterface.listBySubscription()) { - resArray.push(item); - } - - console.log(resArray); -} - -async function main(): Promise { - await getTrafficControllersList(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceUpdateSample.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceUpdateSample.ts deleted file mode 100644 index 5f31dd4e80..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/samples-dev/trafficControllerInterfaceUpdateSample.ts +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "@azure/arm-servicenetworking"; -import { DefaultAzureCredential } from "@azure/identity"; - -/** - * This sample demonstrates how to update a TrafficController - * - * @summary update a TrafficController - * x-ms-original-file: 2025-01-01/TrafficControllerPatch.json - */ -async function patchTrafficController(): Promise { - const credential = new DefaultAzureCredential(); - const subscriptionId = "subid"; - const client = new ServiceNetworkingManagementClient( - credential, - subscriptionId, - ); - const result = await client.trafficControllerInterface.update("rg1", "tc1", { - tags: { key1: "value1" }, - }); - console.log(result); -} - -async function main(): Promise { - await patchTrafficController(); -} - -main().catch(console.error); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/associationsInterface/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/associationsInterface/index.ts deleted file mode 100644 index 3c253729a9..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/associationsInterface/index.ts +++ /dev/null @@ -1,353 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - AssociationsInterfaceCreateOrUpdateOptionalParams, - AssociationsInterfaceDeleteOptionalParams, - AssociationsInterfaceGetOptionalParams, - AssociationsInterfaceListByTrafficControllerOptionalParams, - AssociationsInterfaceUpdateOptionalParams, - ServiceNetworkingManagementContext as Client, -} from "../index.js"; -import { - errorResponseDeserializer, - Association, - associationSerializer, - associationDeserializer, - AssociationUpdate, - associationUpdateSerializer, - _AssociationListResult, - _associationListResultDeserializer, -} from "../../models/models.js"; -import { - PagedAsyncIterableIterator, - buildPagedAsyncIterator, -} from "../../static-helpers/pagingHelpers.js"; -import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; -import { - StreamableMethod, - PathUncheckedResponse, - createRestError, - operationOptionsToRequestParameters, -} from "@azure-rest/core-client"; -import { PollerLike, OperationState } from "@azure/core-lro"; - -export function _associationsInterfaceListByTrafficControllerSend( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - options: AssociationsInterfaceListByTrafficControllerOptionalParams = { - requestOptions: {}, - }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/associations", - context.subscriptionId, - resourceGroupName, - trafficControllerName, - ) - .get({ - ...operationOptionsToRequestParameters(options), - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - }); -} - -export async function _associationsInterfaceListByTrafficControllerDeserialize( - result: PathUncheckedResponse, -): Promise<_AssociationListResult> { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return _associationListResultDeserializer(result.body); -} - -/** List Association resources by TrafficController */ -export function associationsInterfaceListByTrafficController( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - options: AssociationsInterfaceListByTrafficControllerOptionalParams = { - requestOptions: {}, - }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => - _associationsInterfaceListByTrafficControllerSend( - context, - resourceGroupName, - trafficControllerName, - options, - ), - _associationsInterfaceListByTrafficControllerDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, - ); -} - -export function _associationsInterfaceDeleteSend( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - associationName: string, - options: AssociationsInterfaceDeleteOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/associations/{associationName}", - context.subscriptionId, - resourceGroupName, - trafficControllerName, - associationName, - ) - .delete({ - ...operationOptionsToRequestParameters(options), - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - }); -} - -export async function _associationsInterfaceDeleteDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["202", "204", "200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return; -} - -/** Delete a Association */ -export function associationsInterfaceDelete( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - associationName: string, - options: AssociationsInterfaceDeleteOptionalParams = { requestOptions: {} }, -): PollerLike, void> { - return getLongRunningPoller( - context, - _associationsInterfaceDeleteDeserialize, - ["202", "204", "200"], - { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _associationsInterfaceDeleteSend( - context, - resourceGroupName, - trafficControllerName, - associationName, - options, - ), - resourceLocationConfig: "location", - }, - ) as PollerLike, void>; -} - -export function _associationsInterfaceUpdateSend( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - associationName: string, - properties: AssociationUpdate, - options: AssociationsInterfaceUpdateOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/associations/{associationName}", - context.subscriptionId, - resourceGroupName, - trafficControllerName, - associationName, - ) - .patch({ - ...operationOptionsToRequestParameters(options), - contentType: "application/json", - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - body: associationUpdateSerializer(properties), - }); -} - -export async function _associationsInterfaceUpdateDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return associationDeserializer(result.body); -} - -/** Update a Association */ -export async function associationsInterfaceUpdate( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - associationName: string, - properties: AssociationUpdate, - options: AssociationsInterfaceUpdateOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _associationsInterfaceUpdateSend( - context, - resourceGroupName, - trafficControllerName, - associationName, - properties, - options, - ); - return _associationsInterfaceUpdateDeserialize(result); -} - -export function _associationsInterfaceCreateOrUpdateSend( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - associationName: string, - resource: Association, - options: AssociationsInterfaceCreateOrUpdateOptionalParams = { - requestOptions: {}, - }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/associations/{associationName}", - context.subscriptionId, - resourceGroupName, - trafficControllerName, - associationName, - ) - .put({ - ...operationOptionsToRequestParameters(options), - contentType: "application/json", - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - body: associationSerializer(resource), - }); -} - -export async function _associationsInterfaceCreateOrUpdateDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200", "201"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return associationDeserializer(result.body); -} - -/** Create a Association */ -export function associationsInterfaceCreateOrUpdate( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - associationName: string, - resource: Association, - options: AssociationsInterfaceCreateOrUpdateOptionalParams = { - requestOptions: {}, - }, -): PollerLike, Association> { - return getLongRunningPoller( - context, - _associationsInterfaceCreateOrUpdateDeserialize, - ["200", "201"], - { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _associationsInterfaceCreateOrUpdateSend( - context, - resourceGroupName, - trafficControllerName, - associationName, - resource, - options, - ), - resourceLocationConfig: "azure-async-operation", - }, - ) as PollerLike, Association>; -} - -export function _associationsInterfaceGetSend( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - associationName: string, - options: AssociationsInterfaceGetOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/associations/{associationName}", - context.subscriptionId, - resourceGroupName, - trafficControllerName, - associationName, - ) - .get({ - ...operationOptionsToRequestParameters(options), - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - }); -} - -export async function _associationsInterfaceGetDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return associationDeserializer(result.body); -} - -/** Get a Association */ -export async function associationsInterfaceGet( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - associationName: string, - options: AssociationsInterfaceGetOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _associationsInterfaceGetSend( - context, - resourceGroupName, - trafficControllerName, - associationName, - options, - ); - return _associationsInterfaceGetDeserialize(result); -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/frontendsInterface/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/frontendsInterface/index.ts deleted file mode 100644 index 196bd0f011..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/frontendsInterface/index.ts +++ /dev/null @@ -1,353 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - ServiceNetworkingManagementContext as Client, - FrontendsInterfaceCreateOrUpdateOptionalParams, - FrontendsInterfaceDeleteOptionalParams, - FrontendsInterfaceGetOptionalParams, - FrontendsInterfaceListByTrafficControllerOptionalParams, - FrontendsInterfaceUpdateOptionalParams, -} from "../index.js"; -import { - errorResponseDeserializer, - Frontend, - frontendSerializer, - frontendDeserializer, - FrontendUpdate, - frontendUpdateSerializer, - _FrontendListResult, - _frontendListResultDeserializer, -} from "../../models/models.js"; -import { - PagedAsyncIterableIterator, - buildPagedAsyncIterator, -} from "../../static-helpers/pagingHelpers.js"; -import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; -import { - StreamableMethod, - PathUncheckedResponse, - createRestError, - operationOptionsToRequestParameters, -} from "@azure-rest/core-client"; -import { PollerLike, OperationState } from "@azure/core-lro"; - -export function _frontendsInterfaceListByTrafficControllerSend( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - options: FrontendsInterfaceListByTrafficControllerOptionalParams = { - requestOptions: {}, - }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/frontends", - context.subscriptionId, - resourceGroupName, - trafficControllerName, - ) - .get({ - ...operationOptionsToRequestParameters(options), - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - }); -} - -export async function _frontendsInterfaceListByTrafficControllerDeserialize( - result: PathUncheckedResponse, -): Promise<_FrontendListResult> { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return _frontendListResultDeserializer(result.body); -} - -/** List Frontend resources by TrafficController */ -export function frontendsInterfaceListByTrafficController( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - options: FrontendsInterfaceListByTrafficControllerOptionalParams = { - requestOptions: {}, - }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => - _frontendsInterfaceListByTrafficControllerSend( - context, - resourceGroupName, - trafficControllerName, - options, - ), - _frontendsInterfaceListByTrafficControllerDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, - ); -} - -export function _frontendsInterfaceDeleteSend( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - frontendName: string, - options: FrontendsInterfaceDeleteOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/frontends/{frontendName}", - context.subscriptionId, - resourceGroupName, - trafficControllerName, - frontendName, - ) - .delete({ - ...operationOptionsToRequestParameters(options), - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - }); -} - -export async function _frontendsInterfaceDeleteDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["202", "204", "200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return; -} - -/** Delete a Frontend */ -export function frontendsInterfaceDelete( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - frontendName: string, - options: FrontendsInterfaceDeleteOptionalParams = { requestOptions: {} }, -): PollerLike, void> { - return getLongRunningPoller( - context, - _frontendsInterfaceDeleteDeserialize, - ["202", "204", "200"], - { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _frontendsInterfaceDeleteSend( - context, - resourceGroupName, - trafficControllerName, - frontendName, - options, - ), - resourceLocationConfig: "location", - }, - ) as PollerLike, void>; -} - -export function _frontendsInterfaceUpdateSend( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - frontendName: string, - properties: FrontendUpdate, - options: FrontendsInterfaceUpdateOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/frontends/{frontendName}", - context.subscriptionId, - resourceGroupName, - trafficControllerName, - frontendName, - ) - .patch({ - ...operationOptionsToRequestParameters(options), - contentType: "application/json", - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - body: frontendUpdateSerializer(properties), - }); -} - -export async function _frontendsInterfaceUpdateDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return frontendDeserializer(result.body); -} - -/** Update a Frontend */ -export async function frontendsInterfaceUpdate( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - frontendName: string, - properties: FrontendUpdate, - options: FrontendsInterfaceUpdateOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _frontendsInterfaceUpdateSend( - context, - resourceGroupName, - trafficControllerName, - frontendName, - properties, - options, - ); - return _frontendsInterfaceUpdateDeserialize(result); -} - -export function _frontendsInterfaceCreateOrUpdateSend( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - frontendName: string, - resource: Frontend, - options: FrontendsInterfaceCreateOrUpdateOptionalParams = { - requestOptions: {}, - }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/frontends/{frontendName}", - context.subscriptionId, - resourceGroupName, - trafficControllerName, - frontendName, - ) - .put({ - ...operationOptionsToRequestParameters(options), - contentType: "application/json", - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - body: frontendSerializer(resource), - }); -} - -export async function _frontendsInterfaceCreateOrUpdateDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200", "201"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return frontendDeserializer(result.body); -} - -/** Create a Frontend */ -export function frontendsInterfaceCreateOrUpdate( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - frontendName: string, - resource: Frontend, - options: FrontendsInterfaceCreateOrUpdateOptionalParams = { - requestOptions: {}, - }, -): PollerLike, Frontend> { - return getLongRunningPoller( - context, - _frontendsInterfaceCreateOrUpdateDeserialize, - ["200", "201"], - { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _frontendsInterfaceCreateOrUpdateSend( - context, - resourceGroupName, - trafficControllerName, - frontendName, - resource, - options, - ), - resourceLocationConfig: "azure-async-operation", - }, - ) as PollerLike, Frontend>; -} - -export function _frontendsInterfaceGetSend( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - frontendName: string, - options: FrontendsInterfaceGetOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/frontends/{frontendName}", - context.subscriptionId, - resourceGroupName, - trafficControllerName, - frontendName, - ) - .get({ - ...operationOptionsToRequestParameters(options), - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - }); -} - -export async function _frontendsInterfaceGetDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return frontendDeserializer(result.body); -} - -/** Get a Frontend */ -export async function frontendsInterfaceGet( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - frontendName: string, - options: FrontendsInterfaceGetOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _frontendsInterfaceGetSend( - context, - resourceGroupName, - trafficControllerName, - frontendName, - options, - ); - return _frontendsInterfaceGetDeserialize(result); -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/index.ts deleted file mode 100644 index cb398cec90..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/index.ts +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -export { - OperationsListOptionalParams, - TrafficControllerInterfaceListBySubscriptionOptionalParams, - TrafficControllerInterfaceListByResourceGroupOptionalParams, - TrafficControllerInterfaceDeleteOptionalParams, - TrafficControllerInterfaceUpdateOptionalParams, - TrafficControllerInterfaceCreateOrUpdateOptionalParams, - TrafficControllerInterfaceGetOptionalParams, - SecurityPoliciesInterfaceListByTrafficControllerOptionalParams, - SecurityPoliciesInterfaceDeleteOptionalParams, - SecurityPoliciesInterfaceUpdateOptionalParams, - SecurityPoliciesInterfaceCreateOrUpdateOptionalParams, - SecurityPoliciesInterfaceGetOptionalParams, - FrontendsInterfaceListByTrafficControllerOptionalParams, - FrontendsInterfaceDeleteOptionalParams, - FrontendsInterfaceUpdateOptionalParams, - FrontendsInterfaceCreateOrUpdateOptionalParams, - FrontendsInterfaceGetOptionalParams, - AssociationsInterfaceListByTrafficControllerOptionalParams, - AssociationsInterfaceDeleteOptionalParams, - AssociationsInterfaceUpdateOptionalParams, - AssociationsInterfaceCreateOrUpdateOptionalParams, - AssociationsInterfaceGetOptionalParams, -} from "./options.js"; -export { - createServiceNetworkingManagement, - ServiceNetworkingManagementContext, - ServiceNetworkingManagementClientOptionalParams, -} from "./serviceNetworkingManagementContext.js"; -export { - associationsInterfaceListByTrafficController, - associationsInterfaceDelete, - associationsInterfaceUpdate, - associationsInterfaceCreateOrUpdate, - associationsInterfaceGet, -} from "./associationsInterface/index.js"; -export { - frontendsInterfaceListByTrafficController, - frontendsInterfaceDelete, - frontendsInterfaceUpdate, - frontendsInterfaceCreateOrUpdate, - frontendsInterfaceGet, -} from "./frontendsInterface/index.js"; -export { operationsList } from "./operations/index.js"; -export { - securityPoliciesInterfaceListByTrafficController, - securityPoliciesInterfaceDelete, - securityPoliciesInterfaceUpdate, - securityPoliciesInterfaceCreateOrUpdate, - securityPoliciesInterfaceGet, -} from "./securityPoliciesInterface/index.js"; -export { - trafficControllerInterfaceListBySubscription, - trafficControllerInterfaceListByResourceGroup, - trafficControllerInterfaceDelete, - trafficControllerInterfaceUpdate, - trafficControllerInterfaceCreateOrUpdate, - trafficControllerInterfaceGet, -} from "./trafficControllerInterface/index.js"; diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/operations/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/operations/index.ts deleted file mode 100644 index 6551cc738e..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/operations/index.ts +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - ServiceNetworkingManagementContext as Client, - OperationsListOptionalParams, -} from "../index.js"; -import { - _OperationListResult, - _operationListResultDeserializer, - Operation, - errorResponseDeserializer, -} from "../../models/models.js"; -import { - PagedAsyncIterableIterator, - buildPagedAsyncIterator, -} from "../../static-helpers/pagingHelpers.js"; -import { - StreamableMethod, - PathUncheckedResponse, - createRestError, - operationOptionsToRequestParameters, -} from "@azure-rest/core-client"; - -export function _operationsListSend( - context: Client, - options: OperationsListOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path("/providers/Microsoft.ServiceNetworking/operations") - .get({ - ...operationOptionsToRequestParameters(options), - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - }); -} - -export async function _operationsListDeserialize( - result: PathUncheckedResponse, -): Promise<_OperationListResult> { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return _operationListResultDeserializer(result.body); -} - -/** List the operations for the provider */ -export function operationsList( - context: Client, - options: OperationsListOptionalParams = { requestOptions: {} }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _operationsListSend(context, options), - _operationsListDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, - ); -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/options.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/options.ts deleted file mode 100644 index 2c833d1c75..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/options.ts +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { OperationOptions } from "@azure-rest/core-client"; - -/** Optional parameters. */ -export interface OperationsListOptionalParams extends OperationOptions {} - -/** Optional parameters. */ -export interface TrafficControllerInterfaceListBySubscriptionOptionalParams - extends OperationOptions {} - -/** Optional parameters. */ -export interface TrafficControllerInterfaceListByResourceGroupOptionalParams - extends OperationOptions {} - -/** Optional parameters. */ -export interface TrafficControllerInterfaceDeleteOptionalParams - extends OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; -} - -/** Optional parameters. */ -export interface TrafficControllerInterfaceUpdateOptionalParams - extends OperationOptions {} - -/** Optional parameters. */ -export interface TrafficControllerInterfaceCreateOrUpdateOptionalParams - extends OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; -} - -/** Optional parameters. */ -export interface TrafficControllerInterfaceGetOptionalParams - extends OperationOptions {} - -/** Optional parameters. */ -export interface SecurityPoliciesInterfaceListByTrafficControllerOptionalParams - extends OperationOptions {} - -/** Optional parameters. */ -export interface SecurityPoliciesInterfaceDeleteOptionalParams - extends OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; -} - -/** Optional parameters. */ -export interface SecurityPoliciesInterfaceUpdateOptionalParams - extends OperationOptions {} - -/** Optional parameters. */ -export interface SecurityPoliciesInterfaceCreateOrUpdateOptionalParams - extends OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; -} - -/** Optional parameters. */ -export interface SecurityPoliciesInterfaceGetOptionalParams - extends OperationOptions {} - -/** Optional parameters. */ -export interface FrontendsInterfaceListByTrafficControllerOptionalParams - extends OperationOptions {} - -/** Optional parameters. */ -export interface FrontendsInterfaceDeleteOptionalParams - extends OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; -} - -/** Optional parameters. */ -export interface FrontendsInterfaceUpdateOptionalParams - extends OperationOptions {} - -/** Optional parameters. */ -export interface FrontendsInterfaceCreateOrUpdateOptionalParams - extends OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; -} - -/** Optional parameters. */ -export interface FrontendsInterfaceGetOptionalParams extends OperationOptions {} - -/** Optional parameters. */ -export interface AssociationsInterfaceListByTrafficControllerOptionalParams - extends OperationOptions {} - -/** Optional parameters. */ -export interface AssociationsInterfaceDeleteOptionalParams - extends OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; -} - -/** Optional parameters. */ -export interface AssociationsInterfaceUpdateOptionalParams - extends OperationOptions {} - -/** Optional parameters. */ -export interface AssociationsInterfaceCreateOrUpdateOptionalParams - extends OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; -} - -/** Optional parameters. */ -export interface AssociationsInterfaceGetOptionalParams - extends OperationOptions {} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/securityPoliciesInterface/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/securityPoliciesInterface/index.ts deleted file mode 100644 index 7b8bfda253..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/securityPoliciesInterface/index.ts +++ /dev/null @@ -1,361 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - ServiceNetworkingManagementContext as Client, - SecurityPoliciesInterfaceCreateOrUpdateOptionalParams, - SecurityPoliciesInterfaceDeleteOptionalParams, - SecurityPoliciesInterfaceGetOptionalParams, - SecurityPoliciesInterfaceListByTrafficControllerOptionalParams, - SecurityPoliciesInterfaceUpdateOptionalParams, -} from "../index.js"; -import { - errorResponseDeserializer, - SecurityPolicy, - securityPolicySerializer, - securityPolicyDeserializer, - SecurityPolicyUpdate, - securityPolicyUpdateSerializer, - _SecurityPolicyListResult, - _securityPolicyListResultDeserializer, -} from "../../models/models.js"; -import { - PagedAsyncIterableIterator, - buildPagedAsyncIterator, -} from "../../static-helpers/pagingHelpers.js"; -import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; -import { - StreamableMethod, - PathUncheckedResponse, - createRestError, - operationOptionsToRequestParameters, -} from "@azure-rest/core-client"; -import { PollerLike, OperationState } from "@azure/core-lro"; - -export function _securityPoliciesInterfaceListByTrafficControllerSend( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - options: SecurityPoliciesInterfaceListByTrafficControllerOptionalParams = { - requestOptions: {}, - }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/securityPolicies", - context.subscriptionId, - resourceGroupName, - trafficControllerName, - ) - .get({ - ...operationOptionsToRequestParameters(options), - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - }); -} - -export async function _securityPoliciesInterfaceListByTrafficControllerDeserialize( - result: PathUncheckedResponse, -): Promise<_SecurityPolicyListResult> { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return _securityPolicyListResultDeserializer(result.body); -} - -/** List SecurityPolicy resources by TrafficController */ -export function securityPoliciesInterfaceListByTrafficController( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - options: SecurityPoliciesInterfaceListByTrafficControllerOptionalParams = { - requestOptions: {}, - }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => - _securityPoliciesInterfaceListByTrafficControllerSend( - context, - resourceGroupName, - trafficControllerName, - options, - ), - _securityPoliciesInterfaceListByTrafficControllerDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, - ); -} - -export function _securityPoliciesInterfaceDeleteSend( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - securityPolicyName: string, - options: SecurityPoliciesInterfaceDeleteOptionalParams = { - requestOptions: {}, - }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/securityPolicies/{securityPolicyName}", - context.subscriptionId, - resourceGroupName, - trafficControllerName, - securityPolicyName, - ) - .delete({ - ...operationOptionsToRequestParameters(options), - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - }); -} - -export async function _securityPoliciesInterfaceDeleteDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["202", "204", "200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return; -} - -/** Delete a SecurityPolicy */ -export function securityPoliciesInterfaceDelete( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - securityPolicyName: string, - options: SecurityPoliciesInterfaceDeleteOptionalParams = { - requestOptions: {}, - }, -): PollerLike, void> { - return getLongRunningPoller( - context, - _securityPoliciesInterfaceDeleteDeserialize, - ["202", "204", "200"], - { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _securityPoliciesInterfaceDeleteSend( - context, - resourceGroupName, - trafficControllerName, - securityPolicyName, - options, - ), - resourceLocationConfig: "location", - }, - ) as PollerLike, void>; -} - -export function _securityPoliciesInterfaceUpdateSend( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - securityPolicyName: string, - properties: SecurityPolicyUpdate, - options: SecurityPoliciesInterfaceUpdateOptionalParams = { - requestOptions: {}, - }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/securityPolicies/{securityPolicyName}", - context.subscriptionId, - resourceGroupName, - trafficControllerName, - securityPolicyName, - ) - .patch({ - ...operationOptionsToRequestParameters(options), - contentType: "application/json", - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - body: securityPolicyUpdateSerializer(properties), - }); -} - -export async function _securityPoliciesInterfaceUpdateDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return securityPolicyDeserializer(result.body); -} - -/** Update a SecurityPolicy */ -export async function securityPoliciesInterfaceUpdate( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - securityPolicyName: string, - properties: SecurityPolicyUpdate, - options: SecurityPoliciesInterfaceUpdateOptionalParams = { - requestOptions: {}, - }, -): Promise { - const result = await _securityPoliciesInterfaceUpdateSend( - context, - resourceGroupName, - trafficControllerName, - securityPolicyName, - properties, - options, - ); - return _securityPoliciesInterfaceUpdateDeserialize(result); -} - -export function _securityPoliciesInterfaceCreateOrUpdateSend( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - securityPolicyName: string, - resource: SecurityPolicy, - options: SecurityPoliciesInterfaceCreateOrUpdateOptionalParams = { - requestOptions: {}, - }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/securityPolicies/{securityPolicyName}", - context.subscriptionId, - resourceGroupName, - trafficControllerName, - securityPolicyName, - ) - .put({ - ...operationOptionsToRequestParameters(options), - contentType: "application/json", - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - body: securityPolicySerializer(resource), - }); -} - -export async function _securityPoliciesInterfaceCreateOrUpdateDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200", "201"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return securityPolicyDeserializer(result.body); -} - -/** Create a SecurityPolicy */ -export function securityPoliciesInterfaceCreateOrUpdate( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - securityPolicyName: string, - resource: SecurityPolicy, - options: SecurityPoliciesInterfaceCreateOrUpdateOptionalParams = { - requestOptions: {}, - }, -): PollerLike, SecurityPolicy> { - return getLongRunningPoller( - context, - _securityPoliciesInterfaceCreateOrUpdateDeserialize, - ["200", "201"], - { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _securityPoliciesInterfaceCreateOrUpdateSend( - context, - resourceGroupName, - trafficControllerName, - securityPolicyName, - resource, - options, - ), - resourceLocationConfig: "azure-async-operation", - }, - ) as PollerLike, SecurityPolicy>; -} - -export function _securityPoliciesInterfaceGetSend( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - securityPolicyName: string, - options: SecurityPoliciesInterfaceGetOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/securityPolicies/{securityPolicyName}", - context.subscriptionId, - resourceGroupName, - trafficControllerName, - securityPolicyName, - ) - .get({ - ...operationOptionsToRequestParameters(options), - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - }); -} - -export async function _securityPoliciesInterfaceGetDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return securityPolicyDeserializer(result.body); -} - -/** Get a SecurityPolicy */ -export async function securityPoliciesInterfaceGet( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - securityPolicyName: string, - options: SecurityPoliciesInterfaceGetOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _securityPoliciesInterfaceGetSend( - context, - resourceGroupName, - trafficControllerName, - securityPolicyName, - options, - ); - return _securityPoliciesInterfaceGetDeserialize(result); -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/serviceNetworkingManagementContext.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/serviceNetworkingManagementContext.ts deleted file mode 100644 index 1a2b20a383..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/serviceNetworkingManagementContext.ts +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { logger } from "../logger.js"; -import { KnownVersions } from "../models/models.js"; -import { Client, ClientOptions, getClient } from "@azure-rest/core-client"; -import { TokenCredential } from "@azure/core-auth"; - -/** Traffic Controller Provider management API. */ -export interface ServiceNetworkingManagementContext extends Client { - /** The API version to use for this operation. */ - /** Known values of {@link KnownVersions} that the service accepts. */ - apiVersion: string; - /** The ID of the target subscription. The value must be an UUID. */ - subscriptionId: string; -} - -/** Optional parameters for the client. */ -export interface ServiceNetworkingManagementClientOptionalParams - extends ClientOptions { - /** The API version to use for this operation. */ - /** Known values of {@link KnownVersions} that the service accepts. */ - apiVersion?: string; -} - -/** Traffic Controller Provider management API. */ -export function createServiceNetworkingManagement( - credential: TokenCredential, - subscriptionId: string, - options: ServiceNetworkingManagementClientOptionalParams = {}, -): ServiceNetworkingManagementContext { - const endpointUrl = - options.endpoint ?? options.baseUrl ?? "https://management.azure.com"; - const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; - const userAgentInfo = `azsdk-js-arm-servicenetworking/1.0.0-beta.1`; - const userAgentPrefix = prefixFromOptions - ? `${prefixFromOptions} azsdk-js-api ${userAgentInfo}` - : `azsdk-js-api ${userAgentInfo}`; - const { apiVersion: _, ...updatedOptions } = { - ...options, - userAgentOptions: { userAgentPrefix }, - loggingOptions: { logger: options.loggingOptions?.logger ?? logger.info }, - credentials: { - scopes: options.credentials?.scopes ?? [`${endpointUrl}/.default`], - }, - }; - const clientContext = getClient(endpointUrl, credential, updatedOptions); - clientContext.pipeline.removePolicy({ name: "ApiVersionPolicy" }); - const apiVersion = options.apiVersion ?? "2025-01-01"; - clientContext.pipeline.addPolicy({ - name: "ClientApiVersionPolicy", - sendRequest: (req, next) => { - // Use the apiVersion defined in request url directly - // Append one if there is no apiVersion and we have one at client options - const url = new URL(req.url); - if (!url.searchParams.get("api-version")) { - req.url = `${req.url}${ - Array.from(url.searchParams.keys()).length > 0 ? "&" : "?" - }api-version=${apiVersion}`; - } - - return next(req); - }, - }); - return { - ...clientContext, - apiVersion, - subscriptionId, - } as ServiceNetworkingManagementContext; -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/trafficControllerInterface/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/trafficControllerInterface/index.ts deleted file mode 100644 index 4997f96651..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/api/trafficControllerInterface/index.ts +++ /dev/null @@ -1,392 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - ServiceNetworkingManagementContext as Client, - TrafficControllerInterfaceCreateOrUpdateOptionalParams, - TrafficControllerInterfaceDeleteOptionalParams, - TrafficControllerInterfaceGetOptionalParams, - TrafficControllerInterfaceListByResourceGroupOptionalParams, - TrafficControllerInterfaceListBySubscriptionOptionalParams, - TrafficControllerInterfaceUpdateOptionalParams, -} from "../index.js"; -import { - errorResponseDeserializer, - TrafficController, - trafficControllerSerializer, - trafficControllerDeserializer, - TrafficControllerUpdate, - trafficControllerUpdateSerializer, - _TrafficControllerListResult, - _trafficControllerListResultDeserializer, -} from "../../models/models.js"; -import { - PagedAsyncIterableIterator, - buildPagedAsyncIterator, -} from "../../static-helpers/pagingHelpers.js"; -import { getLongRunningPoller } from "../../static-helpers/pollingHelpers.js"; -import { - StreamableMethod, - PathUncheckedResponse, - createRestError, - operationOptionsToRequestParameters, -} from "@azure-rest/core-client"; -import { PollerLike, OperationState } from "@azure/core-lro"; - -export function _trafficControllerInterfaceListBySubscriptionSend( - context: Client, - options: TrafficControllerInterfaceListBySubscriptionOptionalParams = { - requestOptions: {}, - }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceNetworking/trafficControllers", - context.subscriptionId, - ) - .get({ - ...operationOptionsToRequestParameters(options), - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - }); -} - -export async function _trafficControllerInterfaceListBySubscriptionDeserialize( - result: PathUncheckedResponse, -): Promise<_TrafficControllerListResult> { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return _trafficControllerListResultDeserializer(result.body); -} - -/** List TrafficController resources by subscription ID */ -export function trafficControllerInterfaceListBySubscription( - context: Client, - options: TrafficControllerInterfaceListBySubscriptionOptionalParams = { - requestOptions: {}, - }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => _trafficControllerInterfaceListBySubscriptionSend(context, options), - _trafficControllerInterfaceListBySubscriptionDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, - ); -} - -export function _trafficControllerInterfaceListByResourceGroupSend( - context: Client, - resourceGroupName: string, - options: TrafficControllerInterfaceListByResourceGroupOptionalParams = { - requestOptions: {}, - }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers", - context.subscriptionId, - resourceGroupName, - ) - .get({ - ...operationOptionsToRequestParameters(options), - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - }); -} - -export async function _trafficControllerInterfaceListByResourceGroupDeserialize( - result: PathUncheckedResponse, -): Promise<_TrafficControllerListResult> { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return _trafficControllerListResultDeserializer(result.body); -} - -/** List TrafficController resources by resource group */ -export function trafficControllerInterfaceListByResourceGroup( - context: Client, - resourceGroupName: string, - options: TrafficControllerInterfaceListByResourceGroupOptionalParams = { - requestOptions: {}, - }, -): PagedAsyncIterableIterator { - return buildPagedAsyncIterator( - context, - () => - _trafficControllerInterfaceListByResourceGroupSend( - context, - resourceGroupName, - options, - ), - _trafficControllerInterfaceListByResourceGroupDeserialize, - ["200"], - { itemName: "value", nextLinkName: "nextLink" }, - ); -} - -export function _trafficControllerInterfaceDeleteSend( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - options: TrafficControllerInterfaceDeleteOptionalParams = { - requestOptions: {}, - }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}", - context.subscriptionId, - resourceGroupName, - trafficControllerName, - ) - .delete({ - ...operationOptionsToRequestParameters(options), - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - }); -} - -export async function _trafficControllerInterfaceDeleteDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["202", "204", "200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return; -} - -/** Delete a TrafficController */ -export function trafficControllerInterfaceDelete( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - options: TrafficControllerInterfaceDeleteOptionalParams = { - requestOptions: {}, - }, -): PollerLike, void> { - return getLongRunningPoller( - context, - _trafficControllerInterfaceDeleteDeserialize, - ["202", "204", "200"], - { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _trafficControllerInterfaceDeleteSend( - context, - resourceGroupName, - trafficControllerName, - options, - ), - resourceLocationConfig: "location", - }, - ) as PollerLike, void>; -} - -export function _trafficControllerInterfaceUpdateSend( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - properties: TrafficControllerUpdate, - options: TrafficControllerInterfaceUpdateOptionalParams = { - requestOptions: {}, - }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}", - context.subscriptionId, - resourceGroupName, - trafficControllerName, - ) - .patch({ - ...operationOptionsToRequestParameters(options), - contentType: "application/json", - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - body: trafficControllerUpdateSerializer(properties), - }); -} - -export async function _trafficControllerInterfaceUpdateDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return trafficControllerDeserializer(result.body); -} - -/** Update a TrafficController */ -export async function trafficControllerInterfaceUpdate( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - properties: TrafficControllerUpdate, - options: TrafficControllerInterfaceUpdateOptionalParams = { - requestOptions: {}, - }, -): Promise { - const result = await _trafficControllerInterfaceUpdateSend( - context, - resourceGroupName, - trafficControllerName, - properties, - options, - ); - return _trafficControllerInterfaceUpdateDeserialize(result); -} - -export function _trafficControllerInterfaceCreateOrUpdateSend( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - resource: TrafficController, - options: TrafficControllerInterfaceCreateOrUpdateOptionalParams = { - requestOptions: {}, - }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}", - context.subscriptionId, - resourceGroupName, - trafficControllerName, - ) - .put({ - ...operationOptionsToRequestParameters(options), - contentType: "application/json", - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - body: trafficControllerSerializer(resource), - }); -} - -export async function _trafficControllerInterfaceCreateOrUpdateDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200", "201"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return trafficControllerDeserializer(result.body); -} - -/** Create a TrafficController */ -export function trafficControllerInterfaceCreateOrUpdate( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - resource: TrafficController, - options: TrafficControllerInterfaceCreateOrUpdateOptionalParams = { - requestOptions: {}, - }, -): PollerLike, TrafficController> { - return getLongRunningPoller( - context, - _trafficControllerInterfaceCreateOrUpdateDeserialize, - ["200", "201"], - { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - getInitialResponse: () => - _trafficControllerInterfaceCreateOrUpdateSend( - context, - resourceGroupName, - trafficControllerName, - resource, - options, - ), - resourceLocationConfig: "azure-async-operation", - }, - ) as PollerLike, TrafficController>; -} - -export function _trafficControllerInterfaceGetSend( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - options: TrafficControllerInterfaceGetOptionalParams = { requestOptions: {} }, -): StreamableMethod { - return context - .path( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}", - context.subscriptionId, - resourceGroupName, - trafficControllerName, - ) - .get({ - ...operationOptionsToRequestParameters(options), - headers: { - accept: "application/json", - ...options.requestOptions?.headers, - }, - queryParameters: { "api-version": context.apiVersion }, - }); -} - -export async function _trafficControllerInterfaceGetDeserialize( - result: PathUncheckedResponse, -): Promise { - const expectedStatuses = ["200"]; - if (!expectedStatuses.includes(result.status)) { - const error = createRestError(result); - error.details = errorResponseDeserializer(result.body); - throw error; - } - - return trafficControllerDeserializer(result.body); -} - -/** Get a TrafficController */ -export async function trafficControllerInterfaceGet( - context: Client, - resourceGroupName: string, - trafficControllerName: string, - options: TrafficControllerInterfaceGetOptionalParams = { requestOptions: {} }, -): Promise { - const result = await _trafficControllerInterfaceGetSend( - context, - resourceGroupName, - trafficControllerName, - options, - ); - return _trafficControllerInterfaceGetDeserialize(result); -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/associationsInterface/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/associationsInterface/index.ts deleted file mode 100644 index 982cdab4d1..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/associationsInterface/index.ts +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementContext } from "../../api/serviceNetworkingManagementContext.js"; -import { - associationsInterfaceListByTrafficController, - associationsInterfaceDelete, - associationsInterfaceUpdate, - associationsInterfaceCreateOrUpdate, - associationsInterfaceGet, -} from "../../api/associationsInterface/index.js"; -import { Association, AssociationUpdate } from "../../models/models.js"; -import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; -import { PollerLike, OperationState } from "@azure/core-lro"; -import { - AssociationsInterfaceListByTrafficControllerOptionalParams, - AssociationsInterfaceDeleteOptionalParams, - AssociationsInterfaceUpdateOptionalParams, - AssociationsInterfaceCreateOrUpdateOptionalParams, - AssociationsInterfaceGetOptionalParams, -} from "../../api/options.js"; - -/** Interface representing a AssociationsInterface operations. */ -export interface AssociationsInterfaceOperations { - /** List Association resources by TrafficController */ - listByTrafficController: ( - resourceGroupName: string, - trafficControllerName: string, - options?: AssociationsInterfaceListByTrafficControllerOptionalParams, - ) => PagedAsyncIterableIterator; - /** Delete a Association */ - delete: ( - resourceGroupName: string, - trafficControllerName: string, - associationName: string, - options?: AssociationsInterfaceDeleteOptionalParams, - ) => PollerLike, void>; - /** Update a Association */ - update: ( - resourceGroupName: string, - trafficControllerName: string, - associationName: string, - properties: AssociationUpdate, - options?: AssociationsInterfaceUpdateOptionalParams, - ) => Promise; - /** Create a Association */ - createOrUpdate: ( - resourceGroupName: string, - trafficControllerName: string, - associationName: string, - resource: Association, - options?: AssociationsInterfaceCreateOrUpdateOptionalParams, - ) => PollerLike, Association>; - /** Get a Association */ - get: ( - resourceGroupName: string, - trafficControllerName: string, - associationName: string, - options?: AssociationsInterfaceGetOptionalParams, - ) => Promise; -} - -function _getAssociationsInterface( - context: ServiceNetworkingManagementContext, -) { - return { - listByTrafficController: ( - resourceGroupName: string, - trafficControllerName: string, - options?: AssociationsInterfaceListByTrafficControllerOptionalParams, - ) => - associationsInterfaceListByTrafficController( - context, - resourceGroupName, - trafficControllerName, - options, - ), - delete: ( - resourceGroupName: string, - trafficControllerName: string, - associationName: string, - options?: AssociationsInterfaceDeleteOptionalParams, - ) => - associationsInterfaceDelete( - context, - resourceGroupName, - trafficControllerName, - associationName, - options, - ), - update: ( - resourceGroupName: string, - trafficControllerName: string, - associationName: string, - properties: AssociationUpdate, - options?: AssociationsInterfaceUpdateOptionalParams, - ) => - associationsInterfaceUpdate( - context, - resourceGroupName, - trafficControllerName, - associationName, - properties, - options, - ), - createOrUpdate: ( - resourceGroupName: string, - trafficControllerName: string, - associationName: string, - resource: Association, - options?: AssociationsInterfaceCreateOrUpdateOptionalParams, - ) => - associationsInterfaceCreateOrUpdate( - context, - resourceGroupName, - trafficControllerName, - associationName, - resource, - options, - ), - get: ( - resourceGroupName: string, - trafficControllerName: string, - associationName: string, - options?: AssociationsInterfaceGetOptionalParams, - ) => - associationsInterfaceGet( - context, - resourceGroupName, - trafficControllerName, - associationName, - options, - ), - }; -} - -export function _getAssociationsInterfaceOperations( - context: ServiceNetworkingManagementContext, -): AssociationsInterfaceOperations { - return { - ..._getAssociationsInterface(context), - }; -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/frontendsInterface/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/frontendsInterface/index.ts deleted file mode 100644 index 8c0fb6bf28..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/frontendsInterface/index.ts +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementContext } from "../../api/serviceNetworkingManagementContext.js"; -import { - frontendsInterfaceListByTrafficController, - frontendsInterfaceDelete, - frontendsInterfaceUpdate, - frontendsInterfaceCreateOrUpdate, - frontendsInterfaceGet, -} from "../../api/frontendsInterface/index.js"; -import { Frontend, FrontendUpdate } from "../../models/models.js"; -import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; -import { PollerLike, OperationState } from "@azure/core-lro"; -import { - FrontendsInterfaceListByTrafficControllerOptionalParams, - FrontendsInterfaceDeleteOptionalParams, - FrontendsInterfaceUpdateOptionalParams, - FrontendsInterfaceCreateOrUpdateOptionalParams, - FrontendsInterfaceGetOptionalParams, -} from "../../api/options.js"; - -/** Interface representing a FrontendsInterface operations. */ -export interface FrontendsInterfaceOperations { - /** List Frontend resources by TrafficController */ - listByTrafficController: ( - resourceGroupName: string, - trafficControllerName: string, - options?: FrontendsInterfaceListByTrafficControllerOptionalParams, - ) => PagedAsyncIterableIterator; - /** Delete a Frontend */ - delete: ( - resourceGroupName: string, - trafficControllerName: string, - frontendName: string, - options?: FrontendsInterfaceDeleteOptionalParams, - ) => PollerLike, void>; - /** Update a Frontend */ - update: ( - resourceGroupName: string, - trafficControllerName: string, - frontendName: string, - properties: FrontendUpdate, - options?: FrontendsInterfaceUpdateOptionalParams, - ) => Promise; - /** Create a Frontend */ - createOrUpdate: ( - resourceGroupName: string, - trafficControllerName: string, - frontendName: string, - resource: Frontend, - options?: FrontendsInterfaceCreateOrUpdateOptionalParams, - ) => PollerLike, Frontend>; - /** Get a Frontend */ - get: ( - resourceGroupName: string, - trafficControllerName: string, - frontendName: string, - options?: FrontendsInterfaceGetOptionalParams, - ) => Promise; -} - -function _getFrontendsInterface(context: ServiceNetworkingManagementContext) { - return { - listByTrafficController: ( - resourceGroupName: string, - trafficControllerName: string, - options?: FrontendsInterfaceListByTrafficControllerOptionalParams, - ) => - frontendsInterfaceListByTrafficController( - context, - resourceGroupName, - trafficControllerName, - options, - ), - delete: ( - resourceGroupName: string, - trafficControllerName: string, - frontendName: string, - options?: FrontendsInterfaceDeleteOptionalParams, - ) => - frontendsInterfaceDelete( - context, - resourceGroupName, - trafficControllerName, - frontendName, - options, - ), - update: ( - resourceGroupName: string, - trafficControllerName: string, - frontendName: string, - properties: FrontendUpdate, - options?: FrontendsInterfaceUpdateOptionalParams, - ) => - frontendsInterfaceUpdate( - context, - resourceGroupName, - trafficControllerName, - frontendName, - properties, - options, - ), - createOrUpdate: ( - resourceGroupName: string, - trafficControllerName: string, - frontendName: string, - resource: Frontend, - options?: FrontendsInterfaceCreateOrUpdateOptionalParams, - ) => - frontendsInterfaceCreateOrUpdate( - context, - resourceGroupName, - trafficControllerName, - frontendName, - resource, - options, - ), - get: ( - resourceGroupName: string, - trafficControllerName: string, - frontendName: string, - options?: FrontendsInterfaceGetOptionalParams, - ) => - frontendsInterfaceGet( - context, - resourceGroupName, - trafficControllerName, - frontendName, - options, - ), - }; -} - -export function _getFrontendsInterfaceOperations( - context: ServiceNetworkingManagementContext, -): FrontendsInterfaceOperations { - return { - ..._getFrontendsInterface(context), - }; -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/index.ts deleted file mode 100644 index 08baeed98f..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -export { AssociationsInterfaceOperations } from "./associationsInterface/index.js"; -export { FrontendsInterfaceOperations } from "./frontendsInterface/index.js"; -export { OperationsOperations } from "./operations/index.js"; -export { SecurityPoliciesInterfaceOperations } from "./securityPoliciesInterface/index.js"; -export { TrafficControllerInterfaceOperations } from "./trafficControllerInterface/index.js"; diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/operations/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/operations/index.ts deleted file mode 100644 index 24db186a15..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/operations/index.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementContext } from "../../api/serviceNetworkingManagementContext.js"; -import { operationsList } from "../../api/operations/index.js"; -import { Operation } from "../../models/models.js"; -import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; -import { OperationsListOptionalParams } from "../../api/options.js"; - -/** Interface representing a Operations operations. */ -export interface OperationsOperations { - /** List the operations for the provider */ - list: ( - options?: OperationsListOptionalParams, - ) => PagedAsyncIterableIterator; -} - -function _getOperations(context: ServiceNetworkingManagementContext) { - return { - list: (options?: OperationsListOptionalParams) => - operationsList(context, options), - }; -} - -export function _getOperationsOperations( - context: ServiceNetworkingManagementContext, -): OperationsOperations { - return { - ..._getOperations(context), - }; -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/securityPoliciesInterface/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/securityPoliciesInterface/index.ts deleted file mode 100644 index 276f5e0b68..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/securityPoliciesInterface/index.ts +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementContext } from "../../api/serviceNetworkingManagementContext.js"; -import { - securityPoliciesInterfaceListByTrafficController, - securityPoliciesInterfaceDelete, - securityPoliciesInterfaceUpdate, - securityPoliciesInterfaceCreateOrUpdate, - securityPoliciesInterfaceGet, -} from "../../api/securityPoliciesInterface/index.js"; -import { SecurityPolicy, SecurityPolicyUpdate } from "../../models/models.js"; -import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; -import { PollerLike, OperationState } from "@azure/core-lro"; -import { - SecurityPoliciesInterfaceListByTrafficControllerOptionalParams, - SecurityPoliciesInterfaceDeleteOptionalParams, - SecurityPoliciesInterfaceUpdateOptionalParams, - SecurityPoliciesInterfaceCreateOrUpdateOptionalParams, - SecurityPoliciesInterfaceGetOptionalParams, -} from "../../api/options.js"; - -/** Interface representing a SecurityPoliciesInterface operations. */ -export interface SecurityPoliciesInterfaceOperations { - /** List SecurityPolicy resources by TrafficController */ - listByTrafficController: ( - resourceGroupName: string, - trafficControllerName: string, - options?: SecurityPoliciesInterfaceListByTrafficControllerOptionalParams, - ) => PagedAsyncIterableIterator; - /** Delete a SecurityPolicy */ - delete: ( - resourceGroupName: string, - trafficControllerName: string, - securityPolicyName: string, - options?: SecurityPoliciesInterfaceDeleteOptionalParams, - ) => PollerLike, void>; - /** Update a SecurityPolicy */ - update: ( - resourceGroupName: string, - trafficControllerName: string, - securityPolicyName: string, - properties: SecurityPolicyUpdate, - options?: SecurityPoliciesInterfaceUpdateOptionalParams, - ) => Promise; - /** Create a SecurityPolicy */ - createOrUpdate: ( - resourceGroupName: string, - trafficControllerName: string, - securityPolicyName: string, - resource: SecurityPolicy, - options?: SecurityPoliciesInterfaceCreateOrUpdateOptionalParams, - ) => PollerLike, SecurityPolicy>; - /** Get a SecurityPolicy */ - get: ( - resourceGroupName: string, - trafficControllerName: string, - securityPolicyName: string, - options?: SecurityPoliciesInterfaceGetOptionalParams, - ) => Promise; -} - -function _getSecurityPoliciesInterface( - context: ServiceNetworkingManagementContext, -) { - return { - listByTrafficController: ( - resourceGroupName: string, - trafficControllerName: string, - options?: SecurityPoliciesInterfaceListByTrafficControllerOptionalParams, - ) => - securityPoliciesInterfaceListByTrafficController( - context, - resourceGroupName, - trafficControllerName, - options, - ), - delete: ( - resourceGroupName: string, - trafficControllerName: string, - securityPolicyName: string, - options?: SecurityPoliciesInterfaceDeleteOptionalParams, - ) => - securityPoliciesInterfaceDelete( - context, - resourceGroupName, - trafficControllerName, - securityPolicyName, - options, - ), - update: ( - resourceGroupName: string, - trafficControllerName: string, - securityPolicyName: string, - properties: SecurityPolicyUpdate, - options?: SecurityPoliciesInterfaceUpdateOptionalParams, - ) => - securityPoliciesInterfaceUpdate( - context, - resourceGroupName, - trafficControllerName, - securityPolicyName, - properties, - options, - ), - createOrUpdate: ( - resourceGroupName: string, - trafficControllerName: string, - securityPolicyName: string, - resource: SecurityPolicy, - options?: SecurityPoliciesInterfaceCreateOrUpdateOptionalParams, - ) => - securityPoliciesInterfaceCreateOrUpdate( - context, - resourceGroupName, - trafficControllerName, - securityPolicyName, - resource, - options, - ), - get: ( - resourceGroupName: string, - trafficControllerName: string, - securityPolicyName: string, - options?: SecurityPoliciesInterfaceGetOptionalParams, - ) => - securityPoliciesInterfaceGet( - context, - resourceGroupName, - trafficControllerName, - securityPolicyName, - options, - ), - }; -} - -export function _getSecurityPoliciesInterfaceOperations( - context: ServiceNetworkingManagementContext, -): SecurityPoliciesInterfaceOperations { - return { - ..._getSecurityPoliciesInterface(context), - }; -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/trafficControllerInterface/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/trafficControllerInterface/index.ts deleted file mode 100644 index 628630add2..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/classic/trafficControllerInterface/index.ts +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - TrafficControllerInterfaceListBySubscriptionOptionalParams, - TrafficControllerInterfaceListByResourceGroupOptionalParams, - TrafficControllerInterfaceDeleteOptionalParams, - TrafficControllerInterfaceUpdateOptionalParams, - TrafficControllerInterfaceCreateOrUpdateOptionalParams, - TrafficControllerInterfaceGetOptionalParams, -} from "../../api/options.js"; -import { ServiceNetworkingManagementContext } from "../../api/serviceNetworkingManagementContext.js"; -import { - trafficControllerInterfaceListBySubscription, - trafficControllerInterfaceListByResourceGroup, - trafficControllerInterfaceDelete, - trafficControllerInterfaceUpdate, - trafficControllerInterfaceCreateOrUpdate, - trafficControllerInterfaceGet, -} from "../../api/trafficControllerInterface/index.js"; -import { - TrafficController, - TrafficControllerUpdate, -} from "../../models/models.js"; -import { PagedAsyncIterableIterator } from "../../static-helpers/pagingHelpers.js"; -import { PollerLike, OperationState } from "@azure/core-lro"; - -/** Interface representing a TrafficControllerInterface operations. */ -export interface TrafficControllerInterfaceOperations { - /** List TrafficController resources by subscription ID */ - listBySubscription: ( - options?: TrafficControllerInterfaceListBySubscriptionOptionalParams, - ) => PagedAsyncIterableIterator; - /** List TrafficController resources by resource group */ - listByResourceGroup: ( - resourceGroupName: string, - options?: TrafficControllerInterfaceListByResourceGroupOptionalParams, - ) => PagedAsyncIterableIterator; - /** Delete a TrafficController */ - delete: ( - resourceGroupName: string, - trafficControllerName: string, - options?: TrafficControllerInterfaceDeleteOptionalParams, - ) => PollerLike, void>; - /** Update a TrafficController */ - update: ( - resourceGroupName: string, - trafficControllerName: string, - properties: TrafficControllerUpdate, - options?: TrafficControllerInterfaceUpdateOptionalParams, - ) => Promise; - /** Create a TrafficController */ - createOrUpdate: ( - resourceGroupName: string, - trafficControllerName: string, - resource: TrafficController, - options?: TrafficControllerInterfaceCreateOrUpdateOptionalParams, - ) => PollerLike, TrafficController>; - /** Get a TrafficController */ - get: ( - resourceGroupName: string, - trafficControllerName: string, - options?: TrafficControllerInterfaceGetOptionalParams, - ) => Promise; -} - -function _getTrafficControllerInterface( - context: ServiceNetworkingManagementContext, -) { - return { - listBySubscription: ( - options?: TrafficControllerInterfaceListBySubscriptionOptionalParams, - ) => trafficControllerInterfaceListBySubscription(context, options), - listByResourceGroup: ( - resourceGroupName: string, - options?: TrafficControllerInterfaceListByResourceGroupOptionalParams, - ) => - trafficControllerInterfaceListByResourceGroup( - context, - resourceGroupName, - options, - ), - delete: ( - resourceGroupName: string, - trafficControllerName: string, - options?: TrafficControllerInterfaceDeleteOptionalParams, - ) => - trafficControllerInterfaceDelete( - context, - resourceGroupName, - trafficControllerName, - options, - ), - update: ( - resourceGroupName: string, - trafficControllerName: string, - properties: TrafficControllerUpdate, - options?: TrafficControllerInterfaceUpdateOptionalParams, - ) => - trafficControllerInterfaceUpdate( - context, - resourceGroupName, - trafficControllerName, - properties, - options, - ), - createOrUpdate: ( - resourceGroupName: string, - trafficControllerName: string, - resource: TrafficController, - options?: TrafficControllerInterfaceCreateOrUpdateOptionalParams, - ) => - trafficControllerInterfaceCreateOrUpdate( - context, - resourceGroupName, - trafficControllerName, - resource, - options, - ), - get: ( - resourceGroupName: string, - trafficControllerName: string, - options?: TrafficControllerInterfaceGetOptionalParams, - ) => - trafficControllerInterfaceGet( - context, - resourceGroupName, - trafficControllerName, - options, - ), - }; -} - -export function _getTrafficControllerInterfaceOperations( - context: ServiceNetworkingManagementContext, -): TrafficControllerInterfaceOperations { - return { - ..._getTrafficControllerInterface(context), - }; -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/index.ts deleted file mode 100644 index 8f6b91a7b0..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/index.ts +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - PageSettings, - ContinuablePage, - PagedAsyncIterableIterator, -} from "./static-helpers/pagingHelpers.js"; - -export { ServiceNetworkingManagementClient } from "./serviceNetworkingManagementClient.js"; -export { restorePoller, RestorePollerOptions } from "./restorePollerHelpers.js"; -export { - Operation, - OperationDisplay, - KnownOrigin, - Origin, - KnownActionType, - ActionType, - ErrorResponse, - ErrorDetail, - ErrorAdditionalInfo, - TrafficController, - TrafficControllerProperties, - ResourceId, - SecurityPolicyConfigurations, - WafSecurityPolicy, - KnownProvisioningState, - ProvisioningState, - TrackedResource, - Resource, - SystemData, - KnownCreatedByType, - CreatedByType, - TrafficControllerUpdate, - TrafficControllerUpdateProperties, - SecurityPolicy, - SecurityPolicyProperties, - KnownPolicyType, - PolicyType, - WafPolicy, - SecurityPolicyUpdate, - SecurityPolicyUpdateProperties, - Frontend, - FrontendProperties, - FrontendUpdate, - Association, - AssociationProperties, - KnownAssociationType, - AssociationType, - AssociationSubnet, - AssociationUpdate, - AssociationUpdateProperties, - AssociationSubnetUpdate, - KnownVersions, -} from "./models/index.js"; -export { - OperationsListOptionalParams, - TrafficControllerInterfaceListBySubscriptionOptionalParams, - TrafficControllerInterfaceListByResourceGroupOptionalParams, - TrafficControllerInterfaceDeleteOptionalParams, - TrafficControllerInterfaceUpdateOptionalParams, - TrafficControllerInterfaceCreateOrUpdateOptionalParams, - TrafficControllerInterfaceGetOptionalParams, - SecurityPoliciesInterfaceListByTrafficControllerOptionalParams, - SecurityPoliciesInterfaceDeleteOptionalParams, - SecurityPoliciesInterfaceUpdateOptionalParams, - SecurityPoliciesInterfaceCreateOrUpdateOptionalParams, - SecurityPoliciesInterfaceGetOptionalParams, - FrontendsInterfaceListByTrafficControllerOptionalParams, - FrontendsInterfaceDeleteOptionalParams, - FrontendsInterfaceUpdateOptionalParams, - FrontendsInterfaceCreateOrUpdateOptionalParams, - FrontendsInterfaceGetOptionalParams, - AssociationsInterfaceListByTrafficControllerOptionalParams, - AssociationsInterfaceDeleteOptionalParams, - AssociationsInterfaceUpdateOptionalParams, - AssociationsInterfaceCreateOrUpdateOptionalParams, - AssociationsInterfaceGetOptionalParams, - ServiceNetworkingManagementClientOptionalParams, -} from "./api/index.js"; -export { - AssociationsInterfaceOperations, - FrontendsInterfaceOperations, - OperationsOperations, - SecurityPoliciesInterfaceOperations, - TrafficControllerInterfaceOperations, -} from "./classic/index.js"; -export { PageSettings, ContinuablePage, PagedAsyncIterableIterator }; diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/logger.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/logger.ts deleted file mode 100644 index 01a02f54cd..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/logger.ts +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { createClientLogger } from "@azure/logger"; -export const logger = createClientLogger("arm-servicenetworking"); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/models/index.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/models/index.ts deleted file mode 100644 index fdd6ebc336..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/models/index.ts +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -export { - Operation, - OperationDisplay, - KnownOrigin, - Origin, - KnownActionType, - ActionType, - ErrorResponse, - ErrorDetail, - ErrorAdditionalInfo, - TrafficController, - TrafficControllerProperties, - ResourceId, - SecurityPolicyConfigurations, - WafSecurityPolicy, - KnownProvisioningState, - ProvisioningState, - TrackedResource, - Resource, - SystemData, - KnownCreatedByType, - CreatedByType, - TrafficControllerUpdate, - TrafficControllerUpdateProperties, - SecurityPolicy, - SecurityPolicyProperties, - KnownPolicyType, - PolicyType, - WafPolicy, - SecurityPolicyUpdate, - SecurityPolicyUpdateProperties, - Frontend, - FrontendProperties, - FrontendUpdate, - Association, - AssociationProperties, - KnownAssociationType, - AssociationType, - AssociationSubnet, - AssociationUpdate, - AssociationUpdateProperties, - AssociationSubnetUpdate, - KnownVersions, -} from "./models.js"; diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/models/models.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/models/models.ts deleted file mode 100644 index c9932bff03..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/models/models.ts +++ /dev/null @@ -1,987 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -/** A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. */ -export interface _OperationListResult { - /** The Operation items on this page */ - value: Operation[]; - /** The link to the next page of items */ - nextLink?: string; -} - -export function _operationListResultDeserializer( - item: any, -): _OperationListResult { - return { - value: operationArrayDeserializer(item["value"]), - nextLink: item["nextLink"], - }; -} - -export function operationArrayDeserializer(result: Array): any[] { - return result.map((item) => { - return operationDeserializer(item); - }); -} - -/** Details of a REST API operation, returned from the Resource Provider Operations API */ -export interface Operation { - /** The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" */ - readonly name?: string; - /** Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure Resource Manager/control-plane operations. */ - readonly isDataAction?: boolean; - /** Localized display information for this particular operation. */ - display?: OperationDisplay; - /** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ - readonly origin?: Origin; - /** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ - readonly actionType?: ActionType; -} - -export function operationDeserializer(item: any): Operation { - return { - name: item["name"], - isDataAction: item["isDataAction"], - display: !item["display"] - ? item["display"] - : operationDisplayDeserializer(item["display"]), - origin: item["origin"], - actionType: item["actionType"], - }; -} - -/** Localized display information for and operation. */ -export interface OperationDisplay { - /** The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". */ - readonly provider?: string; - /** The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". */ - readonly resource?: string; - /** The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". */ - readonly operation?: string; - /** The short, localized friendly description of the operation; suitable for tool tips and detailed views. */ - readonly description?: string; -} - -export function operationDisplayDeserializer(item: any): OperationDisplay { - return { - provider: item["provider"], - resource: item["resource"], - operation: item["operation"], - description: item["description"], - }; -} - -/** The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" */ -export enum KnownOrigin { - /** Indicates the operation is initiated by a user. */ - user = "user", - /** Indicates the operation is initiated by a system. */ - system = "system", - /** Indicates the operation is initiated by a user or system. */ - "user,system" = "user,system", -} - -/** - * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" \ - * {@link KnownOrigin} can be used interchangeably with Origin, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **user**: Indicates the operation is initiated by a user. \ - * **system**: Indicates the operation is initiated by a system. \ - * **user,system**: Indicates the operation is initiated by a user or system. - */ -export type Origin = string; - -/** Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ -export enum KnownActionType { - /** Actions are for internal-only APIs. */ - Internal = "Internal", -} - -/** - * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. \ - * {@link KnownActionType} can be used interchangeably with ActionType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Internal**: Actions are for internal-only APIs. - */ -export type ActionType = string; - -/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. */ -export interface ErrorResponse { - /** The error object. */ - error?: ErrorDetail; -} - -export function errorResponseDeserializer(item: any): ErrorResponse { - return { - error: !item["error"] - ? item["error"] - : errorDetailDeserializer(item["error"]), - }; -} - -/** The error detail. */ -export interface ErrorDetail { - /** The error code. */ - readonly code?: string; - /** The error message. */ - readonly message?: string; - /** The error target. */ - readonly target?: string; - /** The error details. */ - readonly details?: ErrorDetail[]; - /** The error additional info. */ - readonly additionalInfo?: ErrorAdditionalInfo[]; -} - -export function errorDetailDeserializer(item: any): ErrorDetail { - return { - code: item["code"], - message: item["message"], - target: item["target"], - details: !item["details"] - ? item["details"] - : errorDetailArrayDeserializer(item["details"]), - additionalInfo: !item["additionalInfo"] - ? item["additionalInfo"] - : errorAdditionalInfoArrayDeserializer(item["additionalInfo"]), - }; -} - -export function errorDetailArrayDeserializer( - result: Array, -): any[] { - return result.map((item) => { - return errorDetailDeserializer(item); - }); -} - -export function errorAdditionalInfoArrayDeserializer( - result: Array, -): any[] { - return result.map((item) => { - return errorAdditionalInfoDeserializer(item); - }); -} - -/** The resource management error additional info. */ -export interface ErrorAdditionalInfo { - /** The additional info type. */ - readonly type?: string; - /** The additional info. */ - readonly info?: Record; -} - -export function errorAdditionalInfoDeserializer( - item: any, -): ErrorAdditionalInfo { - return { - type: item["type"], - info: !item["info"] - ? item["info"] - : _errorAdditionalInfoInfoDeserializer(item["info"]), - }; -} - -/** model interface _ErrorAdditionalInfoInfo */ -export interface _ErrorAdditionalInfoInfo {} - -export function _errorAdditionalInfoInfoDeserializer( - item: any, -): _ErrorAdditionalInfoInfo { - return item; -} - -/** Concrete tracked resource types can be created by aliasing this type using a specific property type. */ -export interface TrafficController extends TrackedResource { - /** The resource-specific properties for this resource. */ - properties?: TrafficControllerProperties; -} - -export function trafficControllerSerializer(item: TrafficController): any { - return { - tags: item["tags"], - location: item["location"], - properties: !item["properties"] - ? item["properties"] - : trafficControllerPropertiesSerializer(item["properties"]), - }; -} - -export function trafficControllerDeserializer(item: any): TrafficController { - return { - tags: item["tags"], - location: item["location"], - id: item["id"], - name: item["name"], - type: item["type"], - systemData: !item["systemData"] - ? item["systemData"] - : systemDataDeserializer(item["systemData"]), - properties: !item["properties"] - ? item["properties"] - : trafficControllerPropertiesDeserializer(item["properties"]), - }; -} - -/** Traffic Controller Properties. */ -export interface TrafficControllerProperties { - /** Configuration Endpoints. */ - readonly configurationEndpoints?: string[]; - /** Frontends References List */ - readonly frontends?: ResourceId[]; - /** Associations References List */ - readonly associations?: ResourceId[]; - /** Security Policies References List */ - readonly securityPolicies?: ResourceId[]; - /** Security Policy Configuration */ - securityPolicyConfigurations?: SecurityPolicyConfigurations; - /** The status of the last operation. */ - readonly provisioningState?: ProvisioningState; -} - -export function trafficControllerPropertiesSerializer( - item: TrafficControllerProperties, -): any { - return { - securityPolicyConfigurations: !item["securityPolicyConfigurations"] - ? item["securityPolicyConfigurations"] - : securityPolicyConfigurationsSerializer( - item["securityPolicyConfigurations"], - ), - }; -} - -export function trafficControllerPropertiesDeserializer( - item: any, -): TrafficControllerProperties { - return { - configurationEndpoints: !item["configurationEndpoints"] - ? item["configurationEndpoints"] - : item["configurationEndpoints"].map((p: any) => { - return p; - }), - frontends: !item["frontends"] - ? item["frontends"] - : resourceIdArrayDeserializer(item["frontends"]), - associations: !item["associations"] - ? item["associations"] - : resourceIdArrayDeserializer(item["associations"]), - securityPolicies: !item["securityPolicies"] - ? item["securityPolicies"] - : resourceIdArrayDeserializer(item["securityPolicies"]), - securityPolicyConfigurations: !item["securityPolicyConfigurations"] - ? item["securityPolicyConfigurations"] - : securityPolicyConfigurationsDeserializer( - item["securityPolicyConfigurations"], - ), - provisioningState: item["provisioningState"], - }; -} - -export function resourceIdArrayDeserializer(result: Array): any[] { - return result.map((item) => { - return resourceIdDeserializer(item); - }); -} - -/** Resource ID definition used by parent to reference child resources. */ -export interface ResourceId { - /** Resource ID of child resource. */ - id: string; -} - -export function resourceIdDeserializer(item: any): ResourceId { - return { - id: item["id"], - }; -} - -/** SecurityPolicyConfigurations Subresource of Traffic Controller. */ -export interface SecurityPolicyConfigurations { - /** Contains reference to a WAF-type security policy that is applied at the Traffic Controller level. */ - wafSecurityPolicy?: WafSecurityPolicy; -} - -export function securityPolicyConfigurationsSerializer( - item: SecurityPolicyConfigurations, -): any { - return { - wafSecurityPolicy: !item["wafSecurityPolicy"] - ? item["wafSecurityPolicy"] - : wafSecurityPolicySerializer(item["wafSecurityPolicy"]), - }; -} - -export function securityPolicyConfigurationsDeserializer( - item: any, -): SecurityPolicyConfigurations { - return { - wafSecurityPolicy: !item["wafSecurityPolicy"] - ? item["wafSecurityPolicy"] - : wafSecurityPolicyDeserializer(item["wafSecurityPolicy"]), - }; -} - -/** Web Application Firewall Security Policy */ -export interface WafSecurityPolicy { - /** Resource ID of the Waf Security Policy */ - id: string; -} - -export function wafSecurityPolicySerializer(item: WafSecurityPolicy): any { - return { id: item["id"] }; -} - -export function wafSecurityPolicyDeserializer(item: any): WafSecurityPolicy { - return { - id: item["id"], - }; -} - -/** Resource Provisioning State Enum */ -export enum KnownProvisioningState { - /** Resource in Provisioning State */ - Provisioning = "Provisioning", - /** Resource in Updating State */ - Updating = "Updating", - /** Resource in Deleting State */ - Deleting = "Deleting", - /** Resource in Accepted State */ - Accepted = "Accepted", - /** Resource in Succeeded State */ - Succeeded = "Succeeded", - /** Resource in Failed State */ - Failed = "Failed", - /** Resource in Canceled State */ - Canceled = "Canceled", -} - -/** - * Resource Provisioning State Enum \ - * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **Provisioning**: Resource in Provisioning State \ - * **Updating**: Resource in Updating State \ - * **Deleting**: Resource in Deleting State \ - * **Accepted**: Resource in Accepted State \ - * **Succeeded**: Resource in Succeeded State \ - * **Failed**: Resource in Failed State \ - * **Canceled**: Resource in Canceled State - */ -export type ProvisioningState = string; - -/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ -export interface TrackedResource extends Resource { - /** Resource tags. */ - tags?: Record; - /** The geo-location where the resource lives */ - location: string; -} - -export function trackedResourceSerializer(item: TrackedResource): any { - return { tags: item["tags"], location: item["location"] }; -} - -export function trackedResourceDeserializer(item: any): TrackedResource { - return { - id: item["id"], - name: item["name"], - type: item["type"], - systemData: !item["systemData"] - ? item["systemData"] - : systemDataDeserializer(item["systemData"]), - tags: item["tags"], - location: item["location"], - }; -} - -/** Common fields that are returned in the response for all Azure Resource Manager resources */ -export interface Resource { - /** Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} */ - readonly id?: string; - /** The name of the resource */ - readonly name?: string; - /** The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" */ - readonly type?: string; - /** Azure Resource Manager metadata containing createdBy and modifiedBy information. */ - readonly systemData?: SystemData; -} - -export function resourceSerializer(item: Resource): any { - return item; -} - -export function resourceDeserializer(item: any): Resource { - return { - id: item["id"], - name: item["name"], - type: item["type"], - systemData: !item["systemData"] - ? item["systemData"] - : systemDataDeserializer(item["systemData"]), - }; -} - -/** Metadata pertaining to creation and last modification of the resource. */ -export interface SystemData { - /** The identity that created the resource. */ - createdBy?: string; - /** The type of identity that created the resource. */ - createdByType?: CreatedByType; - /** The timestamp of resource creation (UTC). */ - createdAt?: Date; - /** The identity that last modified the resource. */ - lastModifiedBy?: string; - /** The type of identity that last modified the resource. */ - lastModifiedByType?: CreatedByType; - /** The timestamp of resource last modification (UTC) */ - lastModifiedAt?: Date; -} - -export function systemDataDeserializer(item: any): SystemData { - return { - createdBy: item["createdBy"], - createdByType: item["createdByType"], - createdAt: !item["createdAt"] - ? item["createdAt"] - : new Date(item["createdAt"]), - lastModifiedBy: item["lastModifiedBy"], - lastModifiedByType: item["lastModifiedByType"], - lastModifiedAt: !item["lastModifiedAt"] - ? item["lastModifiedAt"] - : new Date(item["lastModifiedAt"]), - }; -} - -/** The kind of entity that created the resource. */ -export enum KnownCreatedByType { - /** The entity was created by a user. */ - User = "User", - /** The entity was created by an application. */ - Application = "Application", - /** The entity was created by a managed identity. */ - ManagedIdentity = "ManagedIdentity", - /** The entity was created by a key. */ - Key = "Key", -} - -/** - * The kind of entity that created the resource. \ - * {@link KnowncreatedByType} can be used interchangeably with createdByType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **User**: The entity was created by a user. \ - * **Application**: The entity was created by an application. \ - * **ManagedIdentity**: The entity was created by a managed identity. \ - * **Key**: The entity was created by a key. - */ -export type CreatedByType = string; - -/** The type used for update operations of the TrafficController. */ -export interface TrafficControllerUpdate { - /** Resource tags. */ - tags?: Record; - /** The resource-specific properties for this resource. */ - properties?: TrafficControllerUpdateProperties; -} - -export function trafficControllerUpdateSerializer( - item: TrafficControllerUpdate, -): any { - return { - tags: item["tags"], - properties: !item["properties"] - ? item["properties"] - : trafficControllerUpdatePropertiesSerializer(item["properties"]), - }; -} - -/** The updatable properties of the TrafficController. */ -export interface TrafficControllerUpdateProperties { - /** Security Policy Configuration */ - securityPolicyConfigurations?: SecurityPolicyConfigurations; -} - -export function trafficControllerUpdatePropertiesSerializer( - item: TrafficControllerUpdateProperties, -): any { - return { - securityPolicyConfigurations: !item["securityPolicyConfigurations"] - ? item["securityPolicyConfigurations"] - : securityPolicyConfigurationsSerializer( - item["securityPolicyConfigurations"], - ), - }; -} - -/** The response of a TrafficController list operation. */ -export interface _TrafficControllerListResult { - /** The TrafficController items on this page */ - value: TrafficController[]; - /** The link to the next page of items */ - nextLink?: string; -} - -export function _trafficControllerListResultDeserializer( - item: any, -): _TrafficControllerListResult { - return { - value: trafficControllerArrayDeserializer(item["value"]), - nextLink: item["nextLink"], - }; -} - -export function trafficControllerArraySerializer( - result: Array, -): any[] { - return result.map((item) => { - return trafficControllerSerializer(item); - }); -} - -export function trafficControllerArrayDeserializer( - result: Array, -): any[] { - return result.map((item) => { - return trafficControllerDeserializer(item); - }); -} - -/** SecurityPolicy Subresource of Traffic Controller. */ -export interface SecurityPolicy extends TrackedResource { - /** The resource-specific properties for this resource. */ - properties?: SecurityPolicyProperties; -} - -export function securityPolicySerializer(item: SecurityPolicy): any { - return { - tags: item["tags"], - location: item["location"], - properties: !item["properties"] - ? item["properties"] - : securityPolicyPropertiesSerializer(item["properties"]), - }; -} - -export function securityPolicyDeserializer(item: any): SecurityPolicy { - return { - tags: item["tags"], - location: item["location"], - id: item["id"], - name: item["name"], - type: item["type"], - systemData: !item["systemData"] - ? item["systemData"] - : systemDataDeserializer(item["systemData"]), - properties: !item["properties"] - ? item["properties"] - : securityPolicyPropertiesDeserializer(item["properties"]), - }; -} - -/** SecurityPolicy Properties. */ -export interface SecurityPolicyProperties { - /** Type of the Traffic Controller Security Policy */ - readonly policyType?: PolicyType; - /** Web Application Firewall Policy of the Traffic Controller Security Policy */ - wafPolicy?: WafPolicy; - /** Provisioning State of Traffic Controller SecurityPolicy Resource */ - readonly provisioningState?: ProvisioningState; -} - -export function securityPolicyPropertiesSerializer( - item: SecurityPolicyProperties, -): any { - return { - wafPolicy: !item["wafPolicy"] - ? item["wafPolicy"] - : wafPolicySerializer(item["wafPolicy"]), - }; -} - -export function securityPolicyPropertiesDeserializer( - item: any, -): SecurityPolicyProperties { - return { - policyType: item["policyType"], - wafPolicy: !item["wafPolicy"] - ? item["wafPolicy"] - : wafPolicyDeserializer(item["wafPolicy"]), - provisioningState: item["provisioningState"], - }; -} - -/** Policy Type of the Security Policy */ -export enum KnownPolicyType { - /** Policy of Type WAF */ - WAF = "waf", -} - -/** - * Policy Type of the Security Policy \ - * {@link KnownPolicyType} can be used interchangeably with PolicyType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **waf**: Policy of Type WAF - */ -export type PolicyType = string; - -/** Web Application Firewall Policy */ -export interface WafPolicy { - /** Resource ID of the WAF */ - id: string; -} - -export function wafPolicySerializer(item: WafPolicy): any { - return { id: item["id"] }; -} - -export function wafPolicyDeserializer(item: any): WafPolicy { - return { - id: item["id"], - }; -} - -/** The type used for update operations of the SecurityPolicy. */ -export interface SecurityPolicyUpdate { - /** Resource tags. */ - tags?: Record; - /** The resource-specific properties for this resource. */ - properties?: SecurityPolicyUpdateProperties; -} - -export function securityPolicyUpdateSerializer( - item: SecurityPolicyUpdate, -): any { - return { - tags: item["tags"], - properties: !item["properties"] - ? item["properties"] - : securityPolicyUpdatePropertiesSerializer(item["properties"]), - }; -} - -/** The updatable properties of the SecurityPolicy. */ -export interface SecurityPolicyUpdateProperties { - /** Web Application Firewall Policy of the Traffic Controller Security Policy */ - wafPolicy?: WafPolicy; -} - -export function securityPolicyUpdatePropertiesSerializer( - item: SecurityPolicyUpdateProperties, -): any { - return { - wafPolicy: !item["wafPolicy"] - ? item["wafPolicy"] - : wafPolicySerializer(item["wafPolicy"]), - }; -} - -/** The response of a SecurityPolicy list operation. */ -export interface _SecurityPolicyListResult { - /** The SecurityPolicy items on this page */ - value: SecurityPolicy[]; - /** The link to the next page of items */ - nextLink?: string; -} - -export function _securityPolicyListResultDeserializer( - item: any, -): _SecurityPolicyListResult { - return { - value: securityPolicyArrayDeserializer(item["value"]), - nextLink: item["nextLink"], - }; -} - -export function securityPolicyArraySerializer( - result: Array, -): any[] { - return result.map((item) => { - return securityPolicySerializer(item); - }); -} - -export function securityPolicyArrayDeserializer( - result: Array, -): any[] { - return result.map((item) => { - return securityPolicyDeserializer(item); - }); -} - -/** Frontend Sub Resource of Traffic Controller. */ -export interface Frontend extends TrackedResource { - /** The resource-specific properties for this resource. */ - properties?: FrontendProperties; -} - -export function frontendSerializer(item: Frontend): any { - return { - tags: item["tags"], - location: item["location"], - properties: !item["properties"] - ? item["properties"] - : frontendPropertiesSerializer(item["properties"]), - }; -} - -export function frontendDeserializer(item: any): Frontend { - return { - tags: item["tags"], - location: item["location"], - id: item["id"], - name: item["name"], - type: item["type"], - systemData: !item["systemData"] - ? item["systemData"] - : systemDataDeserializer(item["systemData"]), - properties: !item["properties"] - ? item["properties"] - : frontendPropertiesDeserializer(item["properties"]), - }; -} - -/** Frontend Properties. */ -export interface FrontendProperties { - /** The Fully Qualified Domain Name of the DNS record associated to a Traffic Controller frontend. */ - readonly fqdn?: string; - /** Provisioning State of Traffic Controller Frontend Resource */ - readonly provisioningState?: ProvisioningState; -} - -export function frontendPropertiesSerializer(item: FrontendProperties): any { - return item; -} - -export function frontendPropertiesDeserializer(item: any): FrontendProperties { - return { - fqdn: item["fqdn"], - provisioningState: item["provisioningState"], - }; -} - -/** The type used for update operations of the Frontend. */ -export interface FrontendUpdate { - /** Resource tags. */ - tags?: Record; -} - -export function frontendUpdateSerializer(item: FrontendUpdate): any { - return { tags: item["tags"] }; -} - -/** The response of a Frontend list operation. */ -export interface _FrontendListResult { - /** The Frontend items on this page */ - value: Frontend[]; - /** The link to the next page of items */ - nextLink?: string; -} - -export function _frontendListResultDeserializer( - item: any, -): _FrontendListResult { - return { - value: frontendArrayDeserializer(item["value"]), - nextLink: item["nextLink"], - }; -} - -export function frontendArraySerializer(result: Array): any[] { - return result.map((item) => { - return frontendSerializer(item); - }); -} - -export function frontendArrayDeserializer(result: Array): any[] { - return result.map((item) => { - return frontendDeserializer(item); - }); -} - -/** Association Subresource of Traffic Controller */ -export interface Association extends TrackedResource { - /** The resource-specific properties for this resource. */ - properties?: AssociationProperties; -} - -export function associationSerializer(item: Association): any { - return { - tags: item["tags"], - location: item["location"], - properties: !item["properties"] - ? item["properties"] - : associationPropertiesSerializer(item["properties"]), - }; -} - -export function associationDeserializer(item: any): Association { - return { - tags: item["tags"], - location: item["location"], - id: item["id"], - name: item["name"], - type: item["type"], - systemData: !item["systemData"] - ? item["systemData"] - : systemDataDeserializer(item["systemData"]), - properties: !item["properties"] - ? item["properties"] - : associationPropertiesDeserializer(item["properties"]), - }; -} - -/** Association Properties. */ -export interface AssociationProperties { - /** Association Type */ - associationType: AssociationType; - /** Association Subnet */ - subnet?: AssociationSubnet; - /** Provisioning State of Traffic Controller Association Resource */ - readonly provisioningState?: ProvisioningState; -} - -export function associationPropertiesSerializer( - item: AssociationProperties, -): any { - return { - associationType: item["associationType"], - subnet: !item["subnet"] - ? item["subnet"] - : associationSubnetSerializer(item["subnet"]), - }; -} - -export function associationPropertiesDeserializer( - item: any, -): AssociationProperties { - return { - associationType: item["associationType"], - subnet: !item["subnet"] - ? item["subnet"] - : associationSubnetDeserializer(item["subnet"]), - provisioningState: item["provisioningState"], - }; -} - -/** Association Type Enum */ -export enum KnownAssociationType { - /** Association of Type Subnet */ - subnets = "subnets", -} - -/** - * Association Type Enum \ - * {@link KnownAssociationType} can be used interchangeably with AssociationType, - * this enum contains the known values that the service supports. - * ### Known values supported by the service - * **subnets**: Association of Type Subnet - */ -export type AssociationType = string; - -/** Association Subnet. */ -export interface AssociationSubnet { - /** Association ID. */ - id: string; -} - -export function associationSubnetSerializer(item: AssociationSubnet): any { - return { id: item["id"] }; -} - -export function associationSubnetDeserializer(item: any): AssociationSubnet { - return { - id: item["id"], - }; -} - -/** The type used for update operations of the Association. */ -export interface AssociationUpdate { - /** Resource tags. */ - tags?: Record; - /** The resource-specific properties for this resource. */ - properties?: AssociationUpdateProperties; -} - -export function associationUpdateSerializer(item: AssociationUpdate): any { - return { - tags: item["tags"], - properties: !item["properties"] - ? item["properties"] - : associationUpdatePropertiesSerializer(item["properties"]), - }; -} - -/** The updatable properties of the Association. */ -export interface AssociationUpdateProperties { - /** Association Type */ - associationType?: AssociationType; - /** Association Subnet */ - subnet?: AssociationSubnetUpdate; -} - -export function associationUpdatePropertiesSerializer( - item: AssociationUpdateProperties, -): any { - return { - associationType: item["associationType"], - subnet: !item["subnet"] - ? item["subnet"] - : associationSubnetUpdateSerializer(item["subnet"]), - }; -} - -/** Association Subnet. */ -export interface AssociationSubnetUpdate { - /** Association ID. */ - id: string; -} - -export function associationSubnetUpdateSerializer( - item: AssociationSubnetUpdate, -): any { - return { id: item["id"] }; -} - -/** The response of a Association list operation. */ -export interface _AssociationListResult { - /** The Association items on this page */ - value: Association[]; - /** The link to the next page of items */ - nextLink?: string; -} - -export function _associationListResultDeserializer( - item: any, -): _AssociationListResult { - return { - value: associationArrayDeserializer(item["value"]), - nextLink: item["nextLink"], - }; -} - -export function associationArraySerializer(result: Array): any[] { - return result.map((item) => { - return associationSerializer(item); - }); -} - -export function associationArrayDeserializer( - result: Array, -): any[] { - return result.map((item) => { - return associationDeserializer(item); - }); -} - -/** Api versions */ -export enum KnownVersions { - /** 2023-11-01 stable version */ - v2023_11_01 = "2023-11-01", - /** 2025-01-01 stable version */ - v2025_05_01 = "2025-01-01", -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/restorePollerHelpers.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/restorePollerHelpers.ts deleted file mode 100644 index e9566f4cb5..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/restorePollerHelpers.ts +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { ServiceNetworkingManagementClient } from "./serviceNetworkingManagementClient.js"; -import { - _trafficControllerInterfaceDeleteDeserialize, - _trafficControllerInterfaceCreateOrUpdateDeserialize, -} from "./api/trafficControllerInterface/index.js"; -import { - _securityPoliciesInterfaceDeleteDeserialize, - _securityPoliciesInterfaceCreateOrUpdateDeserialize, -} from "./api/securityPoliciesInterface/index.js"; -import { - _frontendsInterfaceDeleteDeserialize, - _frontendsInterfaceCreateOrUpdateDeserialize, -} from "./api/frontendsInterface/index.js"; -import { - _associationsInterfaceDeleteDeserialize, - _associationsInterfaceCreateOrUpdateDeserialize, -} from "./api/associationsInterface/index.js"; -import { getLongRunningPoller } from "./static-helpers/pollingHelpers.js"; -import { - OperationOptions, - PathUncheckedResponse, -} from "@azure-rest/core-client"; -import { AbortSignalLike } from "@azure/abort-controller"; -import { - PollerLike, - OperationState, - deserializeState, - ResourceLocationConfig, -} from "@azure/core-lro"; - -export interface RestorePollerOptions< - TResult, - TResponse extends PathUncheckedResponse = PathUncheckedResponse, -> extends OperationOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** - * The signal which can be used to abort requests. - */ - abortSignal?: AbortSignalLike; - /** Deserialization function for raw response body */ - processResponseBody?: (result: TResponse) => Promise; -} - -/** - * Creates a poller from the serialized state of another poller. This can be - * useful when you want to create pollers on a different host or a poller - * needs to be constructed after the original one is not in scope. - */ -export function restorePoller( - client: ServiceNetworkingManagementClient, - serializedState: string, - sourceOperation: ( - ...args: any[] - ) => PollerLike, TResult>, - options?: RestorePollerOptions, -): PollerLike, TResult> { - const pollerConfig = deserializeState(serializedState).config; - const { initialRequestUrl, requestMethod, metadata } = pollerConfig; - if (!initialRequestUrl || !requestMethod) { - throw new Error( - `Invalid serialized state: ${serializedState} for sourceOperation ${sourceOperation?.name}`, - ); - } - const resourceLocationConfig = metadata?.["resourceLocationConfig"] as - | ResourceLocationConfig - | undefined; - const { deserializer, expectedStatuses = [] } = - getDeserializationHelper(initialRequestUrl, requestMethod) ?? {}; - const deserializeHelper = options?.processResponseBody ?? deserializer; - if (!deserializeHelper) { - throw new Error( - `Please ensure the operation is in this client! We can't find its deserializeHelper for ${sourceOperation?.name}.`, - ); - } - return getLongRunningPoller( - (client as any)["_client"] ?? client, - deserializeHelper as (result: TResponse) => Promise, - expectedStatuses, - { - updateIntervalInMs: options?.updateIntervalInMs, - abortSignal: options?.abortSignal, - resourceLocationConfig, - restoreFrom: serializedState, - initialRequestUrl, - }, - ); -} - -interface DeserializationHelper { - deserializer: Function; - expectedStatuses: string[]; -} - -const deserializeMap: Record = { - "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}": - { - deserializer: _trafficControllerInterfaceDeleteDeserialize, - expectedStatuses: ["202", "204", "200"], - }, - "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}": - { - deserializer: _trafficControllerInterfaceCreateOrUpdateDeserialize, - expectedStatuses: ["200", "201"], - }, - "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/securityPolicies/{securityPolicyName}": - { - deserializer: _securityPoliciesInterfaceDeleteDeserialize, - expectedStatuses: ["202", "204", "200"], - }, - "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/securityPolicies/{securityPolicyName}": - { - deserializer: _securityPoliciesInterfaceCreateOrUpdateDeserialize, - expectedStatuses: ["200", "201"], - }, - "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/frontends/{frontendName}": - { - deserializer: _frontendsInterfaceDeleteDeserialize, - expectedStatuses: ["202", "204", "200"], - }, - "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/frontends/{frontendName}": - { - deserializer: _frontendsInterfaceCreateOrUpdateDeserialize, - expectedStatuses: ["200", "201"], - }, - "DELETE /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/associations/{associationName}": - { - deserializer: _associationsInterfaceDeleteDeserialize, - expectedStatuses: ["202", "204", "200"], - }, - "PUT /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceNetworking/trafficControllers/{trafficControllerName}/associations/{associationName}": - { - deserializer: _associationsInterfaceCreateOrUpdateDeserialize, - expectedStatuses: ["200", "201"], - }, -}; - -function getDeserializationHelper( - urlStr: string, - method: string, -): DeserializationHelper | undefined { - const path = new URL(urlStr).pathname; - const pathParts = path.split("/"); - - // Traverse list to match the longest candidate - // matchedLen: the length of candidate path - // matchedValue: the matched status code array - let matchedLen = -1, - matchedValue: DeserializationHelper | undefined; - - // Iterate the responseMap to find a match - for (const [key, value] of Object.entries(deserializeMap)) { - // Extracting the path from the map key which is in format - // GET /path/foo - if (!key.startsWith(method)) { - continue; - } - const candidatePath = getPathFromMapKey(key); - // Get each part of the url path - const candidateParts = candidatePath.split("/"); - - // track if we have found a match to return the values found. - let found = true; - for ( - let i = candidateParts.length - 1, j = pathParts.length - 1; - i >= 1 && j >= 1; - i--, j-- - ) { - if ( - candidateParts[i]?.startsWith("{") && - candidateParts[i]?.indexOf("}") !== -1 - ) { - const start = candidateParts[i]!.indexOf("}") + 1, - end = candidateParts[i]?.length; - // If the current part of the candidate is a "template" part - // Try to use the suffix of pattern to match the path - // {guid} ==> $ - // {guid}:export ==> :export$ - const isMatched = new RegExp( - `${candidateParts[i]?.slice(start, end)}`, - ).test(pathParts[j] || ""); - - if (!isMatched) { - found = false; - break; - } - continue; - } - - // If the candidate part is not a template and - // the parts don't match mark the candidate as not found - // to move on with the next candidate path. - if (candidateParts[i] !== pathParts[j]) { - found = false; - break; - } - } - - // We finished evaluating the current candidate parts - // Update the matched value if and only if we found the longer pattern - if (found && candidatePath.length > matchedLen) { - matchedLen = candidatePath.length; - matchedValue = value; - } - } - - return matchedValue; -} - -function getPathFromMapKey(mapKey: string): string { - const pathStart = mapKey.indexOf("/"); - return mapKey.slice(pathStart); -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/serviceNetworkingManagementClient.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/serviceNetworkingManagementClient.ts deleted file mode 100644 index 84ce8c7ca5..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/serviceNetworkingManagementClient.ts +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - _getOperationsOperations, - OperationsOperations, -} from "./classic/operations/index.js"; -import { - _getTrafficControllerInterfaceOperations, - TrafficControllerInterfaceOperations, -} from "./classic/trafficControllerInterface/index.js"; -import { - _getSecurityPoliciesInterfaceOperations, - SecurityPoliciesInterfaceOperations, -} from "./classic/securityPoliciesInterface/index.js"; -import { - _getFrontendsInterfaceOperations, - FrontendsInterfaceOperations, -} from "./classic/frontendsInterface/index.js"; -import { - _getAssociationsInterfaceOperations, - AssociationsInterfaceOperations, -} from "./classic/associationsInterface/index.js"; -import { - createServiceNetworkingManagement, - ServiceNetworkingManagementContext, - ServiceNetworkingManagementClientOptionalParams, -} from "./api/index.js"; -import { Pipeline } from "@azure/core-rest-pipeline"; -import { TokenCredential } from "@azure/core-auth"; - -export { ServiceNetworkingManagementClientOptionalParams } from "./api/serviceNetworkingManagementContext.js"; - -export class ServiceNetworkingManagementClient { - private _client: ServiceNetworkingManagementContext; - /** The pipeline used by this client to make requests */ - public readonly pipeline: Pipeline; - - /** Traffic Controller Provider management API. */ - constructor( - credential: TokenCredential, - subscriptionId: string, - options: ServiceNetworkingManagementClientOptionalParams = {}, - ) { - const prefixFromOptions = options?.userAgentOptions?.userAgentPrefix; - const userAgentPrefix = prefixFromOptions - ? `${prefixFromOptions} azsdk-js-client` - : `azsdk-js-client`; - this._client = createServiceNetworkingManagement( - credential, - subscriptionId, - { ...options, userAgentOptions: { userAgentPrefix } }, - ); - this.pipeline = this._client.pipeline; - this.operations = _getOperationsOperations(this._client); - this.trafficControllerInterface = _getTrafficControllerInterfaceOperations( - this._client, - ); - this.securityPoliciesInterface = _getSecurityPoliciesInterfaceOperations( - this._client, - ); - this.frontendsInterface = _getFrontendsInterfaceOperations(this._client); - this.associationsInterface = _getAssociationsInterfaceOperations( - this._client, - ); - } - - /** The operation groups for operations */ - public readonly operations: OperationsOperations; - /** The operation groups for trafficControllerInterface */ - public readonly trafficControllerInterface: TrafficControllerInterfaceOperations; - /** The operation groups for securityPoliciesInterface */ - public readonly securityPoliciesInterface: SecurityPoliciesInterfaceOperations; - /** The operation groups for frontendsInterface */ - public readonly frontendsInterface: FrontendsInterfaceOperations; - /** The operation groups for associationsInterface */ - public readonly associationsInterface: AssociationsInterfaceOperations; -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/static-helpers/pagingHelpers.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/static-helpers/pagingHelpers.ts deleted file mode 100644 index 97a81e74e3..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/static-helpers/pagingHelpers.ts +++ /dev/null @@ -1,274 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - Client, - createRestError, - PathUncheckedResponse, -} from "@azure-rest/core-client"; -import { RestError } from "@azure/core-rest-pipeline"; - -/** - * Options for the byPage method - */ -export interface PageSettings { - /** - * A reference to a specific page to start iterating from. - */ - continuationToken?: string; -} - -/** - * An interface that describes a page of results. - */ -export type ContinuablePage = TPage & { - /** - * The token that keeps track of where to continue the iterator - */ - continuationToken?: string; -}; - -/** - * An interface that allows async iterable iteration both to completion and by page. - */ -export interface PagedAsyncIterableIterator< - TElement, - TPage = TElement[], - TPageSettings extends PageSettings = PageSettings, -> { - /** - * The next method, part of the iteration protocol - */ - next(): Promise>; - /** - * The connection to the async iterator, part of the iteration protocol - */ - [Symbol.asyncIterator](): PagedAsyncIterableIterator< - TElement, - TPage, - TPageSettings - >; - /** - * Return an AsyncIterableIterator that works a page at a time - */ - byPage: ( - settings?: TPageSettings, - ) => AsyncIterableIterator>; -} - -/** - * An interface that describes how to communicate with the service. - */ -export interface PagedResult< - TElement, - TPage = TElement[], - TPageSettings extends PageSettings = PageSettings, -> { - /** - * Link to the first page of results. - */ - firstPageLink?: string; - /** - * A method that returns a page of results. - */ - getPage: ( - pageLink?: string, - ) => Promise<{ page: TPage; nextPageLink?: string } | undefined>; - /** - * a function to implement the `byPage` method on the paged async iterator. - */ - byPage?: ( - settings?: TPageSettings, - ) => AsyncIterableIterator>; - - /** - * A function to extract elements from a page. - */ - toElements?: (page: TPage) => TElement[]; -} - -/** - * Options for the paging helper - */ -export interface BuildPagedAsyncIteratorOptions { - itemName?: string; - nextLinkName?: string; -} - -/** - * Helper to paginate results in a generic way and return a PagedAsyncIterableIterator - */ -export function buildPagedAsyncIterator< - TElement, - TPage = TElement[], - TPageSettings extends PageSettings = PageSettings, - TResponse extends PathUncheckedResponse = PathUncheckedResponse, ->( - client: Client, - getInitialResponse: () => PromiseLike, - processResponseBody: (result: TResponse) => PromiseLike, - expectedStatuses: string[], - options: BuildPagedAsyncIteratorOptions = {}, -): PagedAsyncIterableIterator { - const itemName = options.itemName ?? "value"; - const nextLinkName = options.nextLinkName ?? "nextLink"; - const pagedResult: PagedResult = { - getPage: async (pageLink?: string) => { - const result = - pageLink === undefined - ? await getInitialResponse() - : await client.pathUnchecked(pageLink).get(); - checkPagingRequest(result, expectedStatuses); - const results = await processResponseBody(result as TResponse); - const nextLink = getNextLink(results, nextLinkName); - const values = getElements(results, itemName) as TPage; - return { - page: values, - nextPageLink: nextLink, - }; - }, - byPage: (settings?: TPageSettings) => { - const { continuationToken } = settings ?? {}; - return getPageAsyncIterator(pagedResult, { - pageLink: continuationToken, - }); - }, - }; - return getPagedAsyncIterator(pagedResult); -} - -/** - * returns an async iterator that iterates over results. It also has a `byPage` - * method that returns pages of items at once. - * - * @param pagedResult - an object that specifies how to get pages. - * @returns a paged async iterator that iterates over results. - */ - -function getPagedAsyncIterator< - TElement, - TPage = TElement[], - TPageSettings extends PageSettings = PageSettings, ->( - pagedResult: PagedResult, -): PagedAsyncIterableIterator { - const iter = getItemAsyncIterator( - pagedResult, - ); - return { - next() { - return iter.next(); - }, - [Symbol.asyncIterator]() { - return this; - }, - byPage: - pagedResult?.byPage ?? - ((settings?: TPageSettings) => { - const { continuationToken } = settings ?? {}; - return getPageAsyncIterator(pagedResult, { - pageLink: continuationToken, - }); - }), - }; -} - -async function* getItemAsyncIterator< - TElement, - TPage, - TPageSettings extends PageSettings, ->( - pagedResult: PagedResult, -): AsyncIterableIterator { - const pages = getPageAsyncIterator(pagedResult); - for await (const page of pages) { - yield* page as unknown as TElement[]; - } -} - -async function* getPageAsyncIterator< - TElement, - TPage, - TPageSettings extends PageSettings, ->( - pagedResult: PagedResult, - options: { - pageLink?: string; - } = {}, -): AsyncIterableIterator> { - const { pageLink } = options; - let response = await pagedResult.getPage( - pageLink ?? pagedResult.firstPageLink, - ); - if (!response) { - return; - } - let result = response.page as ContinuablePage; - result.continuationToken = response.nextPageLink; - yield result; - while (response.nextPageLink) { - response = await pagedResult.getPage(response.nextPageLink); - if (!response) { - return; - } - result = response.page as ContinuablePage; - result.continuationToken = response.nextPageLink; - yield result; - } -} - -/** - * Gets for the value of nextLink in the body - */ -function getNextLink(body: unknown, nextLinkName?: string): string | undefined { - if (!nextLinkName) { - return undefined; - } - - const nextLink = (body as Record)[nextLinkName]; - - if ( - typeof nextLink !== "string" && - typeof nextLink !== "undefined" && - nextLink !== null - ) { - throw new RestError( - `Body Property ${nextLinkName} should be a string or undefined or null but got ${typeof nextLink}`, - ); - } - - if (nextLink === null) { - return undefined; - } - - return nextLink; -} - -/** - * Gets the elements of the current request in the body. - */ -function getElements(body: unknown, itemName: string): T[] { - const value = (body as Record)[itemName] as T[]; - if (!Array.isArray(value)) { - throw new RestError( - `Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`, - ); - } - - return value ?? []; -} - -/** - * Checks if a request failed - */ -function checkPagingRequest( - response: PathUncheckedResponse, - expectedStatuses: string[], -): void { - if (!expectedStatuses.includes(response.status)) { - throw createRestError( - `Pagination failed with unexpected statusCode ${response.status}`, - response, - ); - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/static-helpers/pollingHelpers.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/static-helpers/pollingHelpers.ts deleted file mode 100644 index 2edbf783be..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/src/static-helpers/pollingHelpers.ts +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - PollerLike, - OperationState, - ResourceLocationConfig, - RunningOperation, - createHttpPoller, - OperationResponse, -} from "@azure/core-lro"; - -import { - Client, - PathUncheckedResponse, - createRestError, -} from "@azure-rest/core-client"; -import { AbortSignalLike } from "@azure/abort-controller"; - -export interface GetLongRunningPollerOptions { - /** Delay to wait until next poll, in milliseconds. */ - updateIntervalInMs?: number; - /** - * The signal which can be used to abort requests. - */ - abortSignal?: AbortSignalLike; - /** - * The potential location of the result of the LRO if specified by the LRO extension in the swagger. - */ - resourceLocationConfig?: ResourceLocationConfig; - /** - * The original url of the LRO - * Should not be null when restoreFrom is set - */ - initialRequestUrl?: string; - /** - * A serialized poller which can be used to resume an existing paused Long-Running-Operation. - */ - restoreFrom?: string; - /** - * The function to get the initial response - */ - getInitialResponse?: () => PromiseLike; -} -export function getLongRunningPoller< - TResponse extends PathUncheckedResponse, - TResult = void, ->( - client: Client, - processResponseBody: (result: TResponse) => Promise, - expectedStatuses: string[], - options: GetLongRunningPollerOptions, -): PollerLike, TResult> { - const { restoreFrom, getInitialResponse } = options; - if (!restoreFrom && !getInitialResponse) { - throw new Error( - "Either restoreFrom or getInitialResponse must be specified", - ); - } - let initialResponse: TResponse | undefined = undefined; - const pollAbortController = new AbortController(); - const poller: RunningOperation = { - sendInitialRequest: async () => { - if (!getInitialResponse) { - throw new Error( - "getInitialResponse is required when initializing a new poller", - ); - } - initialResponse = await getInitialResponse(); - return getLroResponse(initialResponse, expectedStatuses); - }, - sendPollRequest: async ( - path: string, - pollOptions?: { - abortSignal?: AbortSignalLike; - }, - ) => { - // The poll request would both listen to the user provided abort signal and the poller's own abort signal - function abortListener(): void { - pollAbortController.abort(); - } - const abortSignal = pollAbortController.signal; - if (options.abortSignal?.aborted) { - pollAbortController.abort(); - } else if (pollOptions?.abortSignal?.aborted) { - pollAbortController.abort(); - } else if (!abortSignal.aborted) { - options.abortSignal?.addEventListener("abort", abortListener, { - once: true, - }); - pollOptions?.abortSignal?.addEventListener("abort", abortListener, { - once: true, - }); - } - let response; - try { - response = await client.pathUnchecked(path).get({ abortSignal }); - } finally { - options.abortSignal?.removeEventListener("abort", abortListener); - pollOptions?.abortSignal?.removeEventListener("abort", abortListener); - } - - return getLroResponse(response as TResponse, expectedStatuses); - }, - }; - return createHttpPoller(poller, { - intervalInMs: options?.updateIntervalInMs, - resourceLocationConfig: options?.resourceLocationConfig, - restoreFrom: options?.restoreFrom, - processResult: (result: unknown) => { - return processResponseBody(result as TResponse); - }, - }); -} -/** - * Converts a Rest Client response to a response that the LRO implementation understands - * @param response - a rest client http response - * @param deserializeFn - deserialize function to convert Rest response to modular output - * @returns - An LRO response that the LRO implementation understands - */ -function getLroResponse( - response: TResponse, - expectedStatuses: string[], -): OperationResponse { - if (!expectedStatuses.includes(response.status)) { - throw createRestError(response); - } - - return { - flatResponse: response, - rawResponse: { - ...response, - statusCode: Number.parseInt(response.status), - body: response.body, - }, - }; -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/test/public/sampleTest.spec.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/test/public/sampleTest.spec.ts deleted file mode 100644 index d4919ac91a..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/test/public/sampleTest.spec.ts +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { createRecorder } from "./utils/recordedClient.js"; -import { assert, beforeEach, afterEach, it, describe } from "vitest"; - -describe("My test", () => { - // let recorder: Recorder; - - beforeEach(async function () { - // recorder = await createRecorder(this); - }); - - afterEach(async function () { - // await recorder.stop(); - }); - - it("sample test", async function () { - assert.equal(1, 1); - }); -}); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/test/public/utils/recordedClient.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/test/public/utils/recordedClient.ts deleted file mode 100644 index 6e425fdcfd..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/test/public/utils/recordedClient.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { - Recorder, - RecorderStartOptions, - VitestTestContext, -} from "@azure-tools/test-recorder"; - -const replaceableVariables: Record = { - SUBSCRIPTION_ID: "azure_subscription_id", -}; - -const recorderEnvSetup: RecorderStartOptions = { - envSetupForPlayback: replaceableVariables, -}; - -/** - * creates the recorder and reads the environment variables from the `.env` file. - * Should be called first in the test suite to make sure environment variables are - * read before they are being used. - */ -export async function createRecorder( - context: VitestTestContext, -): Promise { - const recorder = new Recorder(context); - await recorder.start(recorderEnvSetup); - return recorder; -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/tsconfig.json b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/tsconfig.json deleted file mode 100644 index 30099587a7..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2017", - "module": "NodeNext", - "lib": [], - "declaration": true, - "declarationMap": true, - "inlineSources": true, - "sourceMap": true, - "importHelpers": true, - "strict": true, - "alwaysStrict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "forceConsistentCasingInFileNames": true, - "moduleResolution": "NodeNext", - "allowSyntheticDefaultImports": true, - "esModuleInterop": true, - "paths": { "@azure/arm-servicenetworking": ["./src/index"] } - }, - "include": ["src/**/*.ts", "test/**/*.ts", "samples-dev/**/*.ts"] -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/vitest.browser.config.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/vitest.browser.config.ts deleted file mode 100644 index ffa15d2516..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/vitest.browser.config.ts +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { defineConfig } from "vitest/config"; -import { relativeRecordingsPath } from "@azure-tools/test-recorder"; - -process.env.RECORDINGS_RELATIVE_PATH = relativeRecordingsPath(); - -export default defineConfig({ - define: { - "process.env": process.env, - }, - test: { - reporters: ["basic", "junit"], - outputFile: { - junit: "test-results.browser.xml", - }, - browser: { - enabled: true, - headless: true, - name: "chromium", - provider: "playwright", - }, - fakeTimers: { - toFake: ["setTimeout", "Date"], - }, - watch: false, - include: ["test/**/*.spec.ts"], - coverage: { - include: ["test/**/*.spec.ts"], - provider: "istanbul", - reporter: ["text", "json", "html"], - reportsDirectory: "coverage-browser", - }, - testTimeout: 1200000, - hookTimeout: 1200000, - }, -}); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/vitest.config.ts b/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/vitest.config.ts deleted file mode 100644 index 2cf5d0e02c..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking/vitest.config.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { defineConfig } from "vitest/config"; -import { relativeRecordingsPath } from "@azure-tools/test-recorder"; - -export default defineConfig({ - test: { - reporters: ["basic", "junit"], - outputFile: { - junit: "test-results.browser.xml", - }, - fakeTimers: { - toFake: ["setTimeout", "Date"], - }, - watch: false, - include: ["test/**/*.spec.ts"], - exclude: ["test/**/browser/*.spec.ts"], - coverage: { - include: ["src/**/*.ts"], - exclude: [ - "src/**/*-browser.mts", - "src/**/*-react-native.mts", - "vitest*.config.ts", - "samples-dev/**/*.ts", - ], - provider: "istanbul", - reporter: ["text", "json", "html"], - reportsDirectory: "coverage", - }, - testTimeout: 1200000, - hookTimeout: 1200000, - }, -}); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/client.tsp b/packages/typespec-test/test/ServiceNetworking.Management/spec/client.tsp deleted file mode 100644 index 668473769c..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/client.tsp +++ /dev/null @@ -1,18 +0,0 @@ -import "./main.tsp"; -import "@azure-tools/typespec-client-generator-core"; - -using Azure.ClientGenerator.Core; - -@@clientName(Microsoft.ServiceNetworking, "ServiceNetworkingMgmt", "python"); -@@clientName(Microsoft.ServiceNetworking, - "ServiceNetworkingManagementClient", - "javascript" -); -@@clientName(Microsoft.ServiceNetworking, - "TrafficControllerManagementClient", - "java" -); -@@clientNamespace(Microsoft.ServiceNetworking, - "com.azure.resourcemanager.servicenetworking", - "java" -); diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationDelete.json deleted file mode 100644 index d67a519709..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationDelete.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "title": "Delete Association", - "operationId": "AssociationsInterface_Delete", - "parameters": { - "api-version": "2023-11-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "associationName": "as1" - }, - "responses": { - "202": { - "headers": { - "Retry-After": 3, - "location": "https://blobLocation.com" - } - }, - "204": {} - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationGet.json deleted file mode 100644 index f67a82d397..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationGet.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "title": "Get Association", - "operationId": "AssociationsInterface_Get", - "parameters": { - "api-version": "2023-11-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "associationName": "as1" - }, - "responses": { - "200": { - "body": { - "name": "as1", - "type": "Microsoft.ServiceNetworking/trafficControllers/associations", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", - "location": "NorthCentralUS", - "properties": { - "associationType": "subnets", - "subnet": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" - }, - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationPatch.json deleted file mode 100644 index d6cbba4578..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationPatch.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "title": "Update Association", - "operationId": "AssociationsInterface_Update", - "parameters": { - "api-version": "2023-11-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "associationName": "as1", - "properties": { - "properties": { - "associationType": "subnets", - "subnet": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" - } - } - } - }, - "responses": { - "200": { - "body": { - "name": "as1", - "type": "Microsoft.ServiceNetworking/trafficControllers/associations", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", - "location": "NorthCentralUS", - "properties": { - "associationType": "subnets", - "subnet": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" - } - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationPut.json deleted file mode 100644 index 3f9776f48c..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationPut.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "title": "Put Association", - "operationId": "AssociationsInterface_CreateOrUpdate", - "parameters": { - "api-version": "2023-11-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "associationName": "as1", - "resource": { - "location": "NorthCentralUS", - "properties": { - "associationType": "subnets", - "subnet": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" - } - } - } - }, - "responses": { - "200": { - "body": { - "name": "associatedvnet-1", - "type": "Microsoft.ServiceNetworking/trafficControllers/associations", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", - "location": "NorthCentralUS", - "properties": { - "associationType": "subnets", - "subnet": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" - }, - "provisioningState": "Accepted" - } - } - }, - "201": { - "body": { - "name": "associatedvnet-1", - "type": "Microsoft.ServiceNetworking/trafficControllers/associations", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", - "location": "NorthCentralUS", - "properties": { - "associationType": "subnets", - "subnet": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" - } - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationsGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationsGet.json deleted file mode 100644 index 0ce9360d8e..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/AssociationsGet.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "title": "Get Associations", - "operationId": "AssociationsInterface_ListByTrafficController", - "parameters": { - "api-version": "2023-11-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1" - }, - "responses": { - "200": { - "body": { - "value": [ - { - "name": "as1", - "type": "Microsoft.ServiceNetworking/trafficControllers/associations", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", - "location": "NorthCentralUS", - "properties": { - "associationType": "subnets", - "subnet": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" - }, - "provisioningState": "Succeeded" - } - } - ] - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendDelete.json deleted file mode 100644 index 08e0d5e826..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendDelete.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "title": "Delete Frontend", - "operationId": "FrontendsInterface_Delete", - "parameters": { - "api-version": "2023-11-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "frontendName": "fe1" - }, - "responses": { - "202": { - "headers": { - "Retry-After": 3, - "location": "https://blobLocation.com" - } - }, - "204": {} - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendGet.json deleted file mode 100644 index 89c63abe81..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendGet.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "title": "Get Frontend", - "operationId": "FrontendsInterface_Get", - "parameters": { - "api-version": "2023-11-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "frontendName": "fe1" - }, - "responses": { - "200": { - "body": { - "name": "fe1", - "location": "NorthCentralUS", - "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", - "properties": { - "fqdn": "test.net", - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendPatch.json deleted file mode 100644 index 251cf906d1..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendPatch.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "title": "Update Frontend", - "operationId": "FrontendsInterface_Update", - "parameters": { - "api-version": "2023-11-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "frontendName": "fe1", - "properties": {} - }, - "responses": { - "200": { - "body": { - "name": "fe1", - "location": "NorthCentralUS", - "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", - "properties": { - "fqdn": "test.net", - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendPut.json deleted file mode 100644 index d56c9b4499..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendPut.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "title": "Put Frontend", - "operationId": "FrontendsInterface_CreateOrUpdate", - "parameters": { - "api-version": "2023-11-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "frontendName": "fe1", - "resource": { - "location": "NorthCentralUS", - "properties": {} - } - }, - "responses": { - "200": { - "body": { - "name": "fe1", - "location": "NorthCentralUS", - "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", - "properties": { - "fqdn": "test.net", - "provisioningState": "Succeeded" - } - } - }, - "201": { - "body": { - "name": "fe1", - "location": "NorthCentralUS", - "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", - "properties": { - "fqdn": "test.net", - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendsGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendsGet.json deleted file mode 100644 index 08dbeb1100..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/FrontendsGet.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "title": "Get Frontends", - "operationId": "FrontendsInterface_ListByTrafficController", - "parameters": { - "api-version": "2023-11-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1" - }, - "responses": { - "200": { - "body": { - "value": [ - { - "name": "fe1", - "location": "NorthCentralUS", - "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", - "properties": { - "fqdn": "test.net", - "provisioningState": "Succeeded" - } - } - ] - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/OperationsList.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/OperationsList.json deleted file mode 100644 index 89f43a23b6..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/OperationsList.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "title": "Get Operations List", - "operationId": "Operations_List", - "parameters": { - "api-version": "2023-11-01" - }, - "responses": { - "200": { - "body": { - "value": [ - { - "name": "Microsoft.ServiceNetworking/trafficControllers/read", - "isDataAction": false, - "display": { - "provider": "Microsoft Service Networking", - "resource": "Traffic Controller", - "operation": "Get Traffic Controller configuration", - "description": "Traffic Controller is a L7 Load Balancing solution for a Multi Cluster setup" - }, - "origin": "user,system" - } - ] - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerDelete.json deleted file mode 100644 index 3037ebf88c..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerDelete.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "title": "Delete Traffic Controller", - "operationId": "TrafficControllerInterface_Delete", - "parameters": { - "api-version": "2023-11-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1" - }, - "responses": { - "202": { - "headers": { - "Retry-After": 3, - "location": "https://blobLocation.com" - } - }, - "204": {} - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerGet.json deleted file mode 100644 index 25ec6b5db8..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerGet.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "operationId": "TrafficControllerInterface_Get", - "title": "Get Traffic Controller", - "parameters": { - "api-version": "2023-11-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1" - }, - "responses": { - "200": { - "body": { - "name": "tc1", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", - "type": "Microsoft.ServiceNetworking/trafficControllers", - "location": "NorthCentralUS", - "tags": { - "key1": "value1" - }, - "properties": { - "configurationEndpoints": [ - "abc.trafficcontroller.azure.net" - ], - "frontends": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" - } - ], - "associations": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" - } - ], - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerPatch.json deleted file mode 100644 index 2dba4c176a..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerPatch.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "operationId": "TrafficControllerInterface_Update", - "title": "Patch Traffic Controller", - "parameters": { - "api-version": "2023-11-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "properties": { - "tags": { - "key1": "value1" - } - } - }, - "responses": { - "200": { - "body": { - "name": "tc1", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", - "type": "Microsoft.ServiceNetworking/trafficControllers", - "location": "NorthCentralUS", - "tags": { - "key1": "value1" - }, - "properties": { - "configurationEndpoints": [ - "abc.trafficcontroller.azure.net" - ], - "frontends": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" - } - ], - "associations": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" - } - ], - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerPut.json deleted file mode 100644 index 269c1516ca..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllerPut.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "operationId": "TrafficControllerInterface_CreateOrUpdate", - "title": "Put Traffic Controller", - "parameters": { - "api-version": "2023-11-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "resource": { - "location": "NorthCentralUS", - "tags": { - "key1": "value1" - } - } - }, - "responses": { - "200": { - "body": { - "name": "tc1", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", - "type": "Microsoft.ServiceNetworking/trafficControllers", - "location": "NorthCentralUS", - "tags": { - "key1": "value1" - }, - "properties": { - "configurationEndpoints": [ - "abc.trafficcontroller.azure.net" - ], - "frontends": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" - } - ], - "associations": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" - } - ], - "provisioningState": "Succeeded" - } - } - }, - "201": { - "body": { - "name": "tc1", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", - "type": "Microsoft.ServiceNetworking/trafficControllers", - "location": "NorthCentralUS", - "tags": { - "key1": "value1" - }, - "properties": { - "configurationEndpoints": [ - "abc.trafficcontroller.azure.net" - ], - "frontends": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" - } - ], - "associations": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" - } - ], - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllersGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllersGet.json deleted file mode 100644 index 5639436de0..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllersGet.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "operationId": "TrafficControllerInterface_ListByResourceGroup", - "title": "Get Traffic Controllers", - "parameters": { - "api-version": "2023-11-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1" - }, - "responses": { - "200": { - "body": { - "value": [ - { - "name": "tc1", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", - "type": "Microsoft.ServiceNetworking/trafficControllers", - "location": "NorthCentralUS", - "tags": { - "key1": "value1" - }, - "properties": { - "configurationEndpoints": [ - "abc.trafficcontroller.azure.net" - ], - "frontends": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" - } - ], - "associations": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" - } - ], - "provisioningState": "Succeeded" - } - } - ] - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllersGetList.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllersGetList.json deleted file mode 100644 index eba2c88502..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2023-11-01/TrafficControllersGetList.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "operationId": "TrafficControllerInterface_ListBySubscription", - "title": "Get Traffic Controllers List", - "parameters": { - "api-version": "2023-11-01", - "subscriptionId": "subid" - }, - "responses": { - "200": { - "body": { - "value": [ - { - "name": "tc1", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", - "type": "Microsoft.ServiceNetworking/trafficControllers", - "location": "NorthCentralUS", - "tags": { - "key1": "value1" - }, - "properties": { - "configurationEndpoints": [ - "abc.trafficcontroller.azure.net" - ], - "frontends": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" - } - ], - "associations": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" - } - ], - "provisioningState": "Succeeded" - } - } - ] - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationDelete.json deleted file mode 100644 index 4bda79e734..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationDelete.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "title": "Delete Association", - "operationId": "AssociationsInterface_Delete", - "parameters": { - "api-version": "2024-05-01-preview", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "associationName": "as1" - }, - "responses": { - "202": { - "headers": { - "Retry-After": 3, - "location": "https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1" - } - }, - "204": {} - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationGet.json deleted file mode 100644 index d4caea970e..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationGet.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "title": "Get Association", - "operationId": "AssociationsInterface_Get", - "parameters": { - "api-version": "2024-05-01-preview", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "associationName": "as1" - }, - "responses": { - "200": { - "body": { - "name": "as1", - "type": "Microsoft.ServiceNetworking/trafficControllers/associations", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", - "location": "NorthCentralUS", - "properties": { - "associationType": "subnets", - "subnet": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" - }, - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationPatch.json deleted file mode 100644 index 0c5c80d812..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationPatch.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "title": "Update Association", - "operationId": "AssociationsInterface_Update", - "parameters": { - "api-version": "2024-05-01-preview", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "associationName": "as1", - "properties": { - "properties": { - "associationType": "subnets", - "subnet": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" - } - } - } - }, - "responses": { - "200": { - "body": { - "name": "as1", - "type": "Microsoft.ServiceNetworking/trafficControllers/associations", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", - "location": "NorthCentralUS", - "properties": { - "associationType": "subnets", - "subnet": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" - } - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationPut.json deleted file mode 100644 index e07ef2aef8..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationPut.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "title": "Put Association", - "operationId": "AssociationsInterface_CreateOrUpdate", - "parameters": { - "api-version": "2024-05-01-preview", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "associationName": "as1", - "resource": { - "location": "NorthCentralUS", - "properties": { - "associationType": "subnets", - "subnet": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" - } - } - } - }, - "responses": { - "200": { - "body": { - "name": "associatedvnet-1", - "type": "Microsoft.ServiceNetworking/trafficControllers/associations", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", - "location": "NorthCentralUS", - "properties": { - "associationType": "subnets", - "subnet": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" - }, - "provisioningState": "Accepted" - } - } - }, - "201": { - "body": { - "name": "associatedvnet-1", - "type": "Microsoft.ServiceNetworking/trafficControllers/associations", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", - "location": "NorthCentralUS", - "properties": { - "associationType": "subnets", - "subnet": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" - } - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationsGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationsGet.json deleted file mode 100644 index ec481b0f9f..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/AssociationsGet.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "title": "Get Associations", - "operationId": "AssociationsInterface_ListByTrafficController", - "parameters": { - "api-version": "2024-05-01-preview", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1" - }, - "responses": { - "200": { - "body": { - "value": [ - { - "name": "as1", - "type": "Microsoft.ServiceNetworking/trafficControllers/associations", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", - "location": "NorthCentralUS", - "properties": { - "associationType": "subnets", - "subnet": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" - }, - "provisioningState": "Succeeded" - } - } - ] - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendDelete.json deleted file mode 100644 index 583d2073ca..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendDelete.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "title": "Delete Frontend", - "operationId": "FrontendsInterface_Delete", - "parameters": { - "api-version": "2024-05-01-preview", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "frontendName": "fe1" - }, - "responses": { - "202": { - "headers": { - "Retry-After": 3, - "location": "https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" - } - }, - "204": {} - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendGet.json deleted file mode 100644 index 9c5659b2be..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendGet.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "title": "Get Frontend", - "operationId": "FrontendsInterface_Get", - "parameters": { - "api-version": "2024-05-01-preview", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "frontendName": "fe1" - }, - "responses": { - "200": { - "body": { - "name": "fe1", - "location": "NorthCentralUS", - "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", - "properties": { - "fqdn": "test.net", - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendPatch.json deleted file mode 100644 index 28da65c447..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendPatch.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "title": "Update Frontend", - "operationId": "FrontendsInterface_Update", - "parameters": { - "api-version": "2024-05-01-preview", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "frontendName": "fe1", - "properties": {} - }, - "responses": { - "200": { - "body": { - "name": "fe1", - "location": "NorthCentralUS", - "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", - "properties": { - "fqdn": "test.net", - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendPut.json deleted file mode 100644 index 4d389aab93..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendPut.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "title": "Put Frontend", - "operationId": "FrontendsInterface_CreateOrUpdate", - "parameters": { - "api-version": "2024-05-01-preview", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "frontendName": "fe1", - "resource": { - "location": "NorthCentralUS", - "properties": {} - } - }, - "responses": { - "200": { - "body": { - "name": "fe1", - "location": "NorthCentralUS", - "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", - "properties": { - "fqdn": "test.net", - "provisioningState": "Succeeded" - } - } - }, - "201": { - "body": { - "name": "fe1", - "location": "NorthCentralUS", - "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", - "properties": { - "fqdn": "test.net", - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendsGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendsGet.json deleted file mode 100644 index e6dcc4cf4a..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/FrontendsGet.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "title": "Get Frontends", - "operationId": "FrontendsInterface_ListByTrafficController", - "parameters": { - "api-version": "2024-05-01-preview", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1" - }, - "responses": { - "200": { - "body": { - "value": [ - { - "name": "fe1", - "location": "NorthCentralUS", - "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", - "properties": { - "fqdn": "test.net", - "provisioningState": "Succeeded" - } - } - ] - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/OperationsList.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/OperationsList.json deleted file mode 100644 index 3f201f1622..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/OperationsList.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "title": "Get Operations List", - "operationId": "Operations_List", - "parameters": { - "api-version": "2024-05-01-preview" - }, - "responses": { - "200": { - "body": { - "value": [ - { - "name": "Microsoft.ServiceNetworking/trafficControllers/read", - "isDataAction": false, - "display": { - "provider": "Microsoft Service Networking", - "resource": "Traffic Controller", - "operation": "Get Traffic Controller configuration", - "description": "Traffic Controller is a L7 Load Balancing solution for a Multi Cluster setup" - }, - "origin": "user,system" - } - ] - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPoliciesGetList.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPoliciesGetList.json deleted file mode 100644 index c1f973169e..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPoliciesGetList.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "title": "Get SecurityPolicies", - "operationId": "SecurityPoliciesInterface_ListByTrafficController", - "parameters": { - "api-version": "2024-05-01-preview", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1" - }, - "responses": { - "200": { - "body": { - "value": [ - { - "name": "waf-0", - "type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0", - "location": "eastus", - "properties": { - "policyType": "waf", - "wafPolicy": { - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" - }, - "provisioningState": "Succeeded" - } - } - ] - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyDelete.json deleted file mode 100644 index 348aaea8e8..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyDelete.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "title": "Delete SecurityPolicy", - "operationId": "SecurityPoliciesInterface_Delete", - "parameters": { - "api-version": "2024-05-01-preview", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "securityPolicyName": "sp1" - }, - "responses": { - "202": { - "headers": { - "Retry-After": 3, - "location": "https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" - } - }, - "204": {} - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyGet.json deleted file mode 100644 index 25ba7bc5d6..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyGet.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "title": "Get SecurityPolicy", - "operationId": "SecurityPoliciesInterface_Get", - "parameters": { - "api-version": "2024-05-01-preview", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "securityPolicyName": "sp1" - }, - "responses": { - "200": { - "body": { - "name": "waf-0", - "type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0", - "location": "eastus", - "properties": { - "policyType": "waf", - "wafPolicy": { - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" - }, - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyPatch.json deleted file mode 100644 index fbb8f7672c..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyPatch.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "title": "Update SecurityPolicy", - "operationId": "SecurityPoliciesInterface_Update", - "parameters": { - "api-version": "2024-05-01-preview", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "securityPolicyName": "sp1", - "properties": { - "properties": { - "wafPolicy": { - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" - } - } - } - }, - "responses": { - "200": { - "body": { - "name": "waf-0", - "type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0", - "location": "eastus", - "properties": { - "policyType": "waf", - "wafPolicy": { - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" - }, - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyPut.json deleted file mode 100644 index b28178d793..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/SecurityPolicyPut.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "title": "Put SecurityPolicy", - "operationId": "SecurityPoliciesInterface_CreateOrUpdate", - "parameters": { - "api-version": "2024-05-01-preview", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "securityPolicyName": "sp1", - "resource": { - "location": "NorthCentralUS", - "properties": { - "wafPolicy": { - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" - } - } - } - }, - "responses": { - "200": { - "body": { - "name": "waf-0", - "type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0", - "location": "eastus", - "properties": { - "policyType": "waf", - "wafPolicy": { - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" - }, - "provisioningState": "Succeeded" - } - } - }, - "201": { - "body": { - "name": "waf-0", - "type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0", - "location": "eastus", - "properties": { - "policyType": "waf", - "wafPolicy": { - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" - }, - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerDelete.json deleted file mode 100644 index 3731d45552..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerDelete.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "title": "Delete Traffic Controller", - "operationId": "TrafficControllerInterface_Delete", - "parameters": { - "api-version": "2024-05-01-preview", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1" - }, - "responses": { - "202": { - "headers": { - "Retry-After": 3, - "location": "https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1" - } - }, - "204": {} - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerGet.json deleted file mode 100644 index be47be64ee..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerGet.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "operationId": "TrafficControllerInterface_Get", - "title": "Get Traffic Controller", - "parameters": { - "api-version": "2024-05-01-preview", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1" - }, - "responses": { - "200": { - "body": { - "name": "tc1", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", - "type": "Microsoft.ServiceNetworking/trafficControllers", - "location": "NorthCentralUS", - "tags": { - "key1": "value1" - }, - "properties": { - "configurationEndpoints": [ - "abc.trafficcontroller.azure.net" - ], - "frontends": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" - } - ], - "associations": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" - } - ], - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerPatch.json deleted file mode 100644 index 7d0958ff0a..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerPatch.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "operationId": "TrafficControllerInterface_Update", - "title": "Patch Traffic Controller", - "parameters": { - "api-version": "2024-05-01-preview", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "properties": { - "tags": { - "key1": "value1" - } - } - }, - "responses": { - "200": { - "body": { - "name": "tc1", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", - "type": "Microsoft.ServiceNetworking/trafficControllers", - "location": "NorthCentralUS", - "tags": { - "key1": "value1" - }, - "properties": { - "configurationEndpoints": [ - "abc.trafficcontroller.azure.net" - ], - "frontends": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" - } - ], - "associations": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" - } - ], - "securityPolicies": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" - } - ], - "securityPolicyConfigurations": { - "wafSecurityPolicy": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/waf-0" - } - }, - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerPut.json deleted file mode 100644 index cec3b91344..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllerPut.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "operationId": "TrafficControllerInterface_CreateOrUpdate", - "title": "Put Traffic Controller", - "parameters": { - "api-version": "2024-05-01-preview", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "resource": { - "location": "NorthCentralUS", - "tags": { - "key1": "value1" - } - } - }, - "responses": { - "200": { - "body": { - "name": "tc1", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", - "type": "Microsoft.ServiceNetworking/trafficControllers", - "location": "NorthCentralUS", - "tags": { - "key1": "value1" - }, - "properties": { - "configurationEndpoints": [ - "abc.trafficcontroller.azure.net" - ], - "frontends": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" - } - ], - "associations": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" - } - ], - "securityPolicies": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" - } - ], - "securityPolicyConfigurations": { - "wafSecurityPolicy": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/waf-0" - } - }, - "provisioningState": "Succeeded" - } - } - }, - "201": { - "body": { - "name": "tc1", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", - "type": "Microsoft.ServiceNetworking/trafficControllers", - "location": "NorthCentralUS", - "tags": { - "key1": "value1" - }, - "properties": { - "configurationEndpoints": [ - "abc.trafficcontroller.azure.net" - ], - "frontends": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" - } - ], - "associations": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" - } - ], - "securityPolicies": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" - } - ], - "securityPolicyConfigurations": { - "wafSecurityPolicy": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/waf-0" - } - }, - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllersGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllersGet.json deleted file mode 100644 index a144861b65..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllersGet.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "operationId": "TrafficControllerInterface_ListByResourceGroup", - "title": "Get Traffic Controllers", - "parameters": { - "api-version": "2024-05-01-preview", - "subscriptionId": "subid", - "resourceGroupName": "rg1" - }, - "responses": { - "200": { - "body": { - "value": [ - { - "name": "tc1", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", - "type": "Microsoft.ServiceNetworking/trafficControllers", - "location": "NorthCentralUS", - "tags": { - "key1": "value1" - }, - "properties": { - "configurationEndpoints": [ - "abc.trafficcontroller.azure.net" - ], - "frontends": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" - } - ], - "associations": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" - } - ], - "securityPolicies": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" - } - ], - "securityPolicyConfigurations": { - "wafSecurityPolicy": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/waf-0" - } - }, - "provisioningState": "Succeeded" - } - } - ] - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllersGetList.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllersGetList.json deleted file mode 100644 index bb220e3f51..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2024-05-01-preview/TrafficControllersGetList.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "operationId": "TrafficControllerInterface_ListBySubscription", - "title": "Get Traffic Controllers List", - "parameters": { - "api-version": "2024-05-01-preview", - "subscriptionId": "subid" - }, - "responses": { - "200": { - "body": { - "value": [ - { - "name": "tc1", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", - "type": "Microsoft.ServiceNetworking/trafficControllers", - "location": "NorthCentralUS", - "tags": { - "key1": "value1" - }, - "properties": { - "configurationEndpoints": [ - "abc.trafficcontroller.azure.net" - ], - "frontends": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" - } - ], - "associations": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" - } - ], - "securityPolicies": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" - } - ], - "securityPolicyConfigurations": { - "wafSecurityPolicy": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/waf-0" - } - }, - "provisioningState": "Succeeded" - } - } - ] - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationDelete.json deleted file mode 100644 index 903ca0eb16..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationDelete.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "title": "Delete Association", - "operationId": "AssociationsInterface_Delete", - "parameters": { - "api-version": "2025-01-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "associationName": "as1" - }, - "responses": { - "202": { - "headers": { - "Retry-After": 3, - "location": "https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1" - } - }, - "204": {} - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationGet.json deleted file mode 100644 index 2e256d4104..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationGet.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "title": "Get Association", - "operationId": "AssociationsInterface_Get", - "parameters": { - "api-version": "2025-01-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "associationName": "as1" - }, - "responses": { - "200": { - "body": { - "name": "as1", - "type": "Microsoft.ServiceNetworking/trafficControllers/associations", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", - "location": "NorthCentralUS", - "properties": { - "associationType": "subnets", - "subnet": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" - }, - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationPatch.json deleted file mode 100644 index 1321971af3..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationPatch.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "title": "Update Association", - "operationId": "AssociationsInterface_Update", - "parameters": { - "api-version": "2025-01-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "associationName": "as1", - "properties": { - "properties": { - "associationType": "subnets", - "subnet": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" - } - } - } - }, - "responses": { - "200": { - "body": { - "name": "as1", - "type": "Microsoft.ServiceNetworking/trafficControllers/associations", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", - "location": "NorthCentralUS", - "properties": { - "associationType": "subnets", - "subnet": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" - } - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationPut.json deleted file mode 100644 index 9e343dbdd2..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationPut.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "title": "Put Association", - "operationId": "AssociationsInterface_CreateOrUpdate", - "parameters": { - "api-version": "2025-01-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "associationName": "as1", - "resource": { - "location": "NorthCentralUS", - "properties": { - "associationType": "subnets", - "subnet": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" - } - } - } - }, - "responses": { - "200": { - "body": { - "name": "associatedvnet-1", - "type": "Microsoft.ServiceNetworking/trafficControllers/associations", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", - "location": "NorthCentralUS", - "properties": { - "associationType": "subnets", - "subnet": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" - }, - "provisioningState": "Accepted" - } - } - }, - "201": { - "body": { - "name": "associatedvnet-1", - "type": "Microsoft.ServiceNetworking/trafficControllers/associations", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", - "location": "NorthCentralUS", - "properties": { - "associationType": "subnets", - "subnet": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" - } - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationsGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationsGet.json deleted file mode 100644 index e25d8de456..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/AssociationsGet.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "title": "Get Associations", - "operationId": "AssociationsInterface_ListByTrafficController", - "parameters": { - "api-version": "2025-01-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1" - }, - "responses": { - "200": { - "body": { - "value": [ - { - "name": "as1", - "type": "Microsoft.ServiceNetworking/trafficControllers/associations", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/associations/as1", - "location": "NorthCentralUS", - "properties": { - "associationType": "subnets", - "subnet": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet-tc/subnets/tc-subnet" - }, - "provisioningState": "Succeeded" - } - } - ] - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendDelete.json deleted file mode 100644 index 974efa94e9..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendDelete.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "title": "Delete Frontend", - "operationId": "FrontendsInterface_Delete", - "parameters": { - "api-version": "2025-01-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "frontendName": "fe1" - }, - "responses": { - "202": { - "headers": { - "Retry-After": 3, - "location": "https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" - } - }, - "204": {} - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendGet.json deleted file mode 100644 index fda822179e..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendGet.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "title": "Get Frontend", - "operationId": "FrontendsInterface_Get", - "parameters": { - "api-version": "2025-01-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "frontendName": "fe1" - }, - "responses": { - "200": { - "body": { - "name": "fe1", - "location": "NorthCentralUS", - "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", - "properties": { - "fqdn": "test.net", - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendPatch.json deleted file mode 100644 index fcb044dc7a..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendPatch.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "title": "Update Frontend", - "operationId": "FrontendsInterface_Update", - "parameters": { - "api-version": "2025-01-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "frontendName": "fe1", - "properties": {} - }, - "responses": { - "200": { - "body": { - "name": "fe1", - "location": "NorthCentralUS", - "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", - "properties": { - "fqdn": "test.net", - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendPut.json deleted file mode 100644 index f0295d22f8..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendPut.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "title": "Put Frontend", - "operationId": "FrontendsInterface_CreateOrUpdate", - "parameters": { - "api-version": "2025-01-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "frontendName": "fe1", - "resource": { - "location": "NorthCentralUS", - "properties": {} - } - }, - "responses": { - "200": { - "body": { - "name": "fe1", - "location": "NorthCentralUS", - "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", - "properties": { - "fqdn": "test.net", - "provisioningState": "Succeeded" - } - } - }, - "201": { - "body": { - "name": "fe1", - "location": "NorthCentralUS", - "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", - "properties": { - "fqdn": "test.net", - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendsGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendsGet.json deleted file mode 100644 index ddf66203e7..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/FrontendsGet.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "title": "Get Frontends", - "operationId": "FrontendsInterface_ListByTrafficController", - "parameters": { - "api-version": "2025-01-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1" - }, - "responses": { - "200": { - "body": { - "value": [ - { - "name": "fe1", - "location": "NorthCentralUS", - "type": "Microsoft.ServiceNetworking/trafficControllers/frontends", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1", - "properties": { - "fqdn": "test.net", - "provisioningState": "Succeeded" - } - } - ] - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/OperationsList.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/OperationsList.json deleted file mode 100644 index a67a7fd6f1..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/OperationsList.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "title": "Get Operations List", - "operationId": "Operations_List", - "parameters": { - "api-version": "2025-01-01" - }, - "responses": { - "200": { - "body": { - "value": [ - { - "name": "Microsoft.ServiceNetworking/trafficControllers/read", - "isDataAction": false, - "display": { - "provider": "Microsoft Service Networking", - "resource": "Traffic Controller", - "operation": "Get Traffic Controller configuration", - "description": "Traffic Controller is a L7 Load Balancing solution for a Multi Cluster setup" - }, - "origin": "user,system" - } - ] - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPoliciesGetList.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPoliciesGetList.json deleted file mode 100644 index a4b712e4f3..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPoliciesGetList.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "title": "Get SecurityPolicies", - "operationId": "SecurityPoliciesInterface_ListByTrafficController", - "parameters": { - "api-version": "2025-01-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1" - }, - "responses": { - "200": { - "body": { - "value": [ - { - "name": "waf-0", - "type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0", - "location": "eastus", - "properties": { - "policyType": "waf", - "wafPolicy": { - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" - }, - "provisioningState": "Succeeded" - } - } - ] - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyDelete.json deleted file mode 100644 index e97ee911b7..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyDelete.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "title": "Delete SecurityPolicy", - "operationId": "SecurityPoliciesInterface_Delete", - "parameters": { - "api-version": "2025-01-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "securityPolicyName": "sp1" - }, - "responses": { - "202": { - "headers": { - "Retry-After": 3, - "location": "https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" - } - }, - "204": {} - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyGet.json deleted file mode 100644 index 12ce5ca159..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyGet.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "title": "Get SecurityPolicy", - "operationId": "SecurityPoliciesInterface_Get", - "parameters": { - "api-version": "2025-01-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "securityPolicyName": "sp1" - }, - "responses": { - "200": { - "body": { - "name": "waf-0", - "type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0", - "location": "eastus", - "properties": { - "policyType": "waf", - "wafPolicy": { - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" - }, - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyPatch.json deleted file mode 100644 index 7101b7543b..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyPatch.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "title": "Update SecurityPolicy", - "operationId": "SecurityPoliciesInterface_Update", - "parameters": { - "api-version": "2025-01-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "securityPolicyName": "sp1", - "properties": { - "properties": { - "wafPolicy": { - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" - } - } - } - }, - "responses": { - "200": { - "body": { - "name": "waf-0", - "type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0", - "location": "eastus", - "properties": { - "policyType": "waf", - "wafPolicy": { - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" - }, - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyPut.json deleted file mode 100644 index 5364abfc44..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/SecurityPolicyPut.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "title": "Put SecurityPolicy", - "operationId": "SecurityPoliciesInterface_CreateOrUpdate", - "parameters": { - "api-version": "2025-01-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "securityPolicyName": "sp1", - "resource": { - "location": "NorthCentralUS", - "properties": { - "wafPolicy": { - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" - } - } - } - }, - "responses": { - "200": { - "body": { - "name": "waf-0", - "type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0", - "location": "eastus", - "properties": { - "policyType": "waf", - "wafPolicy": { - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" - }, - "provisioningState": "Succeeded" - } - } - }, - "201": { - "body": { - "name": "waf-0", - "type": "Microsoft.ServiceNetworking/trafficControllers/securityPolicies", - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/sample-tc/securityPolicies/waf-0", - "location": "eastus", - "properties": { - "policyType": "waf", - "wafPolicy": { - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.Networking/applicationGatewayWebApplicationFirewallPolicies/wp-0" - }, - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerDelete.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerDelete.json deleted file mode 100644 index 3be324a912..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerDelete.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "title": "Delete Traffic Controller", - "operationId": "TrafficControllerInterface_Delete", - "parameters": { - "api-version": "2025-01-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1" - }, - "responses": { - "202": { - "headers": { - "Retry-After": 3, - "location": "https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1" - } - }, - "204": {} - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerGet.json deleted file mode 100644 index 52b5b6859f..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerGet.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "operationId": "TrafficControllerInterface_Get", - "title": "Get Traffic Controller", - "parameters": { - "api-version": "2025-01-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1" - }, - "responses": { - "200": { - "body": { - "name": "tc1", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", - "type": "Microsoft.ServiceNetworking/trafficControllers", - "location": "NorthCentralUS", - "tags": { - "key1": "value1" - }, - "properties": { - "configurationEndpoints": [ - "abc.trafficcontroller.azure.net" - ], - "frontends": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" - } - ], - "associations": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" - } - ], - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerPatch.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerPatch.json deleted file mode 100644 index 2e4c2850c6..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerPatch.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "operationId": "TrafficControllerInterface_Update", - "title": "Patch Traffic Controller", - "parameters": { - "api-version": "2025-01-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "properties": { - "tags": { - "key1": "value1" - } - } - }, - "responses": { - "200": { - "body": { - "name": "tc1", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", - "type": "Microsoft.ServiceNetworking/trafficControllers", - "location": "NorthCentralUS", - "tags": { - "key1": "value1" - }, - "properties": { - "configurationEndpoints": [ - "abc.trafficcontroller.azure.net" - ], - "frontends": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" - } - ], - "associations": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" - } - ], - "securityPolicies": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" - } - ], - "securityPolicyConfigurations": { - "wafSecurityPolicy": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/waf-0" - } - }, - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerPut.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerPut.json deleted file mode 100644 index 83a824f6a8..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllerPut.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "operationId": "TrafficControllerInterface_CreateOrUpdate", - "title": "Put Traffic Controller", - "parameters": { - "api-version": "2025-01-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1", - "trafficControllerName": "tc1", - "resource": { - "location": "NorthCentralUS", - "tags": { - "key1": "value1" - } - } - }, - "responses": { - "200": { - "body": { - "name": "tc1", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", - "type": "Microsoft.ServiceNetworking/trafficControllers", - "location": "NorthCentralUS", - "tags": { - "key1": "value1" - }, - "properties": { - "configurationEndpoints": [ - "abc.trafficcontroller.azure.net" - ], - "frontends": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" - } - ], - "associations": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" - } - ], - "securityPolicies": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" - } - ], - "securityPolicyConfigurations": { - "wafSecurityPolicy": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/waf-0" - } - }, - "provisioningState": "Succeeded" - } - } - }, - "201": { - "body": { - "name": "tc1", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", - "type": "Microsoft.ServiceNetworking/trafficControllers", - "location": "NorthCentralUS", - "tags": { - "key1": "value1" - }, - "properties": { - "configurationEndpoints": [ - "abc.trafficcontroller.azure.net" - ], - "frontends": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" - } - ], - "associations": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" - } - ], - "securityPolicies": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" - } - ], - "securityPolicyConfigurations": { - "wafSecurityPolicy": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/waf-0" - } - }, - "provisioningState": "Succeeded" - } - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllersGet.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllersGet.json deleted file mode 100644 index f06dcbc2cb..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllersGet.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "operationId": "TrafficControllerInterface_ListByResourceGroup", - "title": "Get Traffic Controllers", - "parameters": { - "api-version": "2025-01-01", - "subscriptionId": "subid", - "resourceGroupName": "rg1" - }, - "responses": { - "200": { - "body": { - "value": [ - { - "name": "tc1", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", - "type": "Microsoft.ServiceNetworking/trafficControllers", - "location": "NorthCentralUS", - "tags": { - "key1": "value1" - }, - "properties": { - "configurationEndpoints": [ - "abc.trafficcontroller.azure.net" - ], - "frontends": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" - } - ], - "associations": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" - } - ], - "securityPolicies": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" - } - ], - "securityPolicyConfigurations": { - "wafSecurityPolicy": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/waf-0" - } - }, - "provisioningState": "Succeeded" - } - } - ] - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllersGetList.json b/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllersGetList.json deleted file mode 100644 index 568692609f..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/examples/2025-01-01/TrafficControllersGetList.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "operationId": "TrafficControllerInterface_ListBySubscription", - "title": "Get Traffic Controllers List", - "parameters": { - "api-version": "2025-01-01", - "subscriptionId": "subid" - }, - "responses": { - "200": { - "body": { - "value": [ - { - "name": "tc1", - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1", - "type": "Microsoft.ServiceNetworking/trafficControllers", - "location": "NorthCentralUS", - "tags": { - "key1": "value1" - }, - "properties": { - "configurationEndpoints": [ - "abc.trafficcontroller.azure.net" - ], - "frontends": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/frontends/fe1" - } - ], - "associations": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/association/as1" - } - ], - "securityPolicies": [ - { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/sp1" - } - ], - "securityPolicyConfigurations": { - "wafSecurityPolicy": { - "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ServiceNetworking/trafficControllers/tc1/securityPolicies/waf-0" - } - }, - "provisioningState": "Succeeded" - } - } - ] - } - } - } -} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/main.tsp b/packages/typespec-test/test/ServiceNetworking.Management/spec/main.tsp deleted file mode 100644 index 1d358a7928..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/main.tsp +++ /dev/null @@ -1,328 +0,0 @@ -import "@typespec/http"; -import "@typespec/rest"; -import "@typespec/versioning"; -import "@azure-tools/typespec-azure-core"; -import "@azure-tools/typespec-azure-resource-manager"; - -/** Traffic Controller Provider management API. */ -@armProviderNamespace -@armCommonTypesVersion("v3") -@service({ - title: "TrafficController", -}) -@versioned(Versions) -namespace Microsoft.ServiceNetworking; - -/** Api versions */ -enum Versions { - /** 2023-11-01 stable version */ - v2023_11_01: "2023-11-01", - - /** 2024-05-01 preview version */ - @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) - v2024_05_01_preview: "2024-05-01-preview", - - /** 2025-01-01 stable version */ - v2025_05_01: "2025-01-01", -} - -using TypeSpec.Http; -using TypeSpec.Rest; -using TypeSpec.Versioning; -using Azure.Core; -using Azure.ResourceManager; - -//----------------------- Frontends ----------------------- -/** Frontend Sub Resource of Traffic Controller. */ -@parentResource(TrafficController) -model Frontend is TrackedResource { - /** Frontends */ - @key("frontendName") - @visibility("read") - @path - @segment("frontends") - @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") - name: string; -} - -/** Frontend Properties. */ -model FrontendProperties { - /** The Fully Qualified Domain Name of the DNS record associated to a Traffic Controller frontend. */ - @visibility("read") - fqdn?: string; - - /** Provisioning State of Traffic Controller Frontend Resource */ - @visibility("read") - provisioningState?: ProvisioningState; -} - -//----------------------- Associations ----------------------- -/** Association Subresource of Traffic Controller */ -@parentResource(TrafficController) -model Association is TrackedResource { - /** Name of Association */ - @key("associationName") - @visibility("read") - @path - @segment("associations") - @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") - name: string; -} - -/** The type used for update operations of the Association. */ -model AssociationUpdate { - /** Resource tags. */ - tags?: TrackedResource.tags; - - /** The resource-specific properties for this resource. */ - #suppress "@azure-tools/typespec-azure-core/no-private-usage" - @Azure.ResourceManager.Private.conditionalClientFlatten - properties?: AssociationUpdateProperties; -} - -/** The updatable properties of the Association. */ -model AssociationUpdateProperties { - /** Association Type */ - associationType?: AssociationType; - - /** Association Subnet */ - subnet?: AssociationSubnetUpdate; -} - -/** Association Subnet. */ -model AssociationSubnetUpdate { - /** Association ID. */ - id: string; -} - -/** Association Properties. */ -model AssociationProperties { - /** Association Type */ - associationType: AssociationType; - - /** Association Subnet */ - subnet?: AssociationSubnet; - - /** Provisioning State of Traffic Controller Association Resource */ - @visibility("read") - provisioningState?: ProvisioningState; -} - -/** Association Type Enum */ -union AssociationType { - string, - - /** Association of Type Subnet */ - "subnets", -} - -/** Association Subnet. */ -model AssociationSubnet { - /** Association ID. */ - id: string; -} -//----------------------- SecurityPolicy ----------------------- -/** SecurityPolicy Subresource of Traffic Controller. */ -@parentResource(TrafficController) -model SecurityPolicy is TrackedResource { - /** SecurityPolicy */ - @key("securityPolicyName") - @visibility("read") - @path - @segment("securityPolicies") - @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") - name: string; -} - -/** SecurityPolicy Properties. */ -model SecurityPolicyProperties { - /** Type of the Traffic Controller Security Policy */ - @visibility("read") - policyType?: PolicyType; - - /** Web Application Firewall Policy of the Traffic Controller Security Policy */ - wafPolicy?: WafPolicy; - - /** Provisioning State of Traffic Controller SecurityPolicy Resource */ - @visibility("read") - provisioningState?: ProvisioningState; -} - -/** Policy Type of the Security Policy */ -union PolicyType { - string, - - /** Policy of Type WAF */ - WAF: "waf", -} - -/** Web Application Firewall Policy */ -model WafPolicy { - /** Resource ID of the WAF */ - id: string; -} - -/** SecurityPolicyConfigurations Subresource of Traffic Controller. */ -@parentResource(TrafficController) -model SecurityPolicyConfigurations { - /** Contains reference to a WAF-type security policy that is applied at the Traffic Controller level. */ - wafSecurityPolicy?: WafSecurityPolicy; -} - -/** Web Application Firewall Security Policy */ -model WafSecurityPolicy { - /** Resource ID of the Waf Security Policy */ - id: string; -} - -//----------------------- Traffic Controller ----------------------- -@resource("trafficControllers") -model TrafficController is TrackedResource { - /** traffic controller name for path */ - @key("trafficControllerName") - @path - @segment("trafficControllers") - @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") - name: string; -} - -/** Traffic Controller Properties. */ -model TrafficControllerProperties { - /** Configuration Endpoints. */ - @visibility("read") - configurationEndpoints?: string[]; - - /** Frontends References List */ - @visibility("read") - frontends?: ResourceId[]; - - /** Associations References List */ - @visibility("read") - associations?: ResourceId[]; - - /** Security Policies References List */ - @visibility("read") - @added(Versions.v2024_05_01_preview) - securityPolicies?: ResourceId[]; - - /** Security Policy Configuration */ - @added(Versions.v2024_05_01_preview) - @OpenAPI.extension("x-ms-identifiers", []) - securityPolicyConfigurations?: SecurityPolicyConfigurations; - - /** The status of the last operation. */ - @visibility("read") - provisioningState?: ProvisioningState; -} - -/** Resource Provisioning State Enum */ -@lroStatus -union ProvisioningState { - string, - - /** Resource in Provisioning State */ - Provisioning: "Provisioning", - - /** Resource in Updating State */ - Updating: "Updating", - - /** Resource in Deleting State */ - Deleting: "Deleting", - - /** Resource in Accepted State */ - Accepted: "Accepted", - - /** Resource in Succeeded State */ - Succeeded: "Succeeded", - - /** Resource in Failed State */ - Failed: "Failed", - - /** Resource in Canceled State */ - Canceled: "Canceled", -} - -/** Resource ID definition used by parent to reference child resources. */ -model ResourceId { - /** Resource ID of child resource. */ - id: string; -} - -//----------------------- Paths ----------------------- -@armResourceOperations -interface AssociationsInterface { - get is ArmResourceRead; - #suppress "@azure-tools/typespec-azure-core/invalid-final-state" "MUST CHANGE ON NEXT UPDATE" - @Azure.Core.useFinalStateVia("azure-async-operation") - createOrUpdate is ArmResourceCreateOrReplaceAsync< - Association, - LroHeaders = Azure.Core.Foundations.RetryAfterHeader - >; - update is ArmCustomPatchSync; - delete is ArmResourceDeleteWithoutOkAsync; - listByTrafficController is ArmResourceListByParent; -} - -@armResourceOperations -interface FrontendsInterface { - get is ArmResourceRead; - #suppress "@azure-tools/typespec-azure-core/invalid-final-state" "MUST CHANGE ON NEXT UPDATE" - @Azure.Core.useFinalStateVia("azure-async-operation") - createOrUpdate is ArmResourceCreateOrReplaceAsync< - Frontend, - LroHeaders = Azure.Core.Foundations.RetryAfterHeader - >; - update is ArmCustomPatchSync< - Frontend, - Azure.ResourceManager.Foundations.ResourceUpdateModel< - Frontend, - FrontendProperties - > - >; - delete is ArmResourceDeleteWithoutOkAsync; - listByTrafficController is ArmResourceListByParent; -} - -@added(Versions.v2024_05_01_preview) -@armResourceOperations -interface SecurityPoliciesInterface { - get is ArmResourceRead; - #suppress "@azure-tools/typespec-azure-core/invalid-final-state" "MUST CHANGE ON NEXT UPDATE" - @Azure.Core.useFinalStateVia("azure-async-operation") - createOrUpdate is ArmResourceCreateOrReplaceAsync< - SecurityPolicy, - LroHeaders = Azure.Core.Foundations.RetryAfterHeader - >; - update is ArmCustomPatchSync< - SecurityPolicy, - Azure.ResourceManager.Foundations.ResourceUpdateModel< - SecurityPolicy, - SecurityPolicyProperties - > - >; - delete is ArmResourceDeleteWithoutOkAsync; - listByTrafficController is ArmResourceListByParent; -} - -@armResourceOperations -interface TrafficControllerInterface { - get is ArmResourceRead; - #suppress "@azure-tools/typespec-azure-core/invalid-final-state" "MUST CHANGE ON NEXT UPDATE" - @Azure.Core.useFinalStateVia("azure-async-operation") - createOrUpdate is ArmResourceCreateOrReplaceAsync< - TrafficController, - LroHeaders = Azure.Core.Foundations.RetryAfterHeader - >; - update is ArmCustomPatchSync< - TrafficController, - Azure.ResourceManager.Foundations.ResourceUpdateModel< - TrafficController, - TrafficControllerProperties - > - >; - delete is ArmResourceDeleteWithoutOkAsync; - listByResourceGroup is ArmResourceListByParent; - listBySubscription is ArmListBySubscription; -} - -interface Operations extends Azure.ResourceManager.Operations {} diff --git a/packages/typespec-test/test/ServiceNetworking.Management/spec/sdk-suppressions.yaml b/packages/typespec-test/test/ServiceNetworking.Management/spec/sdk-suppressions.yaml deleted file mode 100644 index 2bfe216067..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/spec/sdk-suppressions.yaml +++ /dev/null @@ -1,32 +0,0 @@ -suppressions: - azure-sdk-for-js: - - package: "@azure/arm-servicenetworking" - breaking-changes: - - Enum KnownAssociationType no longer has value Subnets - - Enum KnownOrigin no longer has value System - - Enum KnownOrigin no longer has value User - - Enum KnownOrigin no longer has value UserSystem - - Interface AssociationsInterfaceCreateOrUpdateOptionalParams no longer has parameter resumeFrom - - Interface AssociationsInterfaceDeleteOptionalParams no longer has parameter resumeFrom - - Interface FrontendsInterfaceCreateOrUpdateOptionalParams no longer has parameter resumeFrom - - Interface FrontendsInterfaceDeleteOptionalParams no longer has parameter resumeFrom - - Interface TrafficControllerInterfaceCreateOrUpdateOptionalParams no longer has parameter resumeFrom - - Interface TrafficControllerInterfaceDeleteOptionalParams no longer has parameter resumeFrom - - Removed function getContinuationToken - - Removed operation AssociationsInterface.beginCreateOrUpdate - - Removed operation AssociationsInterface.beginCreateOrUpdateAndWait - - Removed operation AssociationsInterface.beginDelete - - Removed operation AssociationsInterface.beginDeleteAndWait - - Removed operation FrontendsInterface.beginCreateOrUpdate - - Removed operation FrontendsInterface.beginCreateOrUpdateAndWait - - Removed operation FrontendsInterface.beginDelete - - Removed operation FrontendsInterface.beginDeleteAndWait - - Removed operation TrafficControllerInterface.beginCreateOrUpdate - - Removed operation TrafficControllerInterface.beginCreateOrUpdateAndWait - - Removed operation TrafficControllerInterface.beginDelete - - Removed operation TrafficControllerInterface.beginDeleteAndWait - - Type of parameter subnet of interface AssociationUpdateProperties is changed from AssociationSubnetUpdate to AssociationSubnet - - "Type of parameter tags of interface AssociationUpdate is changed from {\n [propertyName: string]: string;\n } to Record" - - "Type of parameter tags of interface FrontendUpdate is changed from {\n [propertyName: string]: string;\n } to Record" - - "Type of parameter tags of interface TrackedResource is changed from {\n [propertyName: string]: string;\n } to Record" - - "Type of parameter tags of interface TrafficControllerUpdate is changed from {\n [propertyName: string]: string;\n } to Record" diff --git a/packages/typespec-test/test/ServiceNetworking.Management/tspconfig.yaml b/packages/typespec-test/test/ServiceNetworking.Management/tspconfig.yaml deleted file mode 100644 index 05e7747c8e..0000000000 --- a/packages/typespec-test/test/ServiceNetworking.Management/tspconfig.yaml +++ /dev/null @@ -1,14 +0,0 @@ -emit: ["@azure-tools/typespec-ts"] -options: - "@azure-tools/typespec-ts": - examples-directory: "{project-root}/spec/examples" - generateMetadata: true - generateTest: true - generateSample: true - azureSdkForJs: false - hierarchyClient: false - experimentalExtensibleEnums: true - enableOperationGroup: true - "emitter-output-dir": "{project-root}/generated/typespec-ts/sdk/servicenetworking/arm-servicenetworking" - packageDetails: - name: "@azure/arm-servicenetworking" From e0571cb47ff099047383609a0a2ad1fda6d64198 Mon Sep 17 00:00:00 2001 From: Qiaoqiao Zhang Date: Fri, 14 Feb 2025 13:59:54 +0800 Subject: [PATCH 8/9] fix loadtesting modular generation failure --- packages/typespec-ts/src/utils/operationUtil.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/typespec-ts/src/utils/operationUtil.ts b/packages/typespec-ts/src/utils/operationUtil.ts index f530aba2dc..e94921ad9e 100644 --- a/packages/typespec-ts/src/utils/operationUtil.ts +++ b/packages/typespec-ts/src/utils/operationUtil.ts @@ -290,9 +290,9 @@ export function extractOperationLroDetail( const metadata = getLroMetadata(dpgContext.program, operation.operation); precedence = metadata?.finalStep && - metadata.finalStep.kind === "pollingSuccessProperty" && - metadata?.finalStep.target && - metadata?.finalStep?.target?.name === "result" + metadata.finalStep.kind === "pollingSuccessProperty" && + metadata?.finalStep.target && + metadata?.finalStep?.target?.name === "result" ? OPERATION_LRO_HIGH_PRIORITY : OPERATION_LRO_LOW_PRIORITY; } @@ -578,7 +578,8 @@ export function getMethodHierarchiesMap( } const prefixes = context.rlcOptions?.hierarchyClient === false && - context.rlcOptions?.enableOperationGroup + context.rlcOptions?.enableOperationGroup && + method[0].length > 0 ? [method[0][method[0].length - 1] as string] : method[0]; const operationOrGroup = method[1]; @@ -590,7 +591,7 @@ export function getMethodHierarchiesMap( } else { const prefixKey = context.rlcOptions?.hierarchyClient || - context.rlcOptions?.enableOperationGroup + context.rlcOptions?.enableOperationGroup ? prefixes.join("/") : ""; const groupName = prefixes From 56155e8f355ca67260a29509bd48253a0cbbe29d Mon Sep 17 00:00:00 2001 From: kazrael2119 <98569699+kazrael2119@users.noreply.github.com> Date: Tue, 18 Feb 2025 17:23:43 +0800 Subject: [PATCH 9/9] update ut --- .../samples/operations/armCurdOperations.md | 37 ++++++++++++------- .../samples/operations/dpgCurdOperations.md | 19 +++++++--- 2 files changed, 37 insertions(+), 19 deletions(-) diff --git a/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/armCurdOperations.md b/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/armCurdOperations.md index 336b5ad30a..f664e5da23 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/armCurdOperations.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/armCurdOperations.md @@ -88,6 +88,13 @@ interface Employees { } ``` +This is the tspconfig.yaml. + +```yaml +hierarchyClient: false +enableOperationGroup: true +``` + ## Example Raw json files. @@ -110,7 +117,7 @@ Raw json files. Generate samples for arm cases: ```ts samples -/** This file path is /samples-dev/listSample.ts */ +/** This file path is /samples-dev/operationsListSample.ts */ import { ContosoClient } from "@azure/internal-test"; import { DefaultAzureCredential } from "@azure/identity"; @@ -125,7 +132,7 @@ async function operationsList(): Promise { const subscriptionId = "00000000-0000-0000-0000-00000000000"; const client = new ContosoClient(credential, subscriptionId); const resArray = new Array(); - for await (let item of client.list()) { + for await (let item of client.operations.list()) { resArray.push(item); } @@ -171,7 +178,7 @@ Raw json files. Generate samples for arm cases: ```ts samples -/** This file path is /samples-dev/createOrUpdateSample.ts */ +/** This file path is /samples-dev/employeesCreateOrUpdateSample.ts */ import { ContosoClient } from "@azure/internal-test"; import { DefaultAzureCredential } from "@azure/identity"; @@ -185,15 +192,19 @@ async function employeesCreateOrUpdate(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "11809CA1-E126-4017-945E-AA795CD5C5A9"; const client = new ContosoClient(credential, subscriptionId); - const result = await client.createOrUpdate("rgopenapi", "9KF-f-8b", { - properties: { - age: 30, - city: "gydhnntudughbmxlkyzrskcdkotrxn", - profile: "ms", + const result = await client.employees.createOrUpdate( + "rgopenapi", + "9KF-f-8b", + { + properties: { + age: 30, + city: "gydhnntudughbmxlkyzrskcdkotrxn", + profile: "ms", + }, + tags: { key2913: "urperxmkkhhkp" }, + location: "itajgxyqozseoygnl", }, - tags: { key2913: "urperxmkkhhkp" }, - location: "itajgxyqozseoygnl", - }); + ); console.log(result); } @@ -225,7 +236,7 @@ Raw json files. Generate samples for arm cases: ```ts samples -/** This file path is /samples-dev/deleteSample.ts */ +/** This file path is /samples-dev/employeesDeleteSample.ts */ import { ContosoClient } from "@azure/internal-test"; import { DefaultAzureCredential } from "@azure/identity"; @@ -239,7 +250,7 @@ async function employeesDelete(): Promise { const credential = new DefaultAzureCredential(); const subscriptionId = "11809CA1-E126-4017-945E-AA795CD5C5A9"; const client = new ContosoClient(credential, subscriptionId); - await client.delete("rgopenapi", "5vX--BxSu3ux48rI4O9OQ569"); + await client.employees.delete("rgopenapi", "5vX--BxSu3ux48rI4O9OQ569"); } async function main(): Promise { diff --git a/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/dpgCurdOperations.md b/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/dpgCurdOperations.md index bad65a6c09..cbd04f6ec0 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/dpgCurdOperations.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/samples/operations/dpgCurdOperations.md @@ -121,12 +121,19 @@ Raw json files. } ``` +This is the tspconfig.yaml. + +```yaml +hierarchyClient: true +enableOperationGroup: false +``` + ## Samples Generate samples for dpg cases: ```ts samples -/** This file path is /samples-dev/listWidgetsSample.ts */ +/** This file path is /samples-dev/widgetsListWidgetsSample.ts */ import { WidgetManagerClient } from "@azure/internal-test"; import { DefaultAzureCredential } from "@azure/identity"; @@ -140,7 +147,7 @@ async function widgetsListWidgets(): Promise { const credential = new DefaultAzureCredential(); const client = new WidgetManagerClient(credential); const resArray = new Array(); - for await (let item of client.listWidgets({ + for await (let item of client.widgets.listWidgets({ top: 8, skip: 15, maxpagesize: 27, @@ -157,7 +164,7 @@ async function main(): Promise { main().catch(console.error); -/** This file path is /samples-dev/deleteWidgetSample.ts */ +/** This file path is /samples-dev/widgetsDeleteWidgetSample.ts */ import { WidgetManagerClient } from "@azure/internal-test"; import { DefaultAzureCredential } from "@azure/identity"; @@ -170,7 +177,7 @@ import { DefaultAzureCredential } from "@azure/identity"; async function deleteWidgetByWidgetNameUsingLongRunningOperation(): Promise { const credential = new DefaultAzureCredential(); const client = new WidgetManagerClient(credential); - const result = await client.deleteWidget("searchbox"); + const result = await client.widgets.deleteWidget("searchbox"); console.log(result); } @@ -180,7 +187,7 @@ async function main(): Promise { main().catch(console.error); -/** This file path is /samples-dev/createOrUpdateWidgetSample.ts */ +/** This file path is /samples-dev/widgetsCreateOrUpdateWidgetSample.ts */ import { WidgetManagerClient } from "@azure/internal-test"; import { DefaultAzureCredential } from "@azure/identity"; @@ -193,7 +200,7 @@ import { DefaultAzureCredential } from "@azure/identity"; async function widgetsCreateOrUpdateWidget(): Promise { const credential = new DefaultAzureCredential(); const client = new WidgetManagerClient(credential); - const result = await client.createOrUpdateWidget("name1", { + const result = await client.widgets.createOrUpdateWidget("name1", { manufacturerId: "manufacturer id1", }); console.log(result);