From bc742d50bbf697bc96aae4872d55600ddcc9c392 Mon Sep 17 00:00:00 2001 From: colawwj <70128817+colawwj@users.noreply.github.com> Date: Fri, 21 Jan 2022 11:20:59 +0800 Subject: [PATCH] reservations-resourcegraph-resourcemover-serialconsole-servicemap-signalr-storagecache-storagesync-track2 (#19962) * reservations-release * resourcemover * serialconsole-release * servicemap * signalr-relesae * storagecache * reservations-resourcegraph-resourcemover-serialconsole-servicemap-signalr-storagecache-storagesync-track2 * resourcegraph * update --- common/config/rush/pnpm-lock.yaml | 216 + eng/ignore-links.txt | 1 + rush.json | 44 +- .../arm-reservations/CHANGELOG.md | 11 + sdk/reservations/arm-reservations/LICENSE | 21 + sdk/reservations/arm-reservations/README.md | 137 +- sdk/reservations/arm-reservations/_meta.json | 7 + .../arm-reservations/api-extractor.json | 18 + .../arm-reservations/package.json | 107 +- .../node/my_test/recording_sample_test.js | 5 + .../review/arm-reservations.api.md | 1605 ++++++ .../arm-reservations/rollup.config.js | 211 +- sdk/reservations/arm-reservations/sample.env | 4 + .../samples-dev/appliedReservationList.ts | 28 + .../samples-dev/availableScopes.ts | 43 + .../samples-dev/calculateExchange.ts | 59 + .../arm-reservations/samples-dev/catalog.ts | 34 + .../samples-dev/changeDirectory.ts | 37 + .../arm-reservations/samples-dev/exchange.ts | 32 + .../samples-dev/getOperations.ts | 30 + .../samples-dev/getReservation.ts | 28 + .../getReservationWithExpandPayments.ts | 30 + .../arm-reservations/samples-dev/merge.ts | 37 + .../samples-dev/patchReservation.ts | 37 + .../arm-reservations/samples-dev/purchase.ts | 45 + .../samples-dev/quotaRequestFailed.ts | 36 + .../samples-dev/quotaRequestHistory.ts | 37 + .../samples-dev/quotaRequestInProgress.ts | 36 + .../samples-dev/quotaRequestStatus.ts | 36 + .../samples-dev/quotasListUsagesForCompute.ts | 37 + ...quotasListUsagesMachineLearningServices.ts | 37 + .../samples-dev/quotasRequestForCompute.ts | 36 + .../quotasRequestPatchForCompute.ts | 61 + .../samples-dev/quotasRequestPutForCompute.ts | 63 + ...achineLearningServicesDedicatedResource.ts | 66 + ...hineLearningServicesLowPriorityResource.ts | 66 + .../samples-dev/reservationList.ts | 31 + .../samples-dev/reservationOrderList.ts | 30 + .../samples-dev/reservationRevisions.ts | 35 + .../arm-reservations/samples-dev/split.ts | 36 + .../samples/v7/javascript/README.md | 102 + .../v7/javascript/appliedReservationList.js | 28 + .../samples/v7/javascript/availableScopes.js | 40 + .../v7/javascript/calculateExchange.js | 56 + .../samples/v7/javascript/catalog.js | 34 + .../samples/v7/javascript/changeDirectory.js | 31 + .../samples/v7/javascript/exchange.js | 32 + .../samples/v7/javascript/getOperations.js | 30 + .../samples/v7/javascript/getReservation.js | 28 + .../getReservationWithExpandPayments.js | 30 + .../samples/v7/javascript/merge.js | 34 + .../samples/v7/javascript/package.json | 32 + .../samples/v7/javascript/patchReservation.js | 37 + .../samples/v7/javascript/purchase.js | 42 + .../v7/javascript/quotaRequestFailed.js | 31 + .../v7/javascript/quotaRequestHistory.js | 33 + .../v7/javascript/quotaRequestInProgress.js | 31 + .../v7/javascript/quotaRequestStatus.js | 31 + .../javascript/quotasListUsagesForCompute.js | 33 + ...quotasListUsagesMachineLearningServices.js | 33 + .../v7/javascript/quotasRequestForCompute.js | 31 + .../quotasRequestPatchForCompute.js | 58 + .../javascript/quotasRequestPutForCompute.js | 60 + ...achineLearningServicesDedicatedResource.js | 61 + ...hineLearningServicesLowPriorityResource.js | 61 + .../samples/v7/javascript/reservationList.js | 31 + .../v7/javascript/reservationOrderList.js | 30 + .../v7/javascript/reservationRevisions.js | 32 + .../samples/v7/javascript/sample.env | 4 + .../samples/v7/javascript/split.js | 33 + .../samples/v7/typescript/README.md | 115 + .../samples/v7/typescript/package.json | 41 + .../samples/v7/typescript/sample.env | 4 + .../typescript/src/appliedReservationList.ts | 28 + .../v7/typescript/src/availableScopes.ts | 43 + .../v7/typescript/src/calculateExchange.ts | 59 + .../samples/v7/typescript/src/catalog.ts | 34 + .../v7/typescript/src/changeDirectory.ts | 37 + .../samples/v7/typescript/src/exchange.ts | 32 + .../v7/typescript/src/getOperations.ts | 30 + .../v7/typescript/src/getReservation.ts | 28 + .../src/getReservationWithExpandPayments.ts | 30 + .../samples/v7/typescript/src/merge.ts | 37 + .../v7/typescript/src/patchReservation.ts | 37 + .../samples/v7/typescript/src/purchase.ts | 45 + .../v7/typescript/src/quotaRequestFailed.ts | 36 + .../v7/typescript/src/quotaRequestHistory.ts | 37 + .../typescript/src/quotaRequestInProgress.ts | 36 + .../v7/typescript/src/quotaRequestStatus.ts | 36 + .../src/quotasListUsagesForCompute.ts | 37 + ...quotasListUsagesMachineLearningServices.ts | 37 + .../typescript/src/quotasRequestForCompute.ts | 36 + .../src/quotasRequestPatchForCompute.ts | 61 + .../src/quotasRequestPutForCompute.ts | 63 + ...achineLearningServicesDedicatedResource.ts | 66 + ...hineLearningServicesLowPriorityResource.ts | 66 + .../v7/typescript/src/reservationList.ts | 31 + .../v7/typescript/src/reservationOrderList.ts | 30 + .../v7/typescript/src/reservationRevisions.ts | 35 + .../samples/v7/typescript/src/split.ts | 36 + .../samples/v7/typescript/tsconfig.json | 17 + .../src/azureReservationAPI.ts | 252 +- .../src/azureReservationAPIContext.ts | 53 - .../arm-reservations/src/index.ts} | 12 +- .../arm-reservations/src/lroImpl.ts | 34 + .../src/models/calculateExchangeMappers.ts | 28 - .../src/models/exchangeMappers.ts | 27 - .../arm-reservations/src/models/index.ts | 4161 +++++++-------- .../arm-reservations/src/models/mappers.ts | 4085 ++++++++------- .../arm-reservations/src/models/parameters.ts | 368 +- .../src/models/quotaMappers.ts | 42 - .../src/models/quotaRequestStatusMappers.ts | 39 - .../src/models/reservationMappers.ts | 47 - .../src/models/reservationOrderMappers.ts | 42 - .../src/operations/calculateExchange.ts | 156 +- .../src/operations/exchange.ts | 153 +- .../arm-reservations/src/operations/index.ts | 3 +- .../src/operations/operation.ts | 180 +- .../arm-reservations/src/operations/quota.ts | 793 +-- .../src/operations/quotaRequestStatus.ts | 342 +- .../src/operations/reservation.ts | 1341 +++-- .../src/operations/reservationOrder.ts | 463 +- .../operationsInterfaces/calculateExchange.ts | 43 + .../src/operationsInterfaces/exchange.ts | 40 + .../src/operationsInterfaces/index.ts | 15 + .../src/operationsInterfaces/operation.ts | 22 + .../src/operationsInterfaces/quota.ts | 169 + .../quotaRequestStatus.ts | 51 + .../src/operationsInterfaces/reservation.ts | 194 + .../operationsInterfaces/reservationOrder.ts | 93 + .../arm-reservations/test/sampleTest.ts | 48 + .../arm-reservations/tsconfig.json | 9 +- sdk/reservations/ci.yml | 30 + .../arm-resourcegraph/CHANGELOG.md | 11 + sdk/resourcegraph/arm-resourcegraph/LICENSE | 21 + sdk/resourcegraph/arm-resourcegraph/README.md | 134 +- .../arm-resourcegraph/_meta.json | 7 + .../arm-resourcegraph/api-extractor.json | 18 + .../arm-resourcegraph/package.json | 105 +- .../node/my_test/recording_sample_test.js | 5 + .../review/arm-resourcegraph.api.md | 214 + .../arm-resourcegraph/rollup.config.js | 211 +- .../arm-resourcegraph/sample.env | 4 + .../samples-dev/accessAPropertiesField.ts | 32 + .../samples-dev/basicManagementGroupQuery.ts | 31 + .../samples-dev/basicQuery.ts | 31 + .../samples-dev/basicTenantQuery.ts | 30 + .../samples-dev/complexQuery.ts | 32 + .../samples-dev/filterResources.ts | 32 + .../samples-dev/firstPageQuery.ts | 33 + .../samples-dev/nextPageQuery.ts | 35 + .../samples-dev/operationsList.ts | 30 + .../samples-dev/queryWithAFacetRequest.ts | 51 + .../samples-dev/randomPageQuery.ts | 33 + ...esourceHistoryManagementGroupScopeQuery.ts | 40 + .../samples-dev/resourceHistoryQuery.ts | 40 + .../summarizeResourcesByLocation.ts | 32 + .../samples/v5-beta/javascript/README.md | 76 + .../javascript/accessAPropertiesField.js | 32 + .../javascript/basicManagementGroupQuery.js | 31 + .../samples/v5-beta/javascript/basicQuery.js | 31 + .../v5-beta/javascript/basicTenantQuery.js | 30 + .../v5-beta/javascript/complexQuery.js | 32 + .../v5-beta/javascript/filterResources.js | 32 + .../v5-beta/javascript/firstPageQuery.js | 32 + .../v5-beta/javascript/nextPageQuery.js | 34 + .../v5-beta/javascript/operationsList.js | 30 + .../samples/v5-beta/javascript/package.json | 32 + .../javascript/queryWithAFacetRequest.js | 51 + .../v5-beta/javascript/randomPageQuery.js | 32 + ...esourceHistoryManagementGroupScopeQuery.js | 37 + .../javascript/resourceHistoryQuery.js | 37 + .../samples/v5-beta/javascript/sample.env | 4 + .../summarizeResourcesByLocation.js | 31 + .../samples/v5-beta/typescript/README.md | 89 + .../samples/v5-beta/typescript/package.json | 41 + .../samples/v5-beta/typescript/sample.env | 4 + .../typescript/src/accessAPropertiesField.ts | 32 + .../src/basicManagementGroupQuery.ts | 31 + .../v5-beta/typescript/src/basicQuery.ts | 31 + .../typescript/src/basicTenantQuery.ts | 30 + .../v5-beta/typescript/src/complexQuery.ts | 32 + .../v5-beta/typescript/src/filterResources.ts | 32 + .../v5-beta/typescript/src/firstPageQuery.ts | 33 + .../v5-beta/typescript/src/nextPageQuery.ts | 35 + .../v5-beta/typescript/src/operationsList.ts | 30 + .../typescript/src/queryWithAFacetRequest.ts | 51 + .../v5-beta/typescript/src/randomPageQuery.ts | 33 + ...esourceHistoryManagementGroupScopeQuery.ts | 40 + .../typescript/src/resourceHistoryQuery.ts | 40 + .../src/summarizeResourcesByLocation.ts | 32 + .../samples/v5-beta/typescript/tsconfig.json | 17 + .../arm-resourcegraph/src/index.ts} | 11 +- .../arm-resourcegraph/src/models/index.ts | 842 +-- .../arm-resourcegraph/src/models/mappers.ts | 1219 ++--- .../src/models/parameters.ts | 84 +- .../arm-resourcegraph/src/operations/index.ts | 3 +- .../src/operations/operations.ts | 108 +- .../src/operationsInterfaces/index.ts} | 6 +- .../src/operationsInterfaces/operations.ts | 22 + .../src/resourceGraphClient.ts | 351 +- .../src/resourceGraphClientContext.ts | 59 - .../arm-resourcegraph/test/sampleTest.ts | 48 + .../arm-resourcegraph/tsconfig.json | 9 +- sdk/resourcegraph/ci.yml | 30 + .../arm-resourcemover/CHANGELOG.md | 11 + sdk/resourcemover/arm-resourcemover/LICENSE | 21 + sdk/resourcemover/arm-resourcemover/README.md | 138 +- .../arm-resourcemover/_meta.json | 7 + .../arm-resourcemover/api-extractor.json | 18 + .../arm-resourcemover/package.json | 107 +- .../node/my_test/recording_sample_test.js | 5 + .../review/arm-resourcemover.api.md | 946 ++++ .../arm-resourcemover/rollup.config.js | 211 +- .../arm-resourcemover/sample.env | 4 + .../samples-dev/moveCollectionsBulkRemove.ts | 44 + .../samples-dev/moveCollectionsCommit.ts | 44 + .../samples-dev/moveCollectionsCreate.ts | 43 + .../samples-dev/moveCollectionsDelete.ts | 33 + .../samples-dev/moveCollectionsDiscard.ts | 44 + .../samples-dev/moveCollectionsGet.ts | 33 + .../moveCollectionsInitiateMove.ts | 44 + ...tionsListMoveCollectionsByResourceGroup.ts | 34 + ...ctionsListMoveCollectionsBySubscription.ts | 31 + .../samples-dev/moveCollectionsPrepare.ts | 44 + .../moveCollectionsResolveDependencies.ts | 33 + .../samples-dev/moveCollectionsUpdate.ts | 42 + .../samples-dev/moveResourcesCreate.ts | 65 + .../samples-dev/moveResourcesDelete.ts | 35 + .../samples-dev/moveResourcesGet.ts | 35 + .../samples-dev/moveResourcesList.ts | 36 + .../samples-dev/operationsDiscoveryGet.ts | 28 + .../samples-dev/requiredForGet.ts | 36 + .../samples-dev/unresolvedDependenciesGet.ts | 36 + .../samples/v2/javascript/README.md | 86 + .../javascript/moveCollectionsBulkRemove.js | 41 + .../v2/javascript/moveCollectionsCommit.js | 41 + .../v2/javascript/moveCollectionsCreate.js | 40 + .../v2/javascript/moveCollectionsDelete.js | 33 + .../v2/javascript/moveCollectionsDiscard.js | 41 + .../v2/javascript/moveCollectionsGet.js | 30 + .../javascript/moveCollectionsInitiateMove.js | 41 + ...tionsListMoveCollectionsByResourceGroup.js | 34 + ...ctionsListMoveCollectionsBySubscription.js | 31 + .../v2/javascript/moveCollectionsPrepare.js | 41 + .../moveCollectionsResolveDependencies.js | 33 + .../v2/javascript/moveCollectionsUpdate.js | 39 + .../v2/javascript/moveResourcesCreate.js | 61 + .../v2/javascript/moveResourcesDelete.js | 35 + .../samples/v2/javascript/moveResourcesGet.js | 35 + .../v2/javascript/moveResourcesList.js | 33 + .../v2/javascript/operationsDiscoveryGet.js | 28 + .../samples/v2/javascript/package.json | 32 + .../samples/v2/javascript/requiredForGet.js | 36 + .../samples/v2/javascript/sample.env | 4 + .../javascript/unresolvedDependenciesGet.js | 36 + .../samples/v2/typescript/README.md | 99 + .../samples/v2/typescript/package.json | 41 + .../samples/v2/typescript/sample.env | 4 + .../src/moveCollectionsBulkRemove.ts | 44 + .../typescript/src/moveCollectionsCommit.ts | 44 + .../typescript/src/moveCollectionsCreate.ts | 43 + .../typescript/src/moveCollectionsDelete.ts | 33 + .../typescript/src/moveCollectionsDiscard.ts | 44 + .../v2/typescript/src/moveCollectionsGet.ts | 33 + .../src/moveCollectionsInitiateMove.ts | 44 + ...tionsListMoveCollectionsByResourceGroup.ts | 34 + ...ctionsListMoveCollectionsBySubscription.ts | 31 + .../typescript/src/moveCollectionsPrepare.ts | 44 + .../src/moveCollectionsResolveDependencies.ts | 33 + .../typescript/src/moveCollectionsUpdate.ts | 42 + .../v2/typescript/src/moveResourcesCreate.ts | 65 + .../v2/typescript/src/moveResourcesDelete.ts | 35 + .../v2/typescript/src/moveResourcesGet.ts | 35 + .../v2/typescript/src/moveResourcesList.ts | 36 + .../typescript/src/operationsDiscoveryGet.ts | 28 + .../v2/typescript/src/requiredForGet.ts | 36 + .../src/unresolvedDependenciesGet.ts | 36 + .../samples/v2/typescript/tsconfig.json | 17 + .../arm-resourcemover/src/index.ts | 12 + .../arm-resourcemover/src/lroImpl.ts | 34 + .../arm-resourcemover/src/models/index.ts | 2943 ++++------- .../arm-resourcemover/src/models/mappers.ts | 2566 ++++----- .../src/models/moveCollectionsMappers.ts | 68 - .../src/models/moveResourcesMappers.ts | 63 - .../src/models/parameters.ts | 224 +- .../arm-resourcemover/src/operations/index.ts | 3 +- .../src/operations/moveCollections.ts | 1885 ++++--- .../src/operations/moveResources.ts | 612 ++- .../operationsDiscoveryOperations.ts | 71 +- .../src/operations/unresolvedDependencies.ts | 241 +- .../src/operationsInterfaces/index.ts} | 13 +- .../operationsInterfaces/moveCollections.ts | 321 ++ .../src/operationsInterfaces/moveResources.ts | 111 + .../operationsDiscoveryOperations.ts | 20 + .../unresolvedDependencies.ts | 29 + .../src/resourceMoverServiceAPI.ts | 110 +- .../src/resourceMoverServiceAPIContext.ts | 61 - .../arm-resourcemover/test/sampleTest.ts | 48 + .../arm-resourcemover/tsconfig.json | 9 +- sdk/resourcemover/ci.yml | 30 + .../arm-serialconsole/CHANGELOG.md | 11 + sdk/serialconsole/arm-serialconsole/LICENSE | 21 + sdk/serialconsole/arm-serialconsole/README.md | 133 +- .../arm-serialconsole/_meta.json | 7 + .../arm-serialconsole/api-extractor.json | 18 + .../arm-serialconsole/package.json | 103 +- .../node/my_test/recording_sample_test.js | 5 + .../review/arm-serialconsole.api.md | 202 + .../arm-serialconsole/rollup.config.js | 215 +- .../arm-serialconsole/src/index.ts} | 10 +- .../src/microsoftSerialConsoleClient.ts | 236 +- .../microsoftSerialConsoleClientContext.ts | 62 - .../src/models/consoleMappers.ts | 12 - .../arm-serialconsole/src/models/index.ts | 303 +- .../src/models/listConsoleMappers.ts | 12 - .../src/models/listMappers.ts | 12 - .../arm-serialconsole/src/models/mappers.ts | 358 +- .../src/models/parameters.ts | 143 +- .../src/operations/console.ts | 126 - .../arm-serialconsole/src/operations/index.ts | 12 +- .../arm-serialconsole/src/operations/list.ts | 77 - .../src/operations/listConsole.ts | 78 - .../src/operations/serialPorts.ts | 357 ++ .../src/operationsInterfaces/index.ts} | 7 +- .../src/operationsInterfaces/serialPorts.ts | 128 + .../arm-serialconsole/test/sampleTest.ts | 48 + .../arm-serialconsole/tsconfig.json | 8 +- sdk/serialconsole/ci.yml | 30 + sdk/service-map/arm-servicemap/CHANGELOG.md | 11 + sdk/service-map/arm-servicemap/LICENSE | 21 + sdk/service-map/arm-servicemap/README.md | 146 +- sdk/service-map/arm-servicemap/_meta.json | 7 + .../arm-servicemap/api-extractor.json | 18 + sdk/service-map/arm-servicemap/package.json | 105 +- .../node/my_test/recording_sample_test.js | 5 + .../review/arm-servicemap.api.md | 1034 ++++ .../arm-servicemap/rollup.config.js | 215 +- sdk/service-map/arm-servicemap/sample.env | 4 + .../samples-dev/smClientGroupsGet.ts | 40 + .../smClientGroupsGetMembersCountGet.ts | 40 + .../smClientGroupsListMembersGet.ts | 43 + .../samples-dev/smMachineGroupsCreatePost.ts | 47 + .../samples-dev/smMachineGroupsDelete.ts | 35 + .../samples-dev/smMachineGroupsGet.ts | 35 + .../smMachineGroupsListByWorkspaceGet.ts | 40 + .../samples-dev/smMachineGroupsUpdatePut.ts | 49 + .../samples-dev/smMachinesGet.ts | 38 + .../samples-dev/smMachinesGetLivenessGet.ts | 39 + .../smMachinesListByWorkspaceGet.ts | 40 + .../smMachinesListConnectionsGet.ts | 42 + ...smMachinesListMachineGroupMembershipGet.ts | 42 + .../samples-dev/smMachinesListPortsGet.ts | 42 + .../samples-dev/smMachinesListProcessesGet.ts | 42 + .../samples-dev/smMachinesPortsGet.ts | 41 + .../smMachinesPortsGetLivenessGet.ts | 41 + ...mMachinesPortsListAcceptingProcessesGet.ts | 44 + .../smMachinesPortsListConnectionsGet.ts | 44 + .../samples-dev/smMachinesProcessesGet.ts | 40 + .../smMachinesProcessesGetLivenessGet.ts | 41 + ...mMachinesProcessesListAcceptingPortsGet.ts | 44 + .../smMachinesProcessesListConnectionsGet.ts | 44 + ...mMapsGenerateMachineGroupDependencyPost.ts | 42 + ...smMapsGenerateMachineListDependencyPost.ts | 44 + ...MapsGenerateSingleMachineDependencyPost.ts | 44 + .../samples-dev/smSummariesGetMachinesGet.ts | 37 + .../samples/v3-beta/javascript/README.md | 102 + .../samples/v3-beta/javascript/package.json | 32 + .../samples/v3-beta/javascript/sample.env | 4 + .../v3-beta/javascript/smClientGroupsGet.js | 39 + .../smClientGroupsGetMembersCountGet.js | 39 + .../smClientGroupsListMembersGet.js | 42 + .../javascript/smMachineGroupsCreatePost.js | 42 + .../javascript/smMachineGroupsDelete.js | 35 + .../v3-beta/javascript/smMachineGroupsGet.js | 31 + .../smMachineGroupsListByWorkspaceGet.js | 40 + .../javascript/smMachineGroupsUpdatePut.js | 48 + .../v3-beta/javascript/smMachinesGet.js | 33 + .../javascript/smMachinesGetLivenessGet.js | 39 + .../smMachinesListByWorkspaceGet.js | 40 + .../smMachinesListConnectionsGet.js | 42 + ...smMachinesListMachineGroupMembershipGet.js | 42 + .../javascript/smMachinesListPortsGet.js | 42 + .../javascript/smMachinesListProcessesGet.js | 42 + .../v3-beta/javascript/smMachinesPortsGet.js | 41 + .../smMachinesPortsGetLivenessGet.js | 41 + ...mMachinesPortsListAcceptingProcessesGet.js | 44 + .../smMachinesPortsListConnectionsGet.js | 44 + .../javascript/smMachinesProcessesGet.js | 40 + .../smMachinesProcessesGetLivenessGet.js | 41 + ...mMachinesProcessesListAcceptingPortsGet.js | 44 + .../smMachinesProcessesListConnectionsGet.js | 44 + ...mMapsGenerateMachineGroupDependencyPost.js | 38 + ...smMapsGenerateMachineListDependencyPost.js | 40 + ...MapsGenerateSingleMachineDependencyPost.js | 37 + .../javascript/smSummariesGetMachinesGet.js | 33 + .../samples/v3-beta/typescript/README.md | 115 + .../samples/v3-beta/typescript/package.json | 41 + .../samples/v3-beta/typescript/sample.env | 4 + .../typescript/src/smClientGroupsGet.ts | 40 + .../src/smClientGroupsGetMembersCountGet.ts | 40 + .../src/smClientGroupsListMembersGet.ts | 43 + .../src/smMachineGroupsCreatePost.ts | 47 + .../typescript/src/smMachineGroupsDelete.ts | 35 + .../typescript/src/smMachineGroupsGet.ts | 35 + .../src/smMachineGroupsListByWorkspaceGet.ts | 40 + .../src/smMachineGroupsUpdatePut.ts | 49 + .../v3-beta/typescript/src/smMachinesGet.ts | 38 + .../src/smMachinesGetLivenessGet.ts | 39 + .../src/smMachinesListByWorkspaceGet.ts | 40 + .../src/smMachinesListConnectionsGet.ts | 42 + ...smMachinesListMachineGroupMembershipGet.ts | 42 + .../typescript/src/smMachinesListPortsGet.ts | 42 + .../src/smMachinesListProcessesGet.ts | 42 + .../typescript/src/smMachinesPortsGet.ts | 41 + .../src/smMachinesPortsGetLivenessGet.ts | 41 + ...mMachinesPortsListAcceptingProcessesGet.ts | 44 + .../src/smMachinesPortsListConnectionsGet.ts | 44 + .../typescript/src/smMachinesProcessesGet.ts | 40 + .../src/smMachinesProcessesGetLivenessGet.ts | 41 + ...mMachinesProcessesListAcceptingPortsGet.ts | 44 + .../smMachinesProcessesListConnectionsGet.ts | 44 + ...mMapsGenerateMachineGroupDependencyPost.ts | 42 + ...smMapsGenerateMachineListDependencyPost.ts | 44 + ...MapsGenerateSingleMachineDependencyPost.ts | 44 + .../src/smSummariesGetMachinesGet.ts | 37 + .../samples/v3-beta/typescript/tsconfig.json | 17 + .../arm-servicemap/src/index.ts} | 12 +- .../src/models/clientGroupsMappers.ts | 56 - .../arm-servicemap/src/models/index.ts | 3822 +++++--------- .../src/models/machineGroupsMappers.ts | 55 - .../src/models/machinesMappers.ts | 60 - .../arm-servicemap/src/models/mappers.ts | 2723 +++++----- .../arm-servicemap/src/models/mapsMappers.ts | 63 - .../arm-servicemap/src/models/parameters.ts | 330 +- .../arm-servicemap/src/models/portsMappers.ts | 57 - .../src/models/processesMappers.ts | 57 - .../src/models/summariesMappers.ts | 54 - .../src/operations/clientGroups.ts | 396 +- .../arm-servicemap/src/operations/index.ts | 8 +- .../src/operations/machineGroups.ts | 506 +- .../arm-servicemap/src/operations/machines.ts | 1278 +++-- .../arm-servicemap/src/operations/maps.ts | 107 +- .../arm-servicemap/src/operations/ports.ts | 629 ++- .../src/operations/processes.ts | 630 ++- .../src/operations/summaries.ts | 99 +- .../src/operationsInterfaces/clientGroups.ts | 61 + .../src/operationsInterfaces/index.ts | 15 + .../src/operationsInterfaces/machineGroups.ts | 90 + .../src/operationsInterfaces/machines.ts | 126 + .../src/operationsInterfaces/maps.ts | 30 + .../src/operationsInterfaces/ports.ts | 85 + .../src/operationsInterfaces/processes.ts | 84 + .../src/operationsInterfaces/summaries.ts | 27 + .../arm-servicemap/src/serviceMap.ts | 103 + .../src/servicemapManagementClient.ts | 54 - .../src/servicemapManagementClientContext.ts | 62 - .../arm-servicemap/test/sampleTest.ts | 48 + sdk/service-map/arm-servicemap/tsconfig.json | 9 +- sdk/service-map/ci.yml | 30 + sdk/signalr/arm-signalr/CHANGELOG.md | 11 + sdk/signalr/arm-signalr/LICENSE | 21 + sdk/signalr/arm-signalr/README.md | 137 +- sdk/signalr/arm-signalr/_meta.json | 7 + sdk/signalr/arm-signalr/api-extractor.json | 18 + sdk/signalr/arm-signalr/package.json | 107 +- .../node/my_test/recording_sample_test.js | 5 + .../arm-signalr/review/arm-signalr.api.md | 873 +++ sdk/signalr/arm-signalr/rollup.config.js | 205 +- sdk/signalr/arm-signalr/sample.env | 4 + .../arm-signalr/samples-dev/operationsList.ts | 31 + .../signalRCheckNameAvailability.ts | 39 + .../samples-dev/signalRCreateOrUpdate.ts | 76 + .../arm-signalr/samples-dev/signalRDelete.ts | 33 + .../arm-signalr/samples-dev/signalRGet.ts | 30 + .../samples-dev/signalRListByResourceGroup.ts | 34 + .../samples-dev/signalRListBySubscription.ts | 31 + .../samples-dev/signalRListKeys.ts | 30 + .../samples-dev/signalRListSkus.ts | 30 + ...signalRPrivateEndpointConnectionsDelete.ts | 36 + .../signalRPrivateEndpointConnectionsGet.ts | 36 + .../signalRPrivateEndpointConnectionsList.ts | 36 + ...signalRPrivateEndpointConnectionsUpdate.ts | 50 + .../signalRPrivateLinkResourcesList.ts | 36 + .../samples-dev/signalRRegenerateKey.ts | 38 + .../arm-signalr/samples-dev/signalRRestart.ts | 33 + ...haredPrivateLinkResourcesCreateOrUpdate.ts | 45 + ...signalRSharedPrivateLinkResourcesDelete.ts | 35 + .../signalRSharedPrivateLinkResourcesGet.ts | 35 + .../signalRSharedPrivateLinkResourcesList.ts | 36 + .../arm-signalr/samples-dev/signalRUpdate.ts | 76 + .../arm-signalr/samples-dev/usagesList.ts | 32 + .../samples/v5/javascript/README.md | 92 + .../samples/v5/javascript/operationsList.js | 31 + .../samples/v5/javascript/package.json | 32 + .../samples/v5/javascript/sample.env | 4 + .../signalRCheckNameAvailability.js | 33 + .../v5/javascript/signalRCreateOrUpdate.js | 76 + .../samples/v5/javascript/signalRDelete.js | 30 + .../samples/v5/javascript/signalRGet.js | 30 + .../javascript/signalRListByResourceGroup.js | 32 + .../javascript/signalRListBySubscription.js | 31 + .../samples/v5/javascript/signalRListKeys.js | 30 + .../samples/v5/javascript/signalRListSkus.js | 30 + ...signalRPrivateEndpointConnectionsDelete.js | 35 + .../signalRPrivateEndpointConnectionsGet.js | 35 + .../signalRPrivateEndpointConnectionsList.js | 36 + ...signalRPrivateEndpointConnectionsUpdate.js | 45 + .../signalRPrivateLinkResourcesList.js | 33 + .../v5/javascript/signalRRegenerateKey.js | 35 + .../samples/v5/javascript/signalRRestart.js | 30 + ...haredPrivateLinkResourcesCreateOrUpdate.js | 42 + ...signalRSharedPrivateLinkResourcesDelete.js | 35 + .../signalRSharedPrivateLinkResourcesGet.js | 35 + .../signalRSharedPrivateLinkResourcesList.js | 36 + .../samples/v5/javascript/signalRUpdate.js | 76 + .../samples/v5/javascript/usagesList.js | 32 + .../samples/v5/typescript/README.md | 105 + .../samples/v5/typescript/package.json | 41 + .../samples/v5/typescript/sample.env | 4 + .../v5/typescript/src/operationsList.ts | 31 + .../src/signalRCheckNameAvailability.ts | 39 + .../typescript/src/signalRCreateOrUpdate.ts | 76 + .../v5/typescript/src/signalRDelete.ts | 33 + .../samples/v5/typescript/src/signalRGet.ts | 30 + .../src/signalRListByResourceGroup.ts | 34 + .../src/signalRListBySubscription.ts | 31 + .../v5/typescript/src/signalRListKeys.ts | 30 + .../v5/typescript/src/signalRListSkus.ts | 30 + ...signalRPrivateEndpointConnectionsDelete.ts | 36 + .../signalRPrivateEndpointConnectionsGet.ts | 36 + .../signalRPrivateEndpointConnectionsList.ts | 36 + ...signalRPrivateEndpointConnectionsUpdate.ts | 50 + .../src/signalRPrivateLinkResourcesList.ts | 36 + .../v5/typescript/src/signalRRegenerateKey.ts | 38 + .../v5/typescript/src/signalRRestart.ts | 33 + ...haredPrivateLinkResourcesCreateOrUpdate.ts | 45 + ...signalRSharedPrivateLinkResourcesDelete.ts | 35 + .../signalRSharedPrivateLinkResourcesGet.ts | 35 + .../signalRSharedPrivateLinkResourcesList.ts | 36 + .../v5/typescript/src/signalRUpdate.ts | 76 + .../samples/v5/typescript/src/usagesList.ts | 32 + .../samples/v5/typescript/tsconfig.json | 17 + sdk/signalr/arm-signalr/src/index.ts | 12 + sdk/signalr/arm-signalr/src/lroImpl.ts | 34 + sdk/signalr/arm-signalr/src/models/index.ts | 2487 ++++----- sdk/signalr/arm-signalr/src/models/mappers.ts | 2269 ++++---- .../src/models/operationsMappers.ts | 21 - .../arm-signalr/src/models/parameters.ts | 173 +- .../arm-signalr/src/models/signalRMappers.ts | 44 - ...ignalRPrivateEndpointConnectionsMappers.ts | 40 - .../signalRPrivateLinkResourcesMappers.ts | 40 - ...ignalRSharedPrivateLinkResourcesMappers.ts | 40 - .../arm-signalr/src/operations/index.ts | 3 +- .../arm-signalr/src/operations/operations.ts | 187 +- .../arm-signalr/src/operations/signalR.ts | 1448 ++--- .../signalRPrivateEndpointConnections.ts | 574 +- .../operations/signalRPrivateLinkResources.ts | 249 +- .../signalRSharedPrivateLinkResources.ts | 605 ++- .../arm-signalr/src/operations/usages.ts | 216 +- .../src/operationsInterfaces/index.ts | 14 + .../src/operationsInterfaces/operations.ts | 22 + .../src/operationsInterfaces/signalR.ts | 248 + .../signalRPrivateEndpointConnections.ts | 94 + .../signalRPrivateLinkResources.ts | 30 + .../signalRSharedPrivateLinkResources.ts | 117 + .../src/operationsInterfaces/usages.ts | 24 + .../src/signalRManagementClient.ts | 127 +- .../src/signalRManagementClientContext.ts | 69 - sdk/signalr/arm-signalr/test/sampleTest.ts | 48 + sdk/signalr/arm-signalr/tsconfig.json | 9 +- sdk/signalr/ci.yml | 30 + .../arm-storagecache/CHANGELOG.md | 11 + sdk/storagecache/arm-storagecache/LICENSE | 21 + sdk/storagecache/arm-storagecache/README.md | 134 +- sdk/storagecache/arm-storagecache/_meta.json | 7 + .../arm-storagecache/api-extractor.json | 18 + .../arm-storagecache/package.json | 110 +- .../node/my_test/recording_sample_test.js | 5 + .../review/arm-storagecache.api.md | 883 ++++ .../arm-storagecache/rollup.config.js | 211 +- sdk/storagecache/arm-storagecache/sample.env | 4 + .../samples-dev/ascOperationsGet.ts | 30 + .../samples-dev/cachesCreateOrUpdate.ts | 94 + .../cachesCreateOrUpdateLdapOnly.ts | 80 + .../samples-dev/cachesDebugInfo.ts | 33 + .../samples-dev/cachesDelete.ts | 33 + .../samples-dev/cachesDnsRefresh.ts | 35 + .../samples-dev/cachesFlush.ts | 33 + .../arm-storagecache/samples-dev/cachesGet.ts | 30 + .../samples-dev/cachesList.ts | 31 + .../samples-dev/cachesListByResourceGroup.ts | 32 + .../samples-dev/cachesStart.ts | 33 + .../samples-dev/cachesStop.ts | 33 + .../samples-dev/cachesUpdate.ts | 105 + .../samples-dev/cachesUpdateLdapOnly.ts | 107 + .../samples-dev/cachesUpgradeFirmware.ts | 33 + .../arm-storagecache/samples-dev/skusList.ts | 31 + .../storageTargetsCreateOrUpdate.ts | 58 + .../storageTargetsCreateOrUpdateBlobNfs.ts | 49 + ...storageTargetsCreateOrUpdateNoJunctions.ts | 44 + .../samples-dev/storageTargetsDelete.ts | 35 + .../samples-dev/storageTargetsFlush.ts | 35 + .../samples-dev/storageTargetsGet.ts | 35 + .../samples-dev/storageTargetsList.ts | 36 + .../samples-dev/storageTargetsResume.ts | 35 + .../samples-dev/storageTargetsSuspend.ts | 35 + .../samples-dev/usageModelsList.ts | 31 + .../samples/v5/javascript/README.md | 100 + .../samples/v5/javascript/ascOperationsGet.js | 30 + .../v5/javascript/cachesCreateOrUpdate.js | 94 + .../cachesCreateOrUpdateLdapOnly.js | 79 + .../samples/v5/javascript/cachesDebugInfo.js | 30 + .../samples/v5/javascript/cachesDelete.js | 30 + .../samples/v5/javascript/cachesDnsRefresh.js | 35 + .../samples/v5/javascript/cachesFlush.js | 30 + .../samples/v5/javascript/cachesGet.js | 30 + .../samples/v5/javascript/cachesList.js | 31 + .../javascript/cachesListByResourceGroup.js | 32 + .../samples/v5/javascript/cachesStart.js | 30 + .../samples/v5/javascript/cachesStop.js | 30 + .../samples/v5/javascript/cachesUpdate.js | 101 + .../v5/javascript/cachesUpdateLdapOnly.js | 103 + .../v5/javascript/cachesUpgradeFirmware.js | 30 + .../samples/v5/javascript/package.json | 32 + .../samples/v5/javascript/sample.env | 4 + .../samples/v5/javascript/skusList.js | 31 + .../storageTargetsCreateOrUpdate.js | 55 + .../storageTargetsCreateOrUpdateBlobNfs.js | 46 + ...storageTargetsCreateOrUpdateNoJunctions.js | 41 + .../v5/javascript/storageTargetsDelete.js | 35 + .../v5/javascript/storageTargetsFlush.js | 35 + .../v5/javascript/storageTargetsGet.js | 31 + .../v5/javascript/storageTargetsList.js | 33 + .../v5/javascript/storageTargetsResume.js | 35 + .../v5/javascript/storageTargetsSuspend.js | 35 + .../samples/v5/javascript/usageModelsList.js | 31 + .../samples/v5/typescript/README.md | 113 + .../samples/v5/typescript/package.json | 41 + .../samples/v5/typescript/sample.env | 4 + .../v5/typescript/src/ascOperationsGet.ts | 30 + .../v5/typescript/src/cachesCreateOrUpdate.ts | 94 + .../src/cachesCreateOrUpdateLdapOnly.ts | 80 + .../v5/typescript/src/cachesDebugInfo.ts | 33 + .../samples/v5/typescript/src/cachesDelete.ts | 33 + .../v5/typescript/src/cachesDnsRefresh.ts | 35 + .../samples/v5/typescript/src/cachesFlush.ts | 33 + .../samples/v5/typescript/src/cachesGet.ts | 30 + .../samples/v5/typescript/src/cachesList.ts | 31 + .../src/cachesListByResourceGroup.ts | 32 + .../samples/v5/typescript/src/cachesStart.ts | 33 + .../samples/v5/typescript/src/cachesStop.ts | 33 + .../samples/v5/typescript/src/cachesUpdate.ts | 105 + .../v5/typescript/src/cachesUpdateLdapOnly.ts | 107 + .../typescript/src/cachesUpgradeFirmware.ts | 33 + .../samples/v5/typescript/src/skusList.ts | 31 + .../src/storageTargetsCreateOrUpdate.ts | 58 + .../storageTargetsCreateOrUpdateBlobNfs.ts | 49 + ...storageTargetsCreateOrUpdateNoJunctions.ts | 44 + .../v5/typescript/src/storageTargetsDelete.ts | 35 + .../v5/typescript/src/storageTargetsFlush.ts | 35 + .../v5/typescript/src/storageTargetsGet.ts | 35 + .../v5/typescript/src/storageTargetsList.ts | 36 + .../v5/typescript/src/storageTargetsResume.ts | 35 + .../typescript/src/storageTargetsSuspend.ts | 35 + .../v5/typescript/src/usageModelsList.ts | 31 + .../samples/v5/typescript/tsconfig.json | 17 + .../arm-storagecache/src/index.ts | 12 + .../arm-storagecache/src/lroImpl.ts | 34 + .../src/models/cachesMappers.ts | 39 - .../arm-storagecache/src/models/index.ts | 2403 ++++----- .../arm-storagecache/src/models/mappers.ts | 1565 +++--- .../src/models/operationsMappers.ts | 17 - .../arm-storagecache/src/models/parameters.ts | 193 +- .../src/models/skusMappers.ts | 16 - .../src/models/storageTargetsMappers.ts | 39 - .../src/operations/ascOperations.ts | 88 +- .../arm-storagecache/src/operations/caches.ts | 1560 +++--- .../arm-storagecache/src/operations/index.ts | 4 +- .../src/operations/operations.ts | 178 +- .../arm-storagecache/src/operations/skus.ts | 195 +- .../src/operations/storageTargetOperations.ts | 374 ++ .../src/operations/storageTargets.ts | 774 +-- .../src/operations/usageModels.ts | 198 +- .../src/operationsInterfaces/ascOperations.ts | 27 + .../src/operationsInterfaces/caches.ts | 245 + .../src/operationsInterfaces/index.ts | 15 + .../src/operationsInterfaces/operations.ts | 22 + .../src/operationsInterfaces/skus.ts | 22 + .../storageTargetOperations.ts | 104 + .../operationsInterfaces/storageTargets.ts | 150 + .../src/operationsInterfaces/usageModels.ts | 22 + .../src/storageCacheManagementClient.ts | 128 +- .../storageCacheManagementClientContext.ts | 62 - .../arm-storagecache/test/sampleTest.ts | 48 + .../arm-storagecache/tsconfig.json | 9 +- sdk/storagecache/ci.yml | 30 + sdk/storagesync/arm-storagesync/CHANGELOG.md | 11 + sdk/storagesync/arm-storagesync/LICENSE | 21 + sdk/storagesync/arm-storagesync/README.md | 147 +- sdk/storagesync/arm-storagesync/_meta.json | 7 + .../arm-storagesync/api-extractor.json | 18 + sdk/storagesync/arm-storagesync/package.json | 107 +- .../node/my_test/recording_sample_test.js | 5 + .../review/arm-storagesync.api.md | 1614 ++++++ .../arm-storagesync/rollup.config.js | 215 +- sdk/storagesync/arm-storagesync/sample.env | 4 + .../samples-dev/cloudEndpointsCreate.ts | 49 + .../samples-dev/cloudEndpointsDelete.ts | 37 + .../samples-dev/cloudEndpointsGet.ts | 37 + .../cloudEndpointsListBySyncGroup.ts | 38 + .../samples-dev/cloudEndpointsPostBackup.ts | 42 + .../samples-dev/cloudEndpointsPostRestore.ts | 54 + .../samples-dev/cloudEndpointsPreBackup.ts | 42 + .../samples-dev/cloudEndpointsPreRestore.ts | 51 + .../cloudEndpointsRestoreheartbeat.ts | 37 + .../cloudEndpointsTriggerChangeDetection.ts | 45 + .../samples-dev/operationsList.ts | 31 + .../privateEndpointConnectionsCreate.ts | 45 + .../privateEndpointConnectionsDelete.ts | 35 + .../privateEndpointConnectionsGet.ts | 35 + ...ointConnectionsListByStorageSyncService.ts | 36 + .../samples-dev/privateLinkResourcesList.ts | 33 + .../samples-dev/registeredServersCreate.ts | 48 + .../samples-dev/registeredServersDelete.ts | 35 + .../samples-dev/registeredServersGet.ts | 35 + ...gisteredServersListByStorageSyncService.ts | 36 + .../registeredServersTriggerRollover.ts | 43 + .../samples-dev/serverEndpointsCreate.ts | 54 + .../samples-dev/serverEndpointsDelete.ts | 37 + .../samples-dev/serverEndpointsGet.ts | 37 + .../serverEndpointsListBySyncGroup.ts | 38 + .../serverEndpointsRecallAction.ts | 42 + .../samples-dev/serverEndpointsUpdate.ts | 49 + ...rviceCheckNameAvailabilityAlreadyExists.ts | 39 + ...ncServiceCheckNameAvailabilityAvailable.ts | 39 + .../samples-dev/storageSyncServicesCreate.ts | 42 + .../samples-dev/storageSyncServicesDelete.ts | 33 + .../samples-dev/storageSyncServicesGet.ts | 33 + .../storageSyncServicesListByResourceGroup.ts | 34 + .../storageSyncServicesListBySubscription.ts | 31 + .../samples-dev/storageSyncServicesUpdate.ts | 42 + .../samples-dev/syncGroupsCreate.ts | 40 + .../samples-dev/syncGroupsDelete.ts | 35 + .../samples-dev/syncGroupsGet.ts | 35 + .../syncGroupsListByStorageSyncService.ts | 36 + .../samples-dev/workflowsAbort.ts | 35 + .../samples-dev/workflowsGet.ts | 34 + .../workflowsListByStorageSyncService.ts | 36 + .../samples/v9/javascript/README.md | 132 + .../v9/javascript/cloudEndpointsCreate.js | 45 + .../v9/javascript/cloudEndpointsDelete.js | 37 + .../v9/javascript/cloudEndpointsGet.js | 37 + .../cloudEndpointsListBySyncGroup.js | 38 + .../v9/javascript/cloudEndpointsPostBackup.js | 41 + .../javascript/cloudEndpointsPostRestore.js | 51 + .../v9/javascript/cloudEndpointsPreBackup.js | 41 + .../v9/javascript/cloudEndpointsPreRestore.js | 48 + .../cloudEndpointsRestoreheartbeat.js | 37 + .../cloudEndpointsTriggerChangeDetection.js | 42 + .../samples/v9/javascript/operationsList.js | 31 + .../samples/v9/javascript/package.json | 32 + .../privateEndpointConnectionsCreate.js | 42 + .../privateEndpointConnectionsDelete.js | 35 + .../privateEndpointConnectionsGet.js | 35 + ...ointConnectionsListByStorageSyncService.js | 36 + .../v9/javascript/privateLinkResourcesList.js | 33 + .../v9/javascript/registeredServersCreate.js | 45 + .../v9/javascript/registeredServersDelete.js | 35 + .../v9/javascript/registeredServersGet.js | 35 + ...gisteredServersListByStorageSyncService.js | 36 + .../registeredServersTriggerRollover.js | 40 + .../samples/v9/javascript/sample.env | 4 + .../v9/javascript/serverEndpointsCreate.js | 51 + .../v9/javascript/serverEndpointsDelete.js | 37 + .../v9/javascript/serverEndpointsGet.js | 37 + .../serverEndpointsListBySyncGroup.js | 38 + .../javascript/serverEndpointsRecallAction.js | 39 + .../v9/javascript/serverEndpointsUpdate.js | 46 + ...rviceCheckNameAvailabilityAlreadyExists.js | 33 + ...ncServiceCheckNameAvailabilityAvailable.js | 33 + .../javascript/storageSyncServicesCreate.js | 39 + .../javascript/storageSyncServicesDelete.js | 33 + .../v9/javascript/storageSyncServicesGet.js | 30 + .../storageSyncServicesListByResourceGroup.js | 32 + .../storageSyncServicesListBySubscription.js | 31 + .../javascript/storageSyncServicesUpdate.js | 39 + .../samples/v9/javascript/syncGroupsCreate.js | 37 + .../samples/v9/javascript/syncGroupsDelete.js | 35 + .../samples/v9/javascript/syncGroupsGet.js | 35 + .../syncGroupsListByStorageSyncService.js | 36 + .../samples/v9/javascript/workflowsAbort.js | 35 + .../samples/v9/javascript/workflowsGet.js | 31 + .../workflowsListByStorageSyncService.js | 36 + .../samples/v9/typescript/README.md | 145 + .../samples/v9/typescript/package.json | 41 + .../samples/v9/typescript/sample.env | 4 + .../v9/typescript/src/cloudEndpointsCreate.ts | 49 + .../v9/typescript/src/cloudEndpointsDelete.ts | 37 + .../v9/typescript/src/cloudEndpointsGet.ts | 37 + .../src/cloudEndpointsListBySyncGroup.ts | 38 + .../src/cloudEndpointsPostBackup.ts | 42 + .../src/cloudEndpointsPostRestore.ts | 54 + .../typescript/src/cloudEndpointsPreBackup.ts | 42 + .../src/cloudEndpointsPreRestore.ts | 51 + .../src/cloudEndpointsRestoreheartbeat.ts | 37 + .../cloudEndpointsTriggerChangeDetection.ts | 45 + .../v9/typescript/src/operationsList.ts | 31 + .../src/privateEndpointConnectionsCreate.ts | 45 + .../src/privateEndpointConnectionsDelete.ts | 35 + .../src/privateEndpointConnectionsGet.ts | 35 + ...ointConnectionsListByStorageSyncService.ts | 36 + .../src/privateLinkResourcesList.ts | 33 + .../typescript/src/registeredServersCreate.ts | 48 + .../typescript/src/registeredServersDelete.ts | 35 + .../v9/typescript/src/registeredServersGet.ts | 35 + ...gisteredServersListByStorageSyncService.ts | 36 + .../src/registeredServersTriggerRollover.ts | 43 + .../typescript/src/serverEndpointsCreate.ts | 54 + .../typescript/src/serverEndpointsDelete.ts | 37 + .../v9/typescript/src/serverEndpointsGet.ts | 37 + .../src/serverEndpointsListBySyncGroup.ts | 38 + .../src/serverEndpointsRecallAction.ts | 42 + .../typescript/src/serverEndpointsUpdate.ts | 49 + ...rviceCheckNameAvailabilityAlreadyExists.ts | 39 + ...ncServiceCheckNameAvailabilityAvailable.ts | 39 + .../src/storageSyncServicesCreate.ts | 42 + .../src/storageSyncServicesDelete.ts | 33 + .../typescript/src/storageSyncServicesGet.ts | 33 + .../storageSyncServicesListByResourceGroup.ts | 34 + .../storageSyncServicesListBySubscription.ts | 31 + .../src/storageSyncServicesUpdate.ts | 42 + .../v9/typescript/src/syncGroupsCreate.ts | 40 + .../v9/typescript/src/syncGroupsDelete.ts | 35 + .../v9/typescript/src/syncGroupsGet.ts | 35 + .../src/syncGroupsListByStorageSyncService.ts | 36 + .../v9/typescript/src/workflowsAbort.ts | 35 + .../samples/v9/typescript/src/workflowsGet.ts | 34 + .../src/workflowsListByStorageSyncService.ts | 36 + .../samples/v9/typescript/tsconfig.json | 17 + sdk/storagesync/arm-storagesync/src/index.ts | 12 + .../arm-storagesync/src/lroImpl.ts | 34 + .../src/microsoftStorageSync.ts | 164 + .../src/models/cloudEndpointsMappers.ts | 52 - .../arm-storagesync/src/models/index.ts | 4657 ++++++++--------- .../arm-storagesync/src/models/mappers.ts | 4071 ++++++++------ .../operationStatusOperationsMappers.ts | 15 - .../src/models/operationsMappers.ts | 17 - .../arm-storagesync/src/models/parameters.ts | 315 +- .../src/models/registeredServersMappers.ts | 42 - .../src/models/serverEndpointsMappers.ts | 44 - .../src/models/storageSyncServicesMappers.ts | 46 - .../src/models/syncGroupsMappers.ts | 40 - .../src/models/workflowsMappers.ts | 39 - .../src/operations/cloudEndpoints.ts | 1445 +++-- .../arm-storagesync/src/operations/index.ts | 10 +- .../operations/operationStatusOperations.ts | 106 +- .../src/operations/operations.ts | 182 +- .../operations/privateEndpointConnections.ts | 451 ++ .../src/operations/privateLinkResources.ts | 70 + .../src/operations/registeredServers.ts | 641 ++- .../src/operations/serverEndpoints.ts | 930 ++-- .../src/operations/storageSyncServices.ts | 752 ++- .../src/operations/syncGroups.ts | 350 +- .../src/operations/workflows.ts | 280 +- .../operationsInterfaces/cloudEndpoints.ts | 338 ++ .../src/operationsInterfaces/index.ts | 18 + .../operationStatusOperations.ts | 31 + .../src/operationsInterfaces/operations.ts | 22 + .../privateEndpointConnections.ts | 119 + .../privateLinkResources.ts | 28 + .../operationsInterfaces/registeredServers.ts | 154 + .../operationsInterfaces/serverEndpoints.ts | 207 + .../storageSyncServices.ts | 155 + .../src/operationsInterfaces/syncGroups.ts | 77 + .../src/operationsInterfaces/workflows.ts | 59 + .../src/storageSyncManagementClient.ts | 56 - .../src/storageSyncManagementClientContext.ts | 62 - .../arm-storagesync/test/sampleTest.ts | 48 + sdk/storagesync/arm-storagesync/tsconfig.json | 9 +- sdk/storagesync/ci.yml | 30 + 881 files changed, 74014 insertions(+), 34358 deletions(-) create mode 100644 sdk/reservations/arm-reservations/CHANGELOG.md create mode 100644 sdk/reservations/arm-reservations/LICENSE create mode 100644 sdk/reservations/arm-reservations/_meta.json create mode 100644 sdk/reservations/arm-reservations/api-extractor.json create mode 100644 sdk/reservations/arm-reservations/recordings/node/my_test/recording_sample_test.js create mode 100644 sdk/reservations/arm-reservations/review/arm-reservations.api.md create mode 100644 sdk/reservations/arm-reservations/sample.env create mode 100644 sdk/reservations/arm-reservations/samples-dev/appliedReservationList.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/availableScopes.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/calculateExchange.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/catalog.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/changeDirectory.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/exchange.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/getOperations.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/getReservation.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/getReservationWithExpandPayments.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/merge.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/patchReservation.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/purchase.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/quotaRequestFailed.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/quotaRequestHistory.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/quotaRequestInProgress.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/quotaRequestStatus.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/quotasListUsagesForCompute.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/quotasListUsagesMachineLearningServices.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/quotasRequestForCompute.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/quotasRequestPatchForCompute.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/quotasRequestPutForCompute.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/quotasRequestPutForMachineLearningServicesDedicatedResource.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/quotasRequestPutForMachineLearningServicesLowPriorityResource.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/reservationList.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/reservationOrderList.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/reservationRevisions.ts create mode 100644 sdk/reservations/arm-reservations/samples-dev/split.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/README.md create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/appliedReservationList.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/availableScopes.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/calculateExchange.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/catalog.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/changeDirectory.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/exchange.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/getOperations.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/getReservation.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/getReservationWithExpandPayments.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/merge.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/package.json create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/patchReservation.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/purchase.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestFailed.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestHistory.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestInProgress.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestStatus.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/quotasListUsagesForCompute.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/quotasListUsagesMachineLearningServices.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestForCompute.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPatchForCompute.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPutForCompute.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPutForMachineLearningServicesDedicatedResource.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPutForMachineLearningServicesLowPriorityResource.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/reservationList.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderList.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/reservationRevisions.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/sample.env create mode 100644 sdk/reservations/arm-reservations/samples/v7/javascript/split.js create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/README.md create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/package.json create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/sample.env create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/appliedReservationList.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/availableScopes.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/calculateExchange.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/catalog.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/changeDirectory.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/exchange.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/getOperations.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/getReservation.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/getReservationWithExpandPayments.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/merge.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/patchReservation.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/purchase.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestFailed.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestHistory.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestInProgress.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestStatus.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasListUsagesForCompute.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasListUsagesMachineLearningServices.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestForCompute.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPatchForCompute.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPutForCompute.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPutForMachineLearningServicesDedicatedResource.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPutForMachineLearningServicesLowPriorityResource.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationList.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderList.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationRevisions.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/src/split.ts create mode 100644 sdk/reservations/arm-reservations/samples/v7/typescript/tsconfig.json delete mode 100644 sdk/reservations/arm-reservations/src/azureReservationAPIContext.ts rename sdk/{resourcemover/arm-resourcemover/src/models/unresolvedDependenciesMappers.ts => reservations/arm-reservations/src/index.ts} (57%) create mode 100644 sdk/reservations/arm-reservations/src/lroImpl.ts delete mode 100644 sdk/reservations/arm-reservations/src/models/calculateExchangeMappers.ts delete mode 100644 sdk/reservations/arm-reservations/src/models/exchangeMappers.ts delete mode 100644 sdk/reservations/arm-reservations/src/models/quotaMappers.ts delete mode 100644 sdk/reservations/arm-reservations/src/models/quotaRequestStatusMappers.ts delete mode 100644 sdk/reservations/arm-reservations/src/models/reservationMappers.ts delete mode 100644 sdk/reservations/arm-reservations/src/models/reservationOrderMappers.ts create mode 100644 sdk/reservations/arm-reservations/src/operationsInterfaces/calculateExchange.ts create mode 100644 sdk/reservations/arm-reservations/src/operationsInterfaces/exchange.ts create mode 100644 sdk/reservations/arm-reservations/src/operationsInterfaces/index.ts create mode 100644 sdk/reservations/arm-reservations/src/operationsInterfaces/operation.ts create mode 100644 sdk/reservations/arm-reservations/src/operationsInterfaces/quota.ts create mode 100644 sdk/reservations/arm-reservations/src/operationsInterfaces/quotaRequestStatus.ts create mode 100644 sdk/reservations/arm-reservations/src/operationsInterfaces/reservation.ts create mode 100644 sdk/reservations/arm-reservations/src/operationsInterfaces/reservationOrder.ts create mode 100644 sdk/reservations/arm-reservations/test/sampleTest.ts create mode 100644 sdk/reservations/ci.yml create mode 100644 sdk/resourcegraph/arm-resourcegraph/CHANGELOG.md create mode 100644 sdk/resourcegraph/arm-resourcegraph/LICENSE create mode 100644 sdk/resourcegraph/arm-resourcegraph/_meta.json create mode 100644 sdk/resourcegraph/arm-resourcegraph/api-extractor.json create mode 100644 sdk/resourcegraph/arm-resourcegraph/recordings/node/my_test/recording_sample_test.js create mode 100644 sdk/resourcegraph/arm-resourcegraph/review/arm-resourcegraph.api.md create mode 100644 sdk/resourcegraph/arm-resourcegraph/sample.env create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples-dev/accessAPropertiesField.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples-dev/basicManagementGroupQuery.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples-dev/basicQuery.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples-dev/basicTenantQuery.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples-dev/complexQuery.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples-dev/filterResources.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples-dev/firstPageQuery.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples-dev/nextPageQuery.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples-dev/operationsList.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples-dev/queryWithAFacetRequest.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples-dev/randomPageQuery.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples-dev/resourceHistoryManagementGroupScopeQuery.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples-dev/resourceHistoryQuery.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples-dev/summarizeResourcesByLocation.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/README.md create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/accessAPropertiesField.js create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/basicManagementGroupQuery.js create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/basicQuery.js create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/basicTenantQuery.js create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/complexQuery.js create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/filterResources.js create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/firstPageQuery.js create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/nextPageQuery.js create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/operationsList.js create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/package.json create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/queryWithAFacetRequest.js create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/randomPageQuery.js create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/resourceHistoryManagementGroupScopeQuery.js create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/resourceHistoryQuery.js create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/sample.env create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/summarizeResourcesByLocation.js create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/README.md create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/package.json create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/sample.env create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/accessAPropertiesField.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/basicManagementGroupQuery.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/basicQuery.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/basicTenantQuery.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/complexQuery.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/filterResources.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/firstPageQuery.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/nextPageQuery.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/operationsList.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/queryWithAFacetRequest.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/randomPageQuery.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/resourceHistoryManagementGroupScopeQuery.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/resourceHistoryQuery.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/summarizeResourcesByLocation.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/tsconfig.json rename sdk/{reservations/arm-reservations/src/models/operationMappers.ts => resourcegraph/arm-resourcegraph/src/index.ts} (57%) rename sdk/{storagecache/arm-storagecache/src/models/ascOperationsMappers.ts => resourcegraph/arm-resourcegraph/src/operationsInterfaces/index.ts} (73%) create mode 100644 sdk/resourcegraph/arm-resourcegraph/src/operationsInterfaces/operations.ts delete mode 100644 sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClientContext.ts create mode 100644 sdk/resourcegraph/arm-resourcegraph/test/sampleTest.ts create mode 100644 sdk/resourcegraph/ci.yml create mode 100644 sdk/resourcemover/arm-resourcemover/CHANGELOG.md create mode 100644 sdk/resourcemover/arm-resourcemover/LICENSE create mode 100644 sdk/resourcemover/arm-resourcemover/_meta.json create mode 100644 sdk/resourcemover/arm-resourcemover/api-extractor.json create mode 100644 sdk/resourcemover/arm-resourcemover/recordings/node/my_test/recording_sample_test.js create mode 100644 sdk/resourcemover/arm-resourcemover/review/arm-resourcemover.api.md create mode 100644 sdk/resourcemover/arm-resourcemover/sample.env create mode 100644 sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsBulkRemove.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsCommit.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsCreate.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsDelete.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsDiscard.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsGet.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsInitiateMove.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsListMoveCollectionsByResourceGroup.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsListMoveCollectionsBySubscription.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsPrepare.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsResolveDependencies.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsUpdate.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples-dev/moveResourcesCreate.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples-dev/moveResourcesDelete.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples-dev/moveResourcesGet.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples-dev/moveResourcesList.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples-dev/operationsDiscoveryGet.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples-dev/requiredForGet.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples-dev/unresolvedDependenciesGet.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/README.md create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsBulkRemove.js create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsCommit.js create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsCreate.js create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsDelete.js create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsDiscard.js create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsGet.js create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsInitiateMove.js create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsListMoveCollectionsByResourceGroup.js create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsListMoveCollectionsBySubscription.js create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsPrepare.js create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsResolveDependencies.js create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsUpdate.js create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveResourcesCreate.js create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveResourcesDelete.js create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveResourcesGet.js create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveResourcesList.js create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/operationsDiscoveryGet.js create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/package.json create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/requiredForGet.js create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/sample.env create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/javascript/unresolvedDependenciesGet.js create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/README.md create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/package.json create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/sample.env create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsBulkRemove.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsCommit.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsCreate.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsDelete.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsDiscard.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsGet.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsInitiateMove.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsListMoveCollectionsByResourceGroup.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsListMoveCollectionsBySubscription.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsPrepare.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsResolveDependencies.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsUpdate.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveResourcesCreate.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveResourcesDelete.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveResourcesGet.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveResourcesList.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/operationsDiscoveryGet.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/requiredForGet.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/unresolvedDependenciesGet.ts create mode 100644 sdk/resourcemover/arm-resourcemover/samples/v2/typescript/tsconfig.json create mode 100644 sdk/resourcemover/arm-resourcemover/src/index.ts create mode 100644 sdk/resourcemover/arm-resourcemover/src/lroImpl.ts delete mode 100644 sdk/resourcemover/arm-resourcemover/src/models/moveCollectionsMappers.ts delete mode 100644 sdk/resourcemover/arm-resourcemover/src/models/moveResourcesMappers.ts rename sdk/{resourcegraph/arm-resourcegraph/src/models/operationsMappers.ts => resourcemover/arm-resourcemover/src/operationsInterfaces/index.ts} (59%) create mode 100644 sdk/resourcemover/arm-resourcemover/src/operationsInterfaces/moveCollections.ts create mode 100644 sdk/resourcemover/arm-resourcemover/src/operationsInterfaces/moveResources.ts create mode 100644 sdk/resourcemover/arm-resourcemover/src/operationsInterfaces/operationsDiscoveryOperations.ts create mode 100644 sdk/resourcemover/arm-resourcemover/src/operationsInterfaces/unresolvedDependencies.ts delete mode 100644 sdk/resourcemover/arm-resourcemover/src/resourceMoverServiceAPIContext.ts create mode 100644 sdk/resourcemover/arm-resourcemover/test/sampleTest.ts create mode 100644 sdk/resourcemover/ci.yml create mode 100644 sdk/serialconsole/arm-serialconsole/CHANGELOG.md create mode 100644 sdk/serialconsole/arm-serialconsole/LICENSE create mode 100644 sdk/serialconsole/arm-serialconsole/_meta.json create mode 100644 sdk/serialconsole/arm-serialconsole/api-extractor.json create mode 100644 sdk/serialconsole/arm-serialconsole/recordings/node/my_test/recording_sample_test.js create mode 100644 sdk/serialconsole/arm-serialconsole/review/arm-serialconsole.api.md rename sdk/{resourcemover/arm-resourcemover/src/models/operationsDiscoveryOperationsMappers.ts => serialconsole/arm-serialconsole/src/index.ts} (61%) delete mode 100644 sdk/serialconsole/arm-serialconsole/src/microsoftSerialConsoleClientContext.ts delete mode 100644 sdk/serialconsole/arm-serialconsole/src/models/consoleMappers.ts delete mode 100644 sdk/serialconsole/arm-serialconsole/src/models/listConsoleMappers.ts delete mode 100644 sdk/serialconsole/arm-serialconsole/src/models/listMappers.ts delete mode 100644 sdk/serialconsole/arm-serialconsole/src/operations/console.ts delete mode 100644 sdk/serialconsole/arm-serialconsole/src/operations/list.ts delete mode 100644 sdk/serialconsole/arm-serialconsole/src/operations/listConsole.ts create mode 100644 sdk/serialconsole/arm-serialconsole/src/operations/serialPorts.ts rename sdk/{storagecache/arm-storagecache/src/models/usageModelsMappers.ts => serialconsole/arm-serialconsole/src/operationsInterfaces/index.ts} (68%) create mode 100644 sdk/serialconsole/arm-serialconsole/src/operationsInterfaces/serialPorts.ts create mode 100644 sdk/serialconsole/arm-serialconsole/test/sampleTest.ts create mode 100644 sdk/serialconsole/ci.yml create mode 100644 sdk/service-map/arm-servicemap/CHANGELOG.md create mode 100644 sdk/service-map/arm-servicemap/LICENSE create mode 100644 sdk/service-map/arm-servicemap/_meta.json create mode 100644 sdk/service-map/arm-servicemap/api-extractor.json create mode 100644 sdk/service-map/arm-servicemap/recordings/node/my_test/recording_sample_test.js create mode 100644 sdk/service-map/arm-servicemap/review/arm-servicemap.api.md create mode 100644 sdk/service-map/arm-servicemap/sample.env create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smClientGroupsGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smClientGroupsGetMembersCountGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smClientGroupsListMembersGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMachineGroupsCreatePost.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMachineGroupsDelete.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMachineGroupsGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMachineGroupsListByWorkspaceGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMachineGroupsUpdatePut.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMachinesGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMachinesGetLivenessGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMachinesListByWorkspaceGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMachinesListConnectionsGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMachinesListMachineGroupMembershipGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMachinesListPortsGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMachinesListProcessesGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMachinesPortsGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMachinesPortsGetLivenessGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMachinesPortsListAcceptingProcessesGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMachinesPortsListConnectionsGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMachinesProcessesGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMachinesProcessesGetLivenessGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMachinesProcessesListAcceptingPortsGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMachinesProcessesListConnectionsGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMapsGenerateMachineGroupDependencyPost.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMapsGenerateMachineListDependencyPost.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smMapsGenerateSingleMachineDependencyPost.ts create mode 100644 sdk/service-map/arm-servicemap/samples-dev/smSummariesGetMachinesGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/README.md create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/package.json create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/sample.env create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smClientGroupsGet.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smClientGroupsGetMembersCountGet.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smClientGroupsListMembersGet.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsCreatePost.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsDelete.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsGet.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsListByWorkspaceGet.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsUpdatePut.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesGet.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesGetLivenessGet.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListByWorkspaceGet.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListConnectionsGet.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListMachineGroupMembershipGet.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListPortsGet.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListProcessesGet.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesPortsGet.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesPortsGetLivenessGet.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesPortsListAcceptingProcessesGet.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesPortsListConnectionsGet.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesProcessesGet.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesProcessesGetLivenessGet.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesProcessesListAcceptingPortsGet.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesProcessesListConnectionsGet.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMapsGenerateMachineGroupDependencyPost.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMapsGenerateMachineListDependencyPost.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMapsGenerateSingleMachineDependencyPost.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smSummariesGetMachinesGet.js create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/README.md create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/package.json create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/sample.env create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smClientGroupsGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smClientGroupsGetMembersCountGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smClientGroupsListMembersGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsCreatePost.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsDelete.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsListByWorkspaceGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsUpdatePut.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesGetLivenessGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListByWorkspaceGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListConnectionsGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListMachineGroupMembershipGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListPortsGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListProcessesGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesPortsGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesPortsGetLivenessGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesPortsListAcceptingProcessesGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesPortsListConnectionsGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesProcessesGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesProcessesGetLivenessGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesProcessesListAcceptingPortsGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesProcessesListConnectionsGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMapsGenerateMachineGroupDependencyPost.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMapsGenerateMachineListDependencyPost.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMapsGenerateSingleMachineDependencyPost.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smSummariesGetMachinesGet.ts create mode 100644 sdk/service-map/arm-servicemap/samples/v3-beta/typescript/tsconfig.json rename sdk/{signalr/arm-signalr/src/models/usagesMappers.ts => service-map/arm-servicemap/src/index.ts} (60%) delete mode 100644 sdk/service-map/arm-servicemap/src/models/clientGroupsMappers.ts delete mode 100644 sdk/service-map/arm-servicemap/src/models/machineGroupsMappers.ts delete mode 100644 sdk/service-map/arm-servicemap/src/models/machinesMappers.ts delete mode 100644 sdk/service-map/arm-servicemap/src/models/mapsMappers.ts delete mode 100644 sdk/service-map/arm-servicemap/src/models/portsMappers.ts delete mode 100644 sdk/service-map/arm-servicemap/src/models/processesMappers.ts delete mode 100644 sdk/service-map/arm-servicemap/src/models/summariesMappers.ts create mode 100644 sdk/service-map/arm-servicemap/src/operationsInterfaces/clientGroups.ts create mode 100644 sdk/service-map/arm-servicemap/src/operationsInterfaces/index.ts create mode 100644 sdk/service-map/arm-servicemap/src/operationsInterfaces/machineGroups.ts create mode 100644 sdk/service-map/arm-servicemap/src/operationsInterfaces/machines.ts create mode 100644 sdk/service-map/arm-servicemap/src/operationsInterfaces/maps.ts create mode 100644 sdk/service-map/arm-servicemap/src/operationsInterfaces/ports.ts create mode 100644 sdk/service-map/arm-servicemap/src/operationsInterfaces/processes.ts create mode 100644 sdk/service-map/arm-servicemap/src/operationsInterfaces/summaries.ts create mode 100644 sdk/service-map/arm-servicemap/src/serviceMap.ts delete mode 100644 sdk/service-map/arm-servicemap/src/servicemapManagementClient.ts delete mode 100644 sdk/service-map/arm-servicemap/src/servicemapManagementClientContext.ts create mode 100644 sdk/service-map/arm-servicemap/test/sampleTest.ts create mode 100644 sdk/service-map/ci.yml create mode 100644 sdk/signalr/arm-signalr/CHANGELOG.md create mode 100644 sdk/signalr/arm-signalr/LICENSE create mode 100644 sdk/signalr/arm-signalr/_meta.json create mode 100644 sdk/signalr/arm-signalr/api-extractor.json create mode 100644 sdk/signalr/arm-signalr/recordings/node/my_test/recording_sample_test.js create mode 100644 sdk/signalr/arm-signalr/review/arm-signalr.api.md create mode 100644 sdk/signalr/arm-signalr/sample.env create mode 100644 sdk/signalr/arm-signalr/samples-dev/operationsList.ts create mode 100644 sdk/signalr/arm-signalr/samples-dev/signalRCheckNameAvailability.ts create mode 100644 sdk/signalr/arm-signalr/samples-dev/signalRCreateOrUpdate.ts create mode 100644 sdk/signalr/arm-signalr/samples-dev/signalRDelete.ts create mode 100644 sdk/signalr/arm-signalr/samples-dev/signalRGet.ts create mode 100644 sdk/signalr/arm-signalr/samples-dev/signalRListByResourceGroup.ts create mode 100644 sdk/signalr/arm-signalr/samples-dev/signalRListBySubscription.ts create mode 100644 sdk/signalr/arm-signalr/samples-dev/signalRListKeys.ts create mode 100644 sdk/signalr/arm-signalr/samples-dev/signalRListSkus.ts create mode 100644 sdk/signalr/arm-signalr/samples-dev/signalRPrivateEndpointConnectionsDelete.ts create mode 100644 sdk/signalr/arm-signalr/samples-dev/signalRPrivateEndpointConnectionsGet.ts create mode 100644 sdk/signalr/arm-signalr/samples-dev/signalRPrivateEndpointConnectionsList.ts create mode 100644 sdk/signalr/arm-signalr/samples-dev/signalRPrivateEndpointConnectionsUpdate.ts create mode 100644 sdk/signalr/arm-signalr/samples-dev/signalRPrivateLinkResourcesList.ts create mode 100644 sdk/signalr/arm-signalr/samples-dev/signalRRegenerateKey.ts create mode 100644 sdk/signalr/arm-signalr/samples-dev/signalRRestart.ts create mode 100644 sdk/signalr/arm-signalr/samples-dev/signalRSharedPrivateLinkResourcesCreateOrUpdate.ts create mode 100644 sdk/signalr/arm-signalr/samples-dev/signalRSharedPrivateLinkResourcesDelete.ts create mode 100644 sdk/signalr/arm-signalr/samples-dev/signalRSharedPrivateLinkResourcesGet.ts create mode 100644 sdk/signalr/arm-signalr/samples-dev/signalRSharedPrivateLinkResourcesList.ts create mode 100644 sdk/signalr/arm-signalr/samples-dev/signalRUpdate.ts create mode 100644 sdk/signalr/arm-signalr/samples-dev/usagesList.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/README.md create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/operationsList.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/package.json create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/sample.env create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/signalRCheckNameAvailability.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/signalRCreateOrUpdate.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/signalRDelete.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/signalRGet.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/signalRListByResourceGroup.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/signalRListBySubscription.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/signalRListKeys.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/signalRListSkus.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateEndpointConnectionsDelete.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateEndpointConnectionsGet.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateEndpointConnectionsList.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateEndpointConnectionsUpdate.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateLinkResourcesList.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/signalRRegenerateKey.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/signalRRestart.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/signalRSharedPrivateLinkResourcesCreateOrUpdate.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/signalRSharedPrivateLinkResourcesDelete.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/signalRSharedPrivateLinkResourcesGet.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/signalRSharedPrivateLinkResourcesList.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/signalRUpdate.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/javascript/usagesList.js create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/README.md create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/package.json create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/sample.env create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/operationsList.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRCheckNameAvailability.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRCreateOrUpdate.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRDelete.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRGet.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRListByResourceGroup.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRListBySubscription.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRListKeys.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRListSkus.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateEndpointConnectionsDelete.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateEndpointConnectionsGet.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateEndpointConnectionsList.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateEndpointConnectionsUpdate.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateLinkResourcesList.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRRegenerateKey.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRRestart.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRSharedPrivateLinkResourcesCreateOrUpdate.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRSharedPrivateLinkResourcesDelete.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRSharedPrivateLinkResourcesGet.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRSharedPrivateLinkResourcesList.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRUpdate.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/src/usagesList.ts create mode 100644 sdk/signalr/arm-signalr/samples/v5/typescript/tsconfig.json create mode 100644 sdk/signalr/arm-signalr/src/index.ts create mode 100644 sdk/signalr/arm-signalr/src/lroImpl.ts delete mode 100644 sdk/signalr/arm-signalr/src/models/operationsMappers.ts delete mode 100644 sdk/signalr/arm-signalr/src/models/signalRMappers.ts delete mode 100644 sdk/signalr/arm-signalr/src/models/signalRPrivateEndpointConnectionsMappers.ts delete mode 100644 sdk/signalr/arm-signalr/src/models/signalRPrivateLinkResourcesMappers.ts delete mode 100644 sdk/signalr/arm-signalr/src/models/signalRSharedPrivateLinkResourcesMappers.ts create mode 100644 sdk/signalr/arm-signalr/src/operationsInterfaces/index.ts create mode 100644 sdk/signalr/arm-signalr/src/operationsInterfaces/operations.ts create mode 100644 sdk/signalr/arm-signalr/src/operationsInterfaces/signalR.ts create mode 100644 sdk/signalr/arm-signalr/src/operationsInterfaces/signalRPrivateEndpointConnections.ts create mode 100644 sdk/signalr/arm-signalr/src/operationsInterfaces/signalRPrivateLinkResources.ts create mode 100644 sdk/signalr/arm-signalr/src/operationsInterfaces/signalRSharedPrivateLinkResources.ts create mode 100644 sdk/signalr/arm-signalr/src/operationsInterfaces/usages.ts delete mode 100644 sdk/signalr/arm-signalr/src/signalRManagementClientContext.ts create mode 100644 sdk/signalr/arm-signalr/test/sampleTest.ts create mode 100644 sdk/signalr/ci.yml create mode 100644 sdk/storagecache/arm-storagecache/CHANGELOG.md create mode 100644 sdk/storagecache/arm-storagecache/LICENSE create mode 100644 sdk/storagecache/arm-storagecache/_meta.json create mode 100644 sdk/storagecache/arm-storagecache/api-extractor.json create mode 100644 sdk/storagecache/arm-storagecache/recordings/node/my_test/recording_sample_test.js create mode 100644 sdk/storagecache/arm-storagecache/review/arm-storagecache.api.md create mode 100644 sdk/storagecache/arm-storagecache/sample.env create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/ascOperationsGet.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/cachesCreateOrUpdate.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/cachesCreateOrUpdateLdapOnly.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/cachesDebugInfo.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/cachesDelete.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/cachesDnsRefresh.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/cachesFlush.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/cachesGet.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/cachesList.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/cachesListByResourceGroup.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/cachesStart.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/cachesStop.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/cachesUpdate.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/cachesUpdateLdapOnly.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/cachesUpgradeFirmware.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/skusList.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/storageTargetsCreateOrUpdate.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/storageTargetsCreateOrUpdateBlobNfs.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/storageTargetsCreateOrUpdateNoJunctions.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/storageTargetsDelete.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/storageTargetsFlush.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/storageTargetsGet.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/storageTargetsList.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/storageTargetsResume.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/storageTargetsSuspend.ts create mode 100644 sdk/storagecache/arm-storagecache/samples-dev/usageModelsList.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/README.md create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/ascOperationsGet.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesCreateOrUpdate.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesCreateOrUpdateLdapOnly.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesDebugInfo.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesDelete.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesDnsRefresh.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesFlush.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesGet.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesList.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesListByResourceGroup.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesStart.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesStop.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesUpdate.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesUpdateLdapOnly.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesUpgradeFirmware.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/package.json create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/sample.env create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/skusList.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsCreateOrUpdate.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsCreateOrUpdateBlobNfs.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsCreateOrUpdateNoJunctions.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsDelete.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsFlush.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsGet.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsList.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsResume.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsSuspend.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/javascript/usageModelsList.js create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/README.md create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/package.json create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/sample.env create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/ascOperationsGet.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesCreateOrUpdate.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesCreateOrUpdateLdapOnly.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesDebugInfo.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesDelete.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesDnsRefresh.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesFlush.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesGet.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesList.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesListByResourceGroup.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesStart.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesStop.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesUpdate.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesUpdateLdapOnly.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesUpgradeFirmware.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/skusList.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsCreateOrUpdate.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsCreateOrUpdateBlobNfs.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsCreateOrUpdateNoJunctions.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsDelete.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsFlush.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsGet.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsList.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsResume.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsSuspend.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/src/usageModelsList.ts create mode 100644 sdk/storagecache/arm-storagecache/samples/v5/typescript/tsconfig.json create mode 100644 sdk/storagecache/arm-storagecache/src/index.ts create mode 100644 sdk/storagecache/arm-storagecache/src/lroImpl.ts delete mode 100644 sdk/storagecache/arm-storagecache/src/models/cachesMappers.ts delete mode 100644 sdk/storagecache/arm-storagecache/src/models/operationsMappers.ts delete mode 100644 sdk/storagecache/arm-storagecache/src/models/skusMappers.ts delete mode 100644 sdk/storagecache/arm-storagecache/src/models/storageTargetsMappers.ts create mode 100644 sdk/storagecache/arm-storagecache/src/operations/storageTargetOperations.ts create mode 100644 sdk/storagecache/arm-storagecache/src/operationsInterfaces/ascOperations.ts create mode 100644 sdk/storagecache/arm-storagecache/src/operationsInterfaces/caches.ts create mode 100644 sdk/storagecache/arm-storagecache/src/operationsInterfaces/index.ts create mode 100644 sdk/storagecache/arm-storagecache/src/operationsInterfaces/operations.ts create mode 100644 sdk/storagecache/arm-storagecache/src/operationsInterfaces/skus.ts create mode 100644 sdk/storagecache/arm-storagecache/src/operationsInterfaces/storageTargetOperations.ts create mode 100644 sdk/storagecache/arm-storagecache/src/operationsInterfaces/storageTargets.ts create mode 100644 sdk/storagecache/arm-storagecache/src/operationsInterfaces/usageModels.ts delete mode 100644 sdk/storagecache/arm-storagecache/src/storageCacheManagementClientContext.ts create mode 100644 sdk/storagecache/arm-storagecache/test/sampleTest.ts create mode 100644 sdk/storagecache/ci.yml create mode 100644 sdk/storagesync/arm-storagesync/CHANGELOG.md create mode 100644 sdk/storagesync/arm-storagesync/LICENSE create mode 100644 sdk/storagesync/arm-storagesync/_meta.json create mode 100644 sdk/storagesync/arm-storagesync/api-extractor.json create mode 100644 sdk/storagesync/arm-storagesync/recordings/node/my_test/recording_sample_test.js create mode 100644 sdk/storagesync/arm-storagesync/review/arm-storagesync.api.md create mode 100644 sdk/storagesync/arm-storagesync/sample.env create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsCreate.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsDelete.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsGet.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsListBySyncGroup.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsPostBackup.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsPostRestore.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsPreBackup.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsPreRestore.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsRestoreheartbeat.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsTriggerChangeDetection.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/operationsList.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/privateEndpointConnectionsCreate.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/privateEndpointConnectionsDelete.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/privateEndpointConnectionsGet.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/privateEndpointConnectionsListByStorageSyncService.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/privateLinkResourcesList.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/registeredServersCreate.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/registeredServersDelete.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/registeredServersGet.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/registeredServersListByStorageSyncService.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/registeredServersTriggerRollover.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsCreate.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsDelete.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsGet.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsListBySyncGroup.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsRecallAction.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsUpdate.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/storageSyncServiceCheckNameAvailabilityAlreadyExists.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/storageSyncServiceCheckNameAvailabilityAvailable.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesCreate.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesDelete.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesGet.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesListByResourceGroup.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesListBySubscription.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesUpdate.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/syncGroupsCreate.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/syncGroupsDelete.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/syncGroupsGet.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/syncGroupsListByStorageSyncService.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/workflowsAbort.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/workflowsGet.ts create mode 100644 sdk/storagesync/arm-storagesync/samples-dev/workflowsListByStorageSyncService.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/README.md create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsCreate.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsDelete.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsGet.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsListBySyncGroup.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsPostBackup.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsPostRestore.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsPreBackup.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsPreRestore.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsRestoreheartbeat.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsTriggerChangeDetection.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/operationsList.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/package.json create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/privateEndpointConnectionsCreate.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/privateEndpointConnectionsDelete.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/privateEndpointConnectionsGet.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/privateEndpointConnectionsListByStorageSyncService.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/privateLinkResourcesList.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersCreate.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersDelete.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersGet.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersListByStorageSyncService.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersTriggerRollover.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/sample.env create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsCreate.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsDelete.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsGet.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsListBySyncGroup.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsRecallAction.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsUpdate.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServiceCheckNameAvailabilityAlreadyExists.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServiceCheckNameAvailabilityAvailable.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesCreate.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesDelete.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesGet.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesListByResourceGroup.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesListBySubscription.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesUpdate.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/syncGroupsCreate.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/syncGroupsDelete.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/syncGroupsGet.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/syncGroupsListByStorageSyncService.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/workflowsAbort.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/workflowsGet.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/javascript/workflowsListByStorageSyncService.js create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/README.md create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/package.json create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/sample.env create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsCreate.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsDelete.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsGet.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsListBySyncGroup.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsPostBackup.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsPostRestore.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsPreBackup.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsPreRestore.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsRestoreheartbeat.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsTriggerChangeDetection.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/operationsList.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateEndpointConnectionsCreate.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateEndpointConnectionsDelete.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateEndpointConnectionsGet.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateEndpointConnectionsListByStorageSyncService.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateLinkResourcesList.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersCreate.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersDelete.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersGet.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersListByStorageSyncService.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersTriggerRollover.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsCreate.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsDelete.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsGet.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsListBySyncGroup.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsRecallAction.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsUpdate.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServiceCheckNameAvailabilityAlreadyExists.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServiceCheckNameAvailabilityAvailable.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesCreate.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesDelete.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesGet.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesListByResourceGroup.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesListBySubscription.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesUpdate.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/syncGroupsCreate.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/syncGroupsDelete.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/syncGroupsGet.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/syncGroupsListByStorageSyncService.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/workflowsAbort.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/workflowsGet.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/src/workflowsListByStorageSyncService.ts create mode 100644 sdk/storagesync/arm-storagesync/samples/v9/typescript/tsconfig.json create mode 100644 sdk/storagesync/arm-storagesync/src/index.ts create mode 100644 sdk/storagesync/arm-storagesync/src/lroImpl.ts create mode 100644 sdk/storagesync/arm-storagesync/src/microsoftStorageSync.ts delete mode 100644 sdk/storagesync/arm-storagesync/src/models/cloudEndpointsMappers.ts delete mode 100644 sdk/storagesync/arm-storagesync/src/models/operationStatusOperationsMappers.ts delete mode 100644 sdk/storagesync/arm-storagesync/src/models/operationsMappers.ts delete mode 100644 sdk/storagesync/arm-storagesync/src/models/registeredServersMappers.ts delete mode 100644 sdk/storagesync/arm-storagesync/src/models/serverEndpointsMappers.ts delete mode 100644 sdk/storagesync/arm-storagesync/src/models/storageSyncServicesMappers.ts delete mode 100644 sdk/storagesync/arm-storagesync/src/models/syncGroupsMappers.ts delete mode 100644 sdk/storagesync/arm-storagesync/src/models/workflowsMappers.ts create mode 100644 sdk/storagesync/arm-storagesync/src/operations/privateEndpointConnections.ts create mode 100644 sdk/storagesync/arm-storagesync/src/operations/privateLinkResources.ts create mode 100644 sdk/storagesync/arm-storagesync/src/operationsInterfaces/cloudEndpoints.ts create mode 100644 sdk/storagesync/arm-storagesync/src/operationsInterfaces/index.ts create mode 100644 sdk/storagesync/arm-storagesync/src/operationsInterfaces/operationStatusOperations.ts create mode 100644 sdk/storagesync/arm-storagesync/src/operationsInterfaces/operations.ts create mode 100644 sdk/storagesync/arm-storagesync/src/operationsInterfaces/privateEndpointConnections.ts create mode 100644 sdk/storagesync/arm-storagesync/src/operationsInterfaces/privateLinkResources.ts create mode 100644 sdk/storagesync/arm-storagesync/src/operationsInterfaces/registeredServers.ts create mode 100644 sdk/storagesync/arm-storagesync/src/operationsInterfaces/serverEndpoints.ts create mode 100644 sdk/storagesync/arm-storagesync/src/operationsInterfaces/storageSyncServices.ts create mode 100644 sdk/storagesync/arm-storagesync/src/operationsInterfaces/syncGroups.ts create mode 100644 sdk/storagesync/arm-storagesync/src/operationsInterfaces/workflows.ts delete mode 100644 sdk/storagesync/arm-storagesync/src/storageSyncManagementClient.ts delete mode 100644 sdk/storagesync/arm-storagesync/src/storageSyncManagementClientContext.ts create mode 100644 sdk/storagesync/arm-storagesync/test/sampleTest.ts create mode 100644 sdk/storagesync/ci.yml diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index f553739b974..0fd36f8f2f1 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -110,17 +110,25 @@ specifiers: '@rush-temp/arm-rediscache': file:./projects/arm-rediscache.tgz '@rush-temp/arm-redisenterprisecache': file:./projects/arm-redisenterprisecache.tgz '@rush-temp/arm-relay': file:./projects/arm-relay.tgz + '@rush-temp/arm-reservations': file:./projects/arm-reservations.tgz + '@rush-temp/arm-resourcegraph': file:./projects/arm-resourcegraph.tgz '@rush-temp/arm-resourcehealth': file:./projects/arm-resourcehealth.tgz + '@rush-temp/arm-resourcemover': file:./projects/arm-resourcemover.tgz '@rush-temp/arm-resources': file:./projects/arm-resources.tgz '@rush-temp/arm-resources-subscriptions': file:./projects/arm-resources-subscriptions.tgz '@rush-temp/arm-search': file:./projects/arm-search.tgz '@rush-temp/arm-security': file:./projects/arm-security.tgz '@rush-temp/arm-securityinsight': file:./projects/arm-securityinsight.tgz + '@rush-temp/arm-serialconsole': file:./projects/arm-serialconsole.tgz '@rush-temp/arm-servicebus': file:./projects/arm-servicebus.tgz '@rush-temp/arm-servicefabric': file:./projects/arm-servicefabric.tgz + '@rush-temp/arm-servicemap': file:./projects/arm-servicemap.tgz + '@rush-temp/arm-signalr': file:./projects/arm-signalr.tgz '@rush-temp/arm-sql': file:./projects/arm-sql.tgz '@rush-temp/arm-sqlvirtualmachine': file:./projects/arm-sqlvirtualmachine.tgz '@rush-temp/arm-storage': file:./projects/arm-storage.tgz + '@rush-temp/arm-storagecache': file:./projects/arm-storagecache.tgz + '@rush-temp/arm-storagesync': file:./projects/arm-storagesync.tgz '@rush-temp/arm-streamanalytics': file:./projects/arm-streamanalytics.tgz '@rush-temp/arm-subscriptions': file:./projects/arm-subscriptions.tgz '@rush-temp/arm-synapse': file:./projects/arm-synapse.tgz @@ -342,17 +350,25 @@ dependencies: '@rush-temp/arm-rediscache': file:projects/arm-rediscache.tgz '@rush-temp/arm-redisenterprisecache': file:projects/arm-redisenterprisecache.tgz '@rush-temp/arm-relay': file:projects/arm-relay.tgz + '@rush-temp/arm-reservations': file:projects/arm-reservations.tgz + '@rush-temp/arm-resourcegraph': file:projects/arm-resourcegraph.tgz '@rush-temp/arm-resourcehealth': file:projects/arm-resourcehealth.tgz + '@rush-temp/arm-resourcemover': file:projects/arm-resourcemover.tgz '@rush-temp/arm-resources': file:projects/arm-resources.tgz '@rush-temp/arm-resources-subscriptions': file:projects/arm-resources-subscriptions.tgz '@rush-temp/arm-search': file:projects/arm-search.tgz '@rush-temp/arm-security': file:projects/arm-security.tgz '@rush-temp/arm-securityinsight': file:projects/arm-securityinsight.tgz + '@rush-temp/arm-serialconsole': file:projects/arm-serialconsole.tgz '@rush-temp/arm-servicebus': file:projects/arm-servicebus.tgz '@rush-temp/arm-servicefabric': file:projects/arm-servicefabric.tgz + '@rush-temp/arm-servicemap': file:projects/arm-servicemap.tgz + '@rush-temp/arm-signalr': file:projects/arm-signalr.tgz '@rush-temp/arm-sql': file:projects/arm-sql.tgz '@rush-temp/arm-sqlvirtualmachine': file:projects/arm-sqlvirtualmachine.tgz '@rush-temp/arm-storage': file:projects/arm-storage.tgz + '@rush-temp/arm-storagecache': file:projects/arm-storagecache.tgz + '@rush-temp/arm-storagesync': file:projects/arm-storagesync.tgz '@rush-temp/arm-streamanalytics': file:projects/arm-streamanalytics.tgz '@rush-temp/arm-subscriptions': file:projects/arm-subscriptions.tgz '@rush-temp/arm-synapse': file:projects/arm-synapse.tgz @@ -11190,6 +11206,56 @@ packages: - supports-color dev: false + file:projects/arm-reservations.tgz: + resolution: {integrity: sha512-3W8+jfJsjrwXC+hllrUv2+vWu1ePqVcZyaVwUck8IQjlQ48QRBrbg8DQRlYUWxEV3jQevqv+qyVnGCkFzza86Q==, tarball: file:projects/arm-reservations.tgz} + name: '@rush-temp/arm-reservations' + version: 0.0.0 + dependencies: + '@azure-tools/test-recorder': 1.0.2 + '@microsoft/api-extractor': 7.19.4 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + tslib: 2.3.1 + typescript: 4.2.4 + uglify-js: 3.14.5 + transitivePeerDependencies: + - encoding + - supports-color + dev: false + + file:projects/arm-resourcegraph.tgz: + resolution: {integrity: sha512-76aD1wFiDz2tO2T/G0Mhx95UvRGRI0pOYLQvo7PmCCOhU4LBxF2qG6Q+PsIfxbzbOmufYsMCn8t4TeH0ok/mkA==, tarball: file:projects/arm-resourcegraph.tgz} + name: '@rush-temp/arm-resourcegraph' + version: 0.0.0 + dependencies: + '@azure-tools/test-recorder': 1.0.2 + '@microsoft/api-extractor': 7.19.4 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + tslib: 2.3.1 + typescript: 4.2.4 + uglify-js: 3.14.5 + transitivePeerDependencies: + - encoding + - supports-color + dev: false + file:projects/arm-resourcehealth.tgz: resolution: {integrity: sha512-ssLCh8GgbsVtwLFyE5qlPtC6OjpWdCtYeIbKxvNKerfJOMH/Vb15Osy2TMpWEvUmLPSSeyiRXz5ZBMYg+AKK5g==, tarball: file:projects/arm-resourcehealth.tgz} name: '@rush-temp/arm-resourcehealth' @@ -11215,6 +11281,31 @@ packages: - supports-color dev: false + file:projects/arm-resourcemover.tgz: + resolution: {integrity: sha512-ZIqOtcTkGKQrl2gsE7UibEgBu3B8cRnDRXZrlZu2m5HRd03ULoMPKGDhWeoCot0CZq7rTin3jZ/JM9ueg2DLmQ==, tarball: file:projects/arm-resourcemover.tgz} + name: '@rush-temp/arm-resourcemover' + version: 0.0.0 + dependencies: + '@azure-tools/test-recorder': 1.0.2 + '@microsoft/api-extractor': 7.19.4 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + tslib: 2.3.1 + typescript: 4.2.4 + uglify-js: 3.14.5 + transitivePeerDependencies: + - encoding + - supports-color + dev: false + file:projects/arm-resources-subscriptions.tgz: resolution: {integrity: sha512-Y8XL95tGixEM0br4pDJgRVqqa4CZWJRbu1SGkBtHZNKbpJ1aU3OXeei1dk84bEtu+FvjDh3j2QOFKKhnMoSFgA==, tarball: file:projects/arm-resources-subscriptions.tgz} name: '@rush-temp/arm-resources-subscriptions' @@ -11340,6 +11431,31 @@ packages: - supports-color dev: false + file:projects/arm-serialconsole.tgz: + resolution: {integrity: sha512-sDmYrBhQPPUMsQmmkYwAk3uimeBXnxkpCYrNjU1AWuIBMlkEkpLdVoR2t6B/0At7TqvxVJuFRlWjZabYsMKX4g==, tarball: file:projects/arm-serialconsole.tgz} + name: '@rush-temp/arm-serialconsole' + version: 0.0.0 + dependencies: + '@azure-tools/test-recorder': 1.0.2 + '@microsoft/api-extractor': 7.19.4 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + tslib: 2.3.1 + typescript: 4.2.4 + uglify-js: 3.14.5 + transitivePeerDependencies: + - encoding + - supports-color + dev: false + file:projects/arm-servicebus.tgz: resolution: {integrity: sha512-xUyJSlaPZccUpQ99rOf2TIUziaa7K1Ch4vcz0Jp+Dj/eam95rdQFtidaAoubJTI+Wcom0OsKDHWVqLbUyS8GpA==, tarball: file:projects/arm-servicebus.tgz} name: '@rush-temp/arm-servicebus' @@ -11390,6 +11506,56 @@ packages: - supports-color dev: false + file:projects/arm-servicemap.tgz: + resolution: {integrity: sha512-Y8Q9PXQu+1Piyy9trUSdIgpFJWoPNbyg4HI2WT5Y0Dy2bOIMOGu78n1hSGenwXtBJ4KqX5U6fkZkR0k/X8mZoA==, tarball: file:projects/arm-servicemap.tgz} + name: '@rush-temp/arm-servicemap' + version: 0.0.0 + dependencies: + '@azure-tools/test-recorder': 1.0.2 + '@microsoft/api-extractor': 7.19.4 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + tslib: 2.3.1 + typescript: 4.2.4 + uglify-js: 3.14.5 + transitivePeerDependencies: + - encoding + - supports-color + dev: false + + file:projects/arm-signalr.tgz: + resolution: {integrity: sha512-MQjQG3zQ9rZktJJr2gdGGF8EMaQGgAntAXTqcwzaQAVbi3J4jDo2DDfvxo5MWP5Ptv2cZlL9TbrReu0GKmMgRg==, tarball: file:projects/arm-signalr.tgz} + name: '@rush-temp/arm-signalr' + version: 0.0.0 + dependencies: + '@azure-tools/test-recorder': 1.0.2 + '@microsoft/api-extractor': 7.19.4 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + tslib: 2.3.1 + typescript: 4.2.4 + uglify-js: 3.14.5 + transitivePeerDependencies: + - encoding + - supports-color + dev: false + file:projects/arm-sql.tgz: resolution: {integrity: sha512-CEtDIxHX9rKD5MgweS7t+aOwxGDS8ozHLc5Ur5POzatrFrpSFF37FeM7rT80sdAuG/YVfRVq0VCQZ5OXr18GLw==, tarball: file:projects/arm-sql.tgz} name: '@rush-temp/arm-sql' @@ -11467,6 +11633,56 @@ packages: - supports-color dev: false + file:projects/arm-storagecache.tgz: + resolution: {integrity: sha512-59403AImIIuWQutODkwlYLprQ9XdenZ0r8LGxR+WQUE+41BVpdNp6yYdUh0aX6A9aS7y9aP4b4xYpp/miQprbw==, tarball: file:projects/arm-storagecache.tgz} + name: '@rush-temp/arm-storagecache' + version: 0.0.0 + dependencies: + '@azure-tools/test-recorder': 1.0.2 + '@microsoft/api-extractor': 7.19.4 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + tslib: 2.3.1 + typescript: 4.2.4 + uglify-js: 3.14.5 + transitivePeerDependencies: + - encoding + - supports-color + dev: false + + file:projects/arm-storagesync.tgz: + resolution: {integrity: sha512-P6CH4ZGJgS6t6K9jdc72GjLv3HFXrUIYyoax20RTHxe7MMLep6ChwehcKF8RpYH4BUEJTHiMEVRGI0Lt6DP6Gw==, tarball: file:projects/arm-storagesync.tgz} + name: '@rush-temp/arm-storagesync' + version: 0.0.0 + dependencies: + '@azure-tools/test-recorder': 1.0.2 + '@microsoft/api-extractor': 7.19.4 + '@rollup/plugin-commonjs': 11.0.2_rollup@1.32.1 + '@rollup/plugin-json': 4.1.0_rollup@1.32.1 + '@rollup/plugin-multi-entry': 3.0.1_rollup@1.32.1 + '@rollup/plugin-node-resolve': 8.4.0_rollup@1.32.1 + cross-env: 7.0.3 + mkdirp: 1.0.4 + mocha: 7.2.0 + rimraf: 3.0.2 + rollup: 1.32.1 + rollup-plugin-sourcemaps: 0.4.2_rollup@1.32.1 + tslib: 2.3.1 + typescript: 4.2.4 + uglify-js: 3.14.5 + transitivePeerDependencies: + - encoding + - supports-color + dev: false + file:projects/arm-streamanalytics.tgz: resolution: {integrity: sha512-anS7TXMqYdobBqt4VnMVXs6geNykd9Wod2fgz7EEfpPT4lMmA2I9MSeBA+zAZp5JvmuiWS+2SRFhjmfwWRFIzA==, tarball: file:projects/arm-streamanalytics.tgz} name: '@rush-temp/arm-streamanalytics' diff --git a/eng/ignore-links.txt b/eng/ignore-links.txt index 41aa4edde7a..ae4210adc9f 100644 --- a/eng/ignore-links.txt +++ b/eng/ignore-links.txt @@ -28,3 +28,4 @@ https://docs.microsoft.com/javascript/api/@azure/arm-peering https://docs.microsoft.com/javascript/api/@azure/arm-peering?view=azure-node-preview https://docs.microsoft.com/javascript/api/@azure/arm-postgresql-flexible https://docs.microsoft.com/javascript/api/@azure/arm-postgresql-flexible?view=azure-node-preview +https://docs.microsoft.com/javascript/api/@azure/arm-serialconsole diff --git a/rush.json b/rush.json index 050bb77bfe2..80c79857e4f 100644 --- a/rush.json +++ b/rush.json @@ -1468,7 +1468,47 @@ }, { "packageName": "@azure/arm-redisenterprisecache", - "projectFolder": "sdk/redisenterprise/arm-redisenterprisecache", + "projectFolder": "sdk/redisenterprise/arm-redisenterprisecache" + }, + { + "packageName": "@azure/arm-reservations", + "projectFolder": "sdk/reservations/arm-reservations", + "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-resourcemover", + "projectFolder": "sdk/resourcemover/arm-resourcemover", + "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-serialconsole", + "projectFolder": "sdk/serialconsole/arm-serialconsole", + "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-servicemap", + "projectFolder": "sdk/service-map/arm-servicemap", + "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-signalr", + "projectFolder": "sdk/signalr/arm-signalr", + "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-storagecache", + "projectFolder": "sdk/storagecache/arm-storagecache", + "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-storagesync", + "projectFolder": "sdk/storagesync/arm-storagesync", + "versionPolicyName": "management" + }, + { + "packageName": "@azure/arm-resourcegraph", + "projectFolder": "sdk/resourcegraph/arm-resourcegraph", + "versionPolicyName": "management" } ] -} +} \ No newline at end of file diff --git a/sdk/reservations/arm-reservations/CHANGELOG.md b/sdk/reservations/arm-reservations/CHANGELOG.md new file mode 100644 index 00000000000..c2b1b167d39 --- /dev/null +++ b/sdk/reservations/arm-reservations/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 7.0.0 (2022-01-21) + +The package of @azure/arm-reservations is using our next generation design principles since version 7.0.0, which contains breaking changes. + +To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog). + +To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/reservations/arm-reservations/LICENSE b/sdk/reservations/arm-reservations/LICENSE new file mode 100644 index 00000000000..5d1d36e0af8 --- /dev/null +++ b/sdk/reservations/arm-reservations/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/reservations/arm-reservations/README.md b/sdk/reservations/arm-reservations/README.md index 16ddbfe2b48..d93dec6fc89 100644 --- a/sdk/reservations/arm-reservations/README.md +++ b/sdk/reservations/arm-reservations/README.md @@ -1,103 +1,98 @@ -## Azure AzureReservationAPI SDK for JavaScript +# Azure Service client library for JavaScript -This package contains an isomorphic SDK for AzureReservationAPI. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Service client. + +This API describe Azure Reservation + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/reservations/arm-reservations) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-reservations) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-reservations) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started ### Currently supported environments - [LTS versions of Node.js](https://nodejs.org/about/releases/) -- Latest versions of Safari, Chrome, Edge, and Firefox. +- Latest versions of Safari, Chrome, Edge and Firefox. -### How to Install +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-reservations` package + +Install the Azure Service client library for JavaScript with `npm`: ```bash npm install @azure/arm-reservations ``` -### How to use +### Create and authenticate a `AzureReservationAPI` -#### nodejs - Authentication, client creation and get quota as an example written in TypeScript. +To create a client object to access the Azure Service API, you will need the `endpoint` of your Azure Service resource and a `credential`. The Azure Service client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure Service resource in the [Azure Portal][azure_portal]. -##### Install @azure/ms-rest-nodeauth +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: -- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`. ```bash -npm install @azure/ms-rest-nodeauth@"^3.0.0" +npm install @azure/identity ``` -##### Sample code +You will also need to **register a new AAD application and grant access to Azure Service** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. + +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). ```javascript const { AzureReservationAPI } = require("@azure/arm-reservations"); -const { interactiveLogin } = require("@azure/ms-rest-nodeauth"); - -interactiveLogin().then((creds) => { - const client = new AzureReservationAPI(creds); - const subscriptionId = "testsubscriptionId"; - const providerId = "testproviderId"; - const location = "westus"; - const resourceName = "testresourceName"; - client.quota.get(subscriptionId, providerId, location, resourceName).then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.error(err); -}); +const { DefaultAzureCredential } = require("@azure/identity"); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new AzureReservationAPI(new DefaultAzureCredential(), subscriptionId); ``` -#### browser - Authentication, client creation and get quota as an example written in JavaScript. -##### Install @azure/ms-rest-browserauth +### 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). -```bash -npm install @azure/ms-rest-browserauth +## Key concepts + +### AzureReservationAPI + +`AzureReservationAPI` is the primary interface for developers using the Azure Service client library. Explore the methods on this client object to understand the different features of the Azure Service 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"); ``` -##### Sample code +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). -See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. +## Next steps -- index.html -```html - - - - @azure/arm-reservations sample - - - - - - - - -``` +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. ## Related projects -- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/reservations/arm-reservations/README.png) +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Freservations%2Farm-reservations%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/reservations/arm-reservations/_meta.json b/sdk/reservations/arm-reservations/_meta.json new file mode 100644 index 00000000000..d5a3fef2402 --- /dev/null +++ b/sdk/reservations/arm-reservations/_meta.json @@ -0,0 +1,7 @@ +{ + "commit": "f9a6cb686bcc0f1b23761db19f2491c5c4df95cb", + "readme": "specification/reservations/resource-manager/readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/reservations/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20220114.1 --generate-sample=true", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "use": "@autorest/typescript@6.0.0-alpha.16.20220114.1" +} \ No newline at end of file diff --git a/sdk/reservations/arm-reservations/api-extractor.json b/sdk/reservations/arm-reservations/api-extractor.json new file mode 100644 index 00000000000..4e853dfd7c0 --- /dev/null +++ b/sdk/reservations/arm-reservations/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-reservations.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/reservations/arm-reservations/package.json b/sdk/reservations/arm-reservations/package.json index 3ed3ffb6d44..b33764a7a20 100644 --- a/sdk/reservations/arm-reservations/package.json +++ b/sdk/reservations/arm-reservations/package.json @@ -1,58 +1,103 @@ { "name": "@azure/arm-reservations", + "sdk-type": "mgmt", "author": "Microsoft Corporation", - "description": "AzureReservationAPI Library with typescript type definitions for node.js and browser.", - "version": "6.0.0", + "description": "A generated SDK for AzureReservationAPI.", + "version": "7.0.0", + "engines": { "node": ">=12.0.0" }, "dependencies": { - "@azure/ms-rest-azure-js": "^2.0.1", - "@azure/ms-rest-js": "^2.0.4", - "tslib": "^1.10.0" + "@azure/core-lro": "^2.2.0", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.1.0", + "tslib": "^2.2.0" }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], + "keywords": ["node", "azure", "typescript", "browser", "isomorphic"], "license": "MIT", - "main": "./dist/arm-reservations.js", - "module": "./esm/azureReservationAPI.js", - "types": "./esm/azureReservationAPI.d.ts", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-reservations.d.ts", "devDependencies": { - "typescript": "^3.5.3", - "rollup": "^1.18.0", - "rollup-plugin-node-resolve": "^5.2.0", + "@microsoft/api-extractor": "^7.18.11", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "mkdirp": "^1.0.4", + "rollup": "^1.16.3", "rollup-plugin-sourcemaps": "^0.4.2", - "uglify-js": "^3.6.0" + "typescript": "~4.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^1.0.0", + "mocha": "^7.1.1", + "cross-env": "^7.0.2" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/reservations/arm-reservations", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" }, - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, + "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, "files": [ "dist/**/*.js", "dist/**/*.js.map", "dist/**/*.d.ts", "dist/**/*.d.ts.map", - "esm/**/*.js", - "esm/**/*.js.map", - "esm/**/*.d.ts", - "esm/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", "src/**/*.ts", "README.md", + "LICENSE", "rollup.config.js", - "tsconfig.json" + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" ], "scripts": { - "build": "tsc && rollup -c rollup.config.js && npm run minify", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-reservations.js.map'\" -o ./dist/arm-reservations.min.js ./dist/arm-reservations.js", - "prepack": "npm install && npm run build" + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" }, "sideEffects": false, - "autoPublish": true + "//metadata": { + "constantPaths": [ + { "path": "src/AzureReservationAPI.ts", "prefix": "packageDetails" } + ] + }, + "autoPublish": true, + "//sampleConfiguration": { + "productName": "", + "productSlugs": ["azure"], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-reservations?view=azure-node-preview" + } } diff --git a/sdk/reservations/arm-reservations/recordings/node/my_test/recording_sample_test.js b/sdk/reservations/arm-reservations/recordings/node/my_test/recording_sample_test.js new file mode 100644 index 00000000000..0f6ecb857ac --- /dev/null +++ b/sdk/reservations/arm-reservations/recordings/node/my_test/recording_sample_test.js @@ -0,0 +1,5 @@ +let nock = require('nock'); + +module.exports.hash = "7a6be38bb8cb644d64b4094802301751"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} diff --git a/sdk/reservations/arm-reservations/review/arm-reservations.api.md b/sdk/reservations/arm-reservations/review/arm-reservations.api.md new file mode 100644 index 00000000000..4e74f67b6a0 --- /dev/null +++ b/sdk/reservations/arm-reservations/review/arm-reservations.api.md @@ -0,0 +1,1605 @@ +## API Report File for "@azure/arm-reservations" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { PollOperationState } from '@azure/core-lro'; + +// @public (undocumented) +export interface AppliedReservationList { + nextLink?: string; + // (undocumented) + value?: string[]; +} + +// @public (undocumented) +export interface AppliedReservations { + readonly id?: string; + readonly name?: string; + // (undocumented) + reservationOrderIds?: AppliedReservationList; + readonly type?: string; +} + +// @public +export type AppliedScopeType = string; + +// @public (undocumented) +export interface AvailableScopeProperties { + // (undocumented) + properties?: SubscriptionScopeProperties; +} + +// @public +export interface AvailableScopeRequest { + properties?: AvailableScopeRequestProperties; +} + +// @public +export interface AvailableScopeRequestProperties { + // (undocumented) + scopes?: string[]; +} + +// @public (undocumented) +export class AzureReservationAPI extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, options?: AzureReservationAPIOptionalParams); + // (undocumented) + calculateExchange: CalculateExchange; + // (undocumented) + exchange: Exchange; + getAppliedReservationList(subscriptionId: string, options?: GetAppliedReservationListOptionalParams): Promise; + getCatalog(subscriptionId: string, options?: GetCatalogOptionalParams): Promise; + // (undocumented) + operation: Operation; + // (undocumented) + quota: Quota; + // (undocumented) + quotaRequestStatus: QuotaRequestStatus; + // (undocumented) + reservation: Reservation; + // (undocumented) + reservationOrder: ReservationOrder; +} + +// @public +export interface AzureReservationAPIOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + endpoint?: string; +} + +// @public +export interface BillingInformation { + // (undocumented) + billingCurrencyProratedAmount?: Price; + // (undocumented) + billingCurrencyRemainingCommitmentAmount?: Price; + // (undocumented) + billingCurrencyTotalPaidAmount?: Price; +} + +// @public +export interface CalculateExchange { + beginPost(body: CalculateExchangeRequest, options?: CalculateExchangePostOptionalParams): Promise, CalculateExchangePostResponse>>; + beginPostAndWait(body: CalculateExchangeRequest, options?: CalculateExchangePostOptionalParams): Promise; +} + +// @public +export interface CalculateExchangeOperationResultResponse { + error?: OperationResultError; + id?: string; + name?: string; + properties?: CalculateExchangeResponseProperties; + status?: CalculateExchangeOperationResultStatus; +} + +// @public +export type CalculateExchangeOperationResultStatus = string; + +// @public +export interface CalculateExchangePostHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface CalculateExchangePostOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type CalculateExchangePostResponse = CalculateExchangeOperationResultResponse; + +// @public +export interface CalculateExchangeRequest { + properties?: CalculateExchangeRequestProperties; +} + +// @public +export interface CalculateExchangeRequestProperties { + reservationsToExchange?: ReservationToReturn[]; + reservationsToPurchase?: PurchaseRequest[]; +} + +// @public +export interface CalculateExchangeResponseProperties { + // (undocumented) + netPayable?: Price; + policyResult?: ExchangePolicyErrors; + // (undocumented) + purchasesTotal?: Price; + // (undocumented) + refundsTotal?: Price; + reservationsToExchange?: ReservationToExchange[]; + reservationsToPurchase?: ReservationToPurchaseCalculateExchange[]; + sessionId?: string; +} + +// @public (undocumented) +export interface CalculatePriceResponse { + // (undocumented) + properties?: CalculatePriceResponseProperties; +} + +// @public (undocumented) +export interface CalculatePriceResponseProperties { + billingCurrencyTotal?: CalculatePriceResponsePropertiesBillingCurrencyTotal; + grandTotal?: number; + isBillingPartnerManaged?: boolean; + isTaxIncluded?: boolean; + netTotal?: number; + // (undocumented) + paymentSchedule?: PaymentDetail[]; + pricingCurrencyTotal?: CalculatePriceResponsePropertiesPricingCurrencyTotal; + reservationOrderId?: string; + skuDescription?: string; + skuTitle?: string; + taxTotal?: number; +} + +// @public +export interface CalculatePriceResponsePropertiesBillingCurrencyTotal { + amount?: number; + currencyCode?: string; +} + +// @public +export interface CalculatePriceResponsePropertiesPricingCurrencyTotal { + // (undocumented) + amount?: number; + currencyCode?: string; +} + +// @public (undocumented) +export interface Catalog { + billingPlans?: { + [propertyName: string]: ReservationBillingPlan[]; + }; + readonly capabilities?: SkuCapability[]; + readonly locations?: string[]; + readonly msrp?: CatalogMsrp; + readonly name?: string; + readonly resourceType?: string; + readonly restrictions?: SkuRestriction[]; + readonly size?: string; + readonly skuProperties?: SkuProperty[]; + readonly terms?: ReservationTerm[]; + readonly tier?: string; +} + +// @public +export interface CatalogMsrp { + p1Y?: Price; +} + +// @public (undocumented) +export interface ChangeDirectoryRequest { + destinationTenantId?: string; +} + +// @public +export interface ChangeDirectoryResponse { + reservationOrder?: ChangeDirectoryResult; + // (undocumented) + reservations?: ChangeDirectoryResult[]; +} + +// @public +export interface ChangeDirectoryResult { + error?: string; + id?: string; + isSucceeded?: boolean; + name?: string; +} + +// @public +export type CreatedByType = string; + +// @public +export interface CreateGenericQuotaRequestParameters { + value?: CurrentQuotaLimitBase[]; +} + +// @public +export interface CurrentQuotaLimit { + readonly message?: string; + properties?: QuotaProperties; + readonly provisioningState?: QuotaRequestState; +} + +// @public +export interface CurrentQuotaLimitBase { + properties?: QuotaProperties; +} + +// @public +export type DisplayProvisioningState = string; + +// @public +export interface ErrorDetails { + readonly code?: string; + readonly message?: string; + readonly target?: string; +} + +// @public (undocumented) +export interface ErrorModel { + // (undocumented) + error?: ExtendedErrorInfo; +} + +// @public +export interface ErrorResponse { + error?: ErrorDetails; +} + +// @public +export type ErrorResponseCode = string; + +// @public +export interface ExceptionResponse { + error?: ServiceError; +} + +// @public +export interface Exchange { + beginPost(body: ExchangeRequest, options?: ExchangePostOptionalParams): Promise, ExchangePostResponse>>; + beginPostAndWait(body: ExchangeRequest, options?: ExchangePostOptionalParams): Promise; +} + +// @public +export interface ExchangeOperationResultResponse { + error?: OperationResultError; + id?: string; + name?: string; + properties?: ExchangeResponseProperties; + status?: ExchangeOperationResultStatus; +} + +// @public +export type ExchangeOperationResultStatus = string; + +// @public +export interface ExchangePolicyError { + // (undocumented) + code?: string; + // (undocumented) + message?: string; +} + +// @public +export interface ExchangePolicyErrors { + policyErrors?: ExchangePolicyError[]; +} + +// @public +export interface ExchangePostHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: number; +} + +// @public +export interface ExchangePostOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ExchangePostResponse = ExchangeOperationResultResponse; + +// @public +export interface ExchangeRequest { + properties?: ExchangeRequestProperties; +} + +// @public +export interface ExchangeRequestProperties { + sessionId?: string; +} + +// @public +export interface ExchangeResponseProperties { + // (undocumented) + netPayable?: Price; + policyResult?: ExchangePolicyErrors; + // (undocumented) + purchasesTotal?: Price; + // (undocumented) + refundsTotal?: Price; + reservationsToExchange?: ReservationToReturnForExchange[]; + reservationsToPurchase?: ReservationToPurchaseExchange[]; + sessionId?: string; +} + +// @public (undocumented) +export interface ExtendedErrorInfo { + // (undocumented) + code?: ErrorResponseCode; + // (undocumented) + message?: string; +} + +// @public (undocumented) +export interface ExtendedStatusInfo { + message?: string; + // (undocumented) + statusCode?: ReservationStatusCode; +} + +// @public +export interface GetAppliedReservationListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GetAppliedReservationListResponse = AppliedReservations; + +// @public +export interface GetCatalogOptionalParams extends coreClient.OperationOptions { + location?: string; + reservedResourceType?: string; +} + +// @public +export type GetCatalogResponse = Catalog[]; + +// @public +export type InstanceFlexibility = string; + +// @public +export enum KnownAppliedScopeType { + // (undocumented) + Shared = "Shared", + // (undocumented) + Single = "Single" +} + +// @public +export enum KnownCalculateExchangeOperationResultStatus { + // (undocumented) + Cancelled = "Cancelled", + // (undocumented) + Failed = "Failed", + // (undocumented) + Pending = "Pending", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownCreatedByType { + // (undocumented) + Application = "Application", + // (undocumented) + Key = "Key", + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + User = "User" +} + +// @public +export enum KnownDisplayProvisioningState { + // (undocumented) + Cancelled = "Cancelled", + // (undocumented) + Expired = "Expired", + // (undocumented) + Expiring = "Expiring", + // (undocumented) + Failed = "Failed", + // (undocumented) + Pending = "Pending", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownErrorResponseCode { + // (undocumented) + ActivateQuoteFailed = "ActivateQuoteFailed", + // (undocumented) + AppliedScopesNotAssociatedWithCommerceAccount = "AppliedScopesNotAssociatedWithCommerceAccount", + // (undocumented) + AppliedScopesSameAsExisting = "AppliedScopesSameAsExisting", + // (undocumented) + AuthorizationFailed = "AuthorizationFailed", + // (undocumented) + BadRequest = "BadRequest", + // (undocumented) + BillingCustomerInputError = "BillingCustomerInputError", + // (undocumented) + BillingError = "BillingError", + // (undocumented) + BillingPaymentInstrumentHardError = "BillingPaymentInstrumentHardError", + // (undocumented) + BillingPaymentInstrumentSoftError = "BillingPaymentInstrumentSoftError", + // (undocumented) + BillingScopeIdCannotBeChanged = "BillingScopeIdCannotBeChanged", + // (undocumented) + BillingTransientError = "BillingTransientError", + // (undocumented) + CalculatePriceFailed = "CalculatePriceFailed", + // (undocumented) + CapacityUpdateScopesFailed = "CapacityUpdateScopesFailed", + // (undocumented) + ClientCertificateThumbprintNotSet = "ClientCertificateThumbprintNotSet", + // (undocumented) + CreateQuoteFailed = "CreateQuoteFailed", + // (undocumented) + Forbidden = "Forbidden", + // (undocumented) + FulfillmentConfigurationError = "FulfillmentConfigurationError", + // (undocumented) + FulfillmentError = "FulfillmentError", + // (undocumented) + FulfillmentOutOfStockError = "FulfillmentOutOfStockError", + // (undocumented) + FulfillmentTransientError = "FulfillmentTransientError", + // (undocumented) + HttpMethodNotSupported = "HttpMethodNotSupported", + // (undocumented) + InternalServerError = "InternalServerError", + // (undocumented) + InvalidAccessToken = "InvalidAccessToken", + // (undocumented) + InvalidFulfillmentRequestParameters = "InvalidFulfillmentRequestParameters", + // (undocumented) + InvalidHealthCheckType = "InvalidHealthCheckType", + // (undocumented) + InvalidLocationId = "InvalidLocationId", + // (undocumented) + InvalidRefundQuantity = "InvalidRefundQuantity", + // (undocumented) + InvalidRequestContent = "InvalidRequestContent", + // (undocumented) + InvalidRequestUri = "InvalidRequestUri", + // (undocumented) + InvalidReservationId = "InvalidReservationId", + // (undocumented) + InvalidReservationOrderId = "InvalidReservationOrderId", + // (undocumented) + InvalidSingleAppliedScopesCount = "InvalidSingleAppliedScopesCount", + // (undocumented) + InvalidSubscriptionId = "InvalidSubscriptionId", + // (undocumented) + InvalidTenantId = "InvalidTenantId", + // (undocumented) + MissingAppliedScopesForSingle = "MissingAppliedScopesForSingle", + // (undocumented) + MissingTenantId = "MissingTenantId", + // (undocumented) + NonsupportedAccountId = "NonsupportedAccountId", + // (undocumented) + NotSpecified = "NotSpecified", + // (undocumented) + NotSupportedCountry = "NotSupportedCountry", + // (undocumented) + NoValidReservationsToReRate = "NoValidReservationsToReRate", + // (undocumented) + OperationCannotBePerformedInCurrentState = "OperationCannotBePerformedInCurrentState", + // (undocumented) + OperationFailed = "OperationFailed", + // (undocumented) + PatchValuesSameAsExisting = "PatchValuesSameAsExisting", + // (undocumented) + PaymentInstrumentNotFound = "PaymentInstrumentNotFound", + // (undocumented) + PurchaseError = "PurchaseError", + // (undocumented) + ReRateOnlyAllowedForEA = "ReRateOnlyAllowedForEA", + // (undocumented) + ReservationIdNotInReservationOrder = "ReservationIdNotInReservationOrder", + // (undocumented) + ReservationOrderCreationFailed = "ReservationOrderCreationFailed", + // (undocumented) + ReservationOrderIdAlreadyExists = "ReservationOrderIdAlreadyExists", + // (undocumented) + ReservationOrderNotEnabled = "ReservationOrderNotEnabled", + // (undocumented) + ReservationOrderNotFound = "ReservationOrderNotFound", + // (undocumented) + RiskCheckFailed = "RiskCheckFailed", + // (undocumented) + RoleAssignmentCreationFailed = "RoleAssignmentCreationFailed", + // (undocumented) + ServerTimeout = "ServerTimeout", + // (undocumented) + UnauthenticatedRequestsThrottled = "UnauthenticatedRequestsThrottled", + // (undocumented) + UnsupportedReservationTerm = "UnsupportedReservationTerm" +} + +// @public +export enum KnownExchangeOperationResultStatus { + // (undocumented) + Cancelled = "Cancelled", + // (undocumented) + Failed = "Failed", + // (undocumented) + PendingPurchases = "PendingPurchases", + // (undocumented) + PendingRefunds = "PendingRefunds", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownInstanceFlexibility { + // (undocumented) + Off = "Off", + // (undocumented) + On = "On" +} + +// @public +export enum KnownLocation { + // (undocumented) + Australiaeast = "australiaeast", + // (undocumented) + Australiasoutheast = "australiasoutheast", + // (undocumented) + Brazilsouth = "brazilsouth", + // (undocumented) + Canadacentral = "canadacentral", + // (undocumented) + Canadaeast = "canadaeast", + // (undocumented) + Centralindia = "centralindia", + // (undocumented) + Centralus = "centralus", + // (undocumented) + Eastasia = "eastasia", + // (undocumented) + Eastus = "eastus", + // (undocumented) + Eastus2 = "eastus2", + // (undocumented) + Japaneast = "japaneast", + // (undocumented) + Japanwest = "japanwest", + // (undocumented) + Northcentralus = "northcentralus", + // (undocumented) + Northeurope = "northeurope", + // (undocumented) + Southcentralus = "southcentralus", + // (undocumented) + Southeastasia = "southeastasia", + // (undocumented) + Southindia = "southindia", + // (undocumented) + Uksouth = "uksouth", + // (undocumented) + Ukwest = "ukwest", + // (undocumented) + Westcentralus = "westcentralus", + // (undocumented) + Westeurope = "westeurope", + // (undocumented) + Westindia = "westindia", + // (undocumented) + Westus = "westus", + // (undocumented) + Westus2 = "westus2" +} + +// @public +export enum KnownOperationStatus { + // (undocumented) + Cancelled = "Cancelled", + // (undocumented) + Failed = "Failed", + // (undocumented) + Pending = "Pending", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownPaymentStatus { + // (undocumented) + Cancelled = "Cancelled", + // (undocumented) + Failed = "Failed", + // (undocumented) + Scheduled = "Scheduled", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownProvisioningState { + // (undocumented) + BillingFailed = "BillingFailed", + // (undocumented) + Cancelled = "Cancelled", + // (undocumented) + ConfirmedBilling = "ConfirmedBilling", + // (undocumented) + ConfirmedResourceHold = "ConfirmedResourceHold", + // (undocumented) + Created = "Created", + // (undocumented) + Creating = "Creating", + // (undocumented) + Expired = "Expired", + // (undocumented) + Failed = "Failed", + // (undocumented) + Merged = "Merged", + // (undocumented) + PendingBilling = "PendingBilling", + // (undocumented) + PendingResourceHold = "PendingResourceHold", + // (undocumented) + Split = "Split", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownQuotaRequestState { + // (undocumented) + Accepted = "Accepted", + // (undocumented) + Failed = "Failed", + // (undocumented) + InProgress = "InProgress", + // (undocumented) + Invalid = "Invalid", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownReservationBillingPlan { + // (undocumented) + Monthly = "Monthly", + // (undocumented) + Upfront = "Upfront" +} + +// @public +export enum KnownReservationStatusCode { + // (undocumented) + Active = "Active", + // (undocumented) + Expired = "Expired", + // (undocumented) + Merged = "Merged", + // (undocumented) + None = "None", + // (undocumented) + PaymentInstrumentError = "PaymentInstrumentError", + // (undocumented) + Pending = "Pending", + // (undocumented) + PurchaseError = "PurchaseError", + // (undocumented) + Split = "Split", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownReservationTerm { + // (undocumented) + P1Y = "P1Y", + // (undocumented) + P3Y = "P3Y", + // (undocumented) + P5Y = "P5Y" +} + +// @public +export enum KnownReservedResourceType { + // (undocumented) + AppService = "AppService", + // (undocumented) + AVS = "AVS", + // (undocumented) + AzureDataExplorer = "AzureDataExplorer", + // (undocumented) + AzureFiles = "AzureFiles", + // (undocumented) + BlockBlob = "BlockBlob", + // (undocumented) + CosmosDb = "CosmosDb", + // (undocumented) + Databricks = "Databricks", + // (undocumented) + DataFactory = "DataFactory", + // (undocumented) + DedicatedHost = "DedicatedHost", + // (undocumented) + ManagedDisk = "ManagedDisk", + // (undocumented) + MariaDb = "MariaDb", + // (undocumented) + MySql = "MySql", + // (undocumented) + NetAppStorage = "NetAppStorage", + // (undocumented) + PostgreSql = "PostgreSql", + // (undocumented) + RedHat = "RedHat", + // (undocumented) + RedHatOsa = "RedHatOsa", + // (undocumented) + RedisCache = "RedisCache", + // (undocumented) + SapHana = "SapHana", + // (undocumented) + SqlAzureHybridBenefit = "SqlAzureHybridBenefit", + // (undocumented) + SqlDatabases = "SqlDatabases", + // (undocumented) + SqlDataWarehouse = "SqlDataWarehouse", + // (undocumented) + SqlEdge = "SqlEdge", + // (undocumented) + SuseLinux = "SuseLinux", + // (undocumented) + VirtualMachines = "VirtualMachines", + // (undocumented) + VMwareCloudSimple = "VMwareCloudSimple" +} + +// @public +export enum KnownResourceType { + // (undocumented) + Dedicated = "dedicated", + // (undocumented) + LowPriority = "lowPriority", + // (undocumented) + ServiceSpecific = "serviceSpecific", + // (undocumented) + Shared = "shared", + // (undocumented) + Standard = "standard" +} + +// @public +export enum KnownUserFriendlyAppliedScopeType { + // (undocumented) + ManagementGroup = "ManagementGroup", + // (undocumented) + None = "None", + // (undocumented) + ResourceGroup = "ResourceGroup", + // (undocumented) + Shared = "Shared", + // (undocumented) + Single = "Single" +} + +// @public +export enum KnownUserFriendlyRenewState { + // (undocumented) + NotApplicable = "NotApplicable", + // (undocumented) + NotRenewed = "NotRenewed", + // (undocumented) + Off = "Off", + // (undocumented) + On = "On", + // (undocumented) + Renewed = "Renewed" +} + +// @public +type Location_2 = string; +export { Location_2 as Location } + +// @public (undocumented) +export interface MergeRequest { + sources?: string[]; +} + +// @public +export interface Operation { + list(options?: OperationListOptionalParams): PagedAsyncIterableIterator; +} + +// @public (undocumented) +export interface OperationDisplay { + // (undocumented) + description?: string; + // (undocumented) + operation?: string; + // (undocumented) + provider?: string; + // (undocumented) + resource?: string; +} + +// @public (undocumented) +export interface OperationList { + nextLink?: string; + // (undocumented) + value?: OperationResponse[]; +} + +// @public +export interface OperationListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationListNextResponse = OperationList; + +// @public +export interface OperationListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationListResponse = OperationList; + +// @public (undocumented) +export interface OperationResponse { + display?: OperationDisplay; + isDataAction?: boolean; + name?: string; + origin?: string; + properties?: Record; +} + +// @public +export interface OperationResultError { + code?: string; + message?: string; +} + +// @public +export type OperationStatus = string; + +// @public (undocumented) +export interface Patch { + appliedScopes?: string[]; + appliedScopeType?: AppliedScopeType; + instanceFlexibility?: InstanceFlexibility; + name?: string; + renew?: boolean; + // (undocumented) + renewProperties?: PatchPropertiesRenewProperties; +} + +// @public (undocumented) +export interface PatchPropertiesRenewProperties { + // (undocumented) + purchaseProperties?: PurchaseRequest; +} + +// @public +export interface PaymentDetail { + billingAccount?: string; + billingCurrencyTotal?: Price; + dueDate?: Date; + // (undocumented) + extendedStatusInfo?: ExtendedStatusInfo; + paymentDate?: Date; + pricingCurrencyTotal?: Price; + status?: PaymentStatus; +} + +// @public +export type PaymentStatus = string; + +// @public (undocumented) +export interface Price { + // (undocumented) + amount?: number; + currencyCode?: string; +} + +// @public +export type ProvisioningState = string; + +// @public (undocumented) +export interface PurchaseRequest { + appliedScopes?: string[]; + appliedScopeType?: AppliedScopeType; + billingPlan?: ReservationBillingPlan; + billingScopeId?: string; + displayName?: string; + location?: string; + quantity?: number; + renew?: boolean; + reservedResourceProperties?: PurchaseRequestPropertiesReservedResourceProperties; + reservedResourceType?: ReservedResourceType; + // (undocumented) + sku?: SkuName; + term?: ReservationTerm; +} + +// @public +export interface PurchaseRequestPropertiesReservedResourceProperties { + instanceFlexibility?: InstanceFlexibility; +} + +// @public +export interface Quota { + beginCreateOrUpdate(subscriptionId: string, providerId: string, location: string, resourceName: string, createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaCreateOrUpdateOptionalParams): Promise, QuotaCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(subscriptionId: string, providerId: string, location: string, resourceName: string, createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaCreateOrUpdateOptionalParams): Promise; + beginUpdate(subscriptionId: string, providerId: string, location: string, resourceName: string, createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaUpdateOptionalParams): Promise, QuotaUpdateResponse>>; + beginUpdateAndWait(subscriptionId: string, providerId: string, location: string, resourceName: string, createQuotaRequest: CurrentQuotaLimitBase, options?: QuotaUpdateOptionalParams): Promise; + get(subscriptionId: string, providerId: string, location: string, resourceName: string, options?: QuotaGetOptionalParams): Promise; + list(subscriptionId: string, providerId: string, location: string, options?: QuotaListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface QuotaCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type QuotaCreateOrUpdateResponse = QuotaRequestOneResourceSubmitResponse; + +// @public +export interface QuotaGetHeaders { + eTag?: string; +} + +// @public +export interface QuotaGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type QuotaGetResponse = QuotaGetHeaders & CurrentQuotaLimitBase; + +// @public +export interface QuotaLimits { + nextLink?: string; + value?: CurrentQuotaLimitBase[]; +} + +// @public +export interface QuotaLimitsResponse { + nextLink?: string; + value?: CurrentQuotaLimit[]; +} + +// @public +export interface QuotaListHeaders { + eTag?: string; +} + +// @public +export interface QuotaListNextHeaders { + eTag?: string; +} + +// @public +export interface QuotaListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type QuotaListNextResponse = QuotaListNextHeaders & QuotaLimits; + +// @public +export interface QuotaListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type QuotaListResponse = QuotaListHeaders & QuotaLimits; + +// @public +export interface QuotaProperties { + readonly currentValue?: number; + limit?: number; + name?: ResourceName; + properties?: Record; + readonly quotaPeriod?: string; + resourceType?: ResourceType; + unit?: string; +} + +// @public +export interface QuotaRequestDetails { + readonly id?: string; + readonly message?: string; + readonly name?: string; + provisioningState?: QuotaRequestState; + readonly requestSubmitTime?: Date; + readonly type?: string; + value?: SubRequest[]; +} + +// @public +export interface QuotaRequestDetailsList { + nextLink?: string; + value?: QuotaRequestDetails[]; +} + +// @public +export interface QuotaRequestOneResourceSubmitResponse { + readonly id?: string; + readonly message?: string; + readonly name?: string; + properties?: QuotaProperties; + readonly provisioningState?: QuotaRequestState; + readonly requestSubmitTime?: Date; + readonly type?: string; +} + +// @public +export interface QuotaRequestProperties { + readonly message?: string; + provisioningState?: QuotaRequestState; + readonly requestSubmitTime?: Date; + value?: SubRequest[]; +} + +// @public +export type QuotaRequestState = string; + +// @public +export interface QuotaRequestStatus { + get(subscriptionId: string, providerId: string, location: string, id: string, options?: QuotaRequestStatusGetOptionalParams): Promise; + list(subscriptionId: string, providerId: string, location: string, options?: QuotaRequestStatusListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface QuotaRequestStatusGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type QuotaRequestStatusGetResponse = QuotaRequestDetails; + +// @public +export interface QuotaRequestStatusListNextOptionalParams extends coreClient.OperationOptions { + filter?: string; + skiptoken?: string; + top?: number; +} + +// @public +export type QuotaRequestStatusListNextResponse = QuotaRequestDetailsList; + +// @public +export interface QuotaRequestStatusListOptionalParams extends coreClient.OperationOptions { + filter?: string; + skiptoken?: string; + top?: number; +} + +// @public +export type QuotaRequestStatusListResponse = QuotaRequestDetailsList; + +// @public +export interface QuotaRequestSubmitResponse { + readonly id?: string; + readonly name?: string; + properties?: QuotaRequestProperties; + readonly type?: string; +} + +// @public +export interface QuotaRequestSubmitResponse201 { + readonly id?: string; + readonly message?: string; + readonly name?: string; + readonly provisioningState?: QuotaRequestState; + readonly type?: string; +} + +// @public +export interface QuotaUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type QuotaUpdateResponse = QuotaRequestOneResourceSubmitResponse; + +// @public (undocumented) +export interface RenewPropertiesResponse { + billingCurrencyTotal?: RenewPropertiesResponseBillingCurrencyTotal; + pricingCurrencyTotal?: RenewPropertiesResponsePricingCurrencyTotal; + // (undocumented) + purchaseProperties?: PurchaseRequest; +} + +// @public +export interface RenewPropertiesResponseBillingCurrencyTotal { + // (undocumented) + amount?: number; + currencyCode?: string; +} + +// @public +export interface RenewPropertiesResponsePricingCurrencyTotal { + // (undocumented) + amount?: number; + currencyCode?: string; +} + +// @public +export interface Reservation { + beginAvailableScopes(reservationOrderId: string, reservationId: string, body: AvailableScopeRequest, options?: ReservationAvailableScopesOptionalParams): Promise, ReservationAvailableScopesResponse>>; + beginAvailableScopesAndWait(reservationOrderId: string, reservationId: string, body: AvailableScopeRequest, options?: ReservationAvailableScopesOptionalParams): Promise; + beginMerge(reservationOrderId: string, body: MergeRequest, options?: ReservationMergeOptionalParams): Promise, ReservationMergeResponse>>; + beginMergeAndWait(reservationOrderId: string, body: MergeRequest, options?: ReservationMergeOptionalParams): Promise; + beginSplit(reservationOrderId: string, body: SplitRequest, options?: ReservationSplitOptionalParams): Promise, ReservationSplitResponse>>; + beginSplitAndWait(reservationOrderId: string, body: SplitRequest, options?: ReservationSplitOptionalParams): Promise; + beginUpdate(reservationOrderId: string, reservationId: string, parameters: Patch, options?: ReservationUpdateOptionalParams): Promise, ReservationUpdateResponse>>; + beginUpdateAndWait(reservationOrderId: string, reservationId: string, parameters: Patch, options?: ReservationUpdateOptionalParams): Promise; + get(reservationId: string, reservationOrderId: string, options?: ReservationGetOptionalParams): Promise; + list(reservationOrderId: string, options?: ReservationListOptionalParams): PagedAsyncIterableIterator; + listAll(options?: ReservationListAllOptionalParams): PagedAsyncIterableIterator; + listRevisions(reservationId: string, reservationOrderId: string, options?: ReservationListRevisionsOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ReservationAvailableScopesOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ReservationAvailableScopesResponse = AvailableScopeProperties; + +// @public +export type ReservationBillingPlan = string; + +// @public +export interface ReservationGetOptionalParams extends coreClient.OperationOptions { + expand?: string; +} + +// @public +export type ReservationGetResponse = ReservationResponse; + +// @public (undocumented) +export interface ReservationList { + nextLink?: string; + // (undocumented) + value?: ReservationResponse[]; +} + +// @public +export interface ReservationListAllNextOptionalParams extends coreClient.OperationOptions { + filter?: string; + orderby?: string; + refreshSummary?: string; + selectedState?: string; + skiptoken?: number; + take?: number; +} + +// @public +export type ReservationListAllNextResponse = ReservationsListResult; + +// @public +export interface ReservationListAllOptionalParams extends coreClient.OperationOptions { + filter?: string; + orderby?: string; + refreshSummary?: string; + selectedState?: string; + skiptoken?: number; + take?: number; +} + +// @public +export type ReservationListAllResponse = ReservationsListResult; + +// @public +export interface ReservationListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ReservationListNextResponse = ReservationList; + +// @public +export interface ReservationListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ReservationListResponse = ReservationList; + +// @public +export interface ReservationListRevisionsNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ReservationListRevisionsNextResponse = ReservationList; + +// @public +export interface ReservationListRevisionsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ReservationListRevisionsResponse = ReservationList; + +// @public +export interface ReservationMergeOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public (undocumented) +export interface ReservationMergeProperties { + mergeDestination?: string; + mergeSources?: string[]; +} + +// @public +export type ReservationMergeResponse = ReservationResponse[]; + +// @public +export interface ReservationOrder { + beginPurchase(reservationOrderId: string, body: PurchaseRequest, options?: ReservationOrderPurchaseOptionalParams): Promise, ReservationOrderPurchaseResponse>>; + beginPurchaseAndWait(reservationOrderId: string, body: PurchaseRequest, options?: ReservationOrderPurchaseOptionalParams): Promise; + calculate(body: PurchaseRequest, options?: ReservationOrderCalculateOptionalParams): Promise; + changeDirectory(reservationOrderId: string, body: ChangeDirectoryRequest, options?: ReservationOrderChangeDirectoryOptionalParams): Promise; + get(reservationOrderId: string, options?: ReservationOrderGetOptionalParams): Promise; + list(options?: ReservationOrderListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ReservationOrderBillingPlanInformation { + nextPaymentDueDate?: Date; + pricingCurrencyTotal?: Price; + startDate?: Date; + // (undocumented) + transactions?: PaymentDetail[]; +} + +// @public +export interface ReservationOrderCalculateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ReservationOrderCalculateResponse = CalculatePriceResponse; + +// @public +export interface ReservationOrderChangeDirectoryOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ReservationOrderChangeDirectoryResponse = ChangeDirectoryResponse; + +// @public +export interface ReservationOrderGetOptionalParams extends coreClient.OperationOptions { + expand?: string; +} + +// @public +export type ReservationOrderGetResponse = ReservationOrderResponse; + +// @public (undocumented) +export interface ReservationOrderList { + nextLink?: string; + // (undocumented) + value?: ReservationOrderResponse[]; +} + +// @public +export interface ReservationOrderListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ReservationOrderListNextResponse = ReservationOrderList; + +// @public +export interface ReservationOrderListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ReservationOrderListResponse = ReservationOrderList; + +// @public +export interface ReservationOrderPurchaseOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ReservationOrderPurchaseResponse = ReservationOrderResponse; + +// @public (undocumented) +export interface ReservationOrderResponse { + billingPlan?: ReservationBillingPlan; + createdDateTime?: Date; + displayName?: string; + // (undocumented) + etag?: number; + expiryDate?: Date; + readonly id?: string; + readonly name?: string; + originalQuantity?: number; + planInformation?: ReservationOrderBillingPlanInformation; + provisioningState?: ProvisioningState; + requestDateTime?: Date; + // (undocumented) + reservations?: ReservationResponse[]; + readonly systemData?: SystemData; + term?: ReservationTerm; + readonly type?: string; +} + +// @public +export interface ReservationResponse { + // (undocumented) + etag?: number; + readonly id?: string; + kind?: "Microsoft.Compute"; + location?: string; + readonly name?: string; + properties?: ReservationsProperties; + sku?: SkuName; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface ReservationsListResult { + readonly nextLink?: string; + summary?: ReservationSummary; + readonly value?: ReservationResponse[]; +} + +// @public +export interface ReservationSplitOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public (undocumented) +export interface ReservationSplitProperties { + splitDestinations?: string[]; + splitSource?: string; +} + +// @public +export type ReservationSplitResponse = ReservationResponse[]; + +// @public +export interface ReservationsProperties { + appliedScopes?: string[]; + appliedScopeType?: AppliedScopeType; + archived?: boolean; + billingPlan?: ReservationBillingPlan; + billingScopeId?: string; + capabilities?: string; + displayName?: string; + readonly displayProvisioningState?: string; + effectiveDateTime?: Date; + expiryDate?: Date; + extendedStatusInfo?: ExtendedStatusInfo; + instanceFlexibility?: InstanceFlexibility; + readonly lastUpdatedDateTime?: Date; + // (undocumented) + mergeProperties?: ReservationMergeProperties; + provisioningState?: ProvisioningState; + readonly provisioningSubState?: string; + purchaseDate?: Date; + quantity?: number; + renew?: boolean; + renewDestination?: string; + // (undocumented) + renewProperties?: RenewPropertiesResponse; + renewSource?: string; + reservedResourceType?: ReservedResourceType; + skuDescription?: string; + // (undocumented) + splitProperties?: ReservationSplitProperties; + term?: ReservationTerm; + readonly userFriendlyAppliedScopeType?: string; + readonly userFriendlyRenewState?: string; + readonly utilization?: ReservationsPropertiesUtilization; +} + +// @public +export interface ReservationsPropertiesUtilization { + aggregates?: ReservationUtilizationAggregates[]; + readonly trend?: string; +} + +// @public +export type ReservationStatusCode = string; + +// @public +export interface ReservationSummary { + readonly cancelledCount?: number; + readonly expiredCount?: number; + readonly expiringCount?: number; + readonly failedCount?: number; + readonly pendingCount?: number; + readonly succeededCount?: number; +} + +// @public +export type ReservationTerm = string; + +// @public +export interface ReservationToExchange { + billingInformation?: BillingInformation; + // (undocumented) + billingRefundAmount?: Price; + quantity?: number; + reservationId?: string; +} + +// @public +export interface ReservationToPurchaseCalculateExchange { + // (undocumented) + billingCurrencyTotal?: Price; + // (undocumented) + properties?: PurchaseRequest; +} + +// @public +export interface ReservationToPurchaseExchange { + // (undocumented) + billingCurrencyTotal?: Price; + // (undocumented) + properties?: PurchaseRequest; + reservationId?: string; + reservationOrderId?: string; + status?: OperationStatus; +} + +// @public +export interface ReservationToReturn { + quantity?: number; + reservationId?: string; +} + +// @public +export interface ReservationToReturnForExchange { + billingInformation?: BillingInformation; + // (undocumented) + billingRefundAmount?: Price; + quantity?: number; + reservationId?: string; + status?: OperationStatus; +} + +// @public +export interface ReservationUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ReservationUpdateResponse = ReservationResponse; + +// @public +export interface ReservationUtilizationAggregates { + readonly grain?: number; + readonly grainUnit?: string; + readonly value?: number; + readonly valueUnit?: string; +} + +// @public +export type ReservedResourceType = string; + +// @public +export interface ResourceName { + readonly localizedValue?: string; + value?: string; +} + +// @public +export type ResourceType = string; + +// @public (undocumented) +export interface ScopeProperties { + // (undocumented) + scope?: string; + // (undocumented) + valid?: boolean; +} + +// @public +export interface ServiceError { + code?: string; + readonly details?: ServiceErrorDetail[]; + message?: string; +} + +// @public +export interface ServiceErrorDetail { + readonly code?: string; + readonly message?: string; +} + +// @public (undocumented) +export interface SkuCapability { + name?: string; + value?: string; +} + +// @public (undocumented) +export interface SkuName { + // (undocumented) + name?: string; +} + +// @public (undocumented) +export interface SkuProperty { + name?: string; + value?: string; +} + +// @public (undocumented) +export interface SkuRestriction { + reasonCode?: string; + type?: string; + values?: string[]; +} + +// @public (undocumented) +export interface SplitRequest { + quantities?: number[]; + reservationId?: string; +} + +// @public +export interface SubRequest { + readonly limit?: number; + readonly message?: string; + name?: ResourceName; + provisioningState?: QuotaRequestState; + readonly resourceType?: string; + readonly subRequestId?: string; + unit?: string; +} + +// @public (undocumented) +export interface SubscriptionScopeProperties { + // (undocumented) + scopes?: ScopeProperties[]; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export type UserFriendlyAppliedScopeType = string; + +// @public +export type UserFriendlyRenewState = string; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/reservations/arm-reservations/rollup.config.js b/sdk/reservations/arm-reservations/rollup.config.js index 254b7e0e555..9be1955eb7f 100644 --- a/sdk/reservations/arm-reservations/rollup.config.js +++ b/sdk/reservations/arm-reservations/rollup.config.js @@ -1,37 +1,188 @@ -import rollup from "rollup"; -import nodeResolve from "rollup-plugin-node-resolve"; -import sourcemaps from "rollup-plugin-sourcemaps"; - -/** - * @type {rollup.RollupFileOptions} - */ -const config = { - input: "./esm/azureReservationAPI.js", - external: [ - "@azure/ms-rest-js", - "@azure/ms-rest-azure-js" - ], - output: { - file: "./dist/arm-reservations.js", - format: "umd", - name: "Azure.ArmReservations", - sourcemap: true, - globals: { - "@azure/ms-rest-js": "msRest", - "@azure/ms-rest-azure-js": "msRestAzure" - }, - banner: `/* +/* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */` - }, - plugins: [ - nodeResolve({ mainFields: ['module', 'main'] }), - sourcemaps() - ] + */ + +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"; + +/** + * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. + * + * NOTE: this manual configuration is only needed because OpenTelemetry uses an + * __exportStar downleveled helper function to declare its exports which confuses + * rollup's automatic discovery mechanism. + * + * @returns an object reference that can be `...`'d into your cjs() configuration. + */ +export function openTelemetryCommonJs() { + const namedExports = {}; + + for (const key of [ + "@opentelemetry/api", + "@azure/core-tracing/node_modules/@opentelemetry/api" + ]) { + namedExports[key] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "SpanStatusCode", + "getSpanContext", + "setSpanContext" + ]; + } + + const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; + + for (const version of releasedOpenTelemetryVersions) { + namedExports[ + // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. + `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` + ] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "StatusCode", + "CanonicalCode", + "getSpanContext", + "setSpanContext" + ]; + } + + return namedExports; +} + +// #region Warning Handler + +/** + * A function that can determine whether a rollupwarning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEvalWarnings(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependencyWarnings(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ + ignoreChaiCircularDependencyWarnings, + ignoreNiseSinonEvalWarnings +]; + +/** + * 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({ + namedExports: { + // Chai's strange internal architecture makes it impossible to statically + // analyze its exports. + chai: [ + "version", + "use", + "util", + "config", + "expect", + "should", + "assert" + ], + ...openTelemetryCommonJs() + } + }), + 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 default config; +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(), cjs()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/reservations/arm-reservations/sample.env b/sdk/reservations/arm-reservations/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/reservations/arm-reservations/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/reservations/arm-reservations/samples-dev/appliedReservationList.ts b/sdk/reservations/arm-reservations/samples-dev/appliedReservationList.ts new file mode 100644 index 00000000000..bdfa150f90f --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/appliedReservationList.ts @@ -0,0 +1,28 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get applicable `Reservation`s that are applied to this subscription or a resource group under this subscription. + * + * @summary Get applicable `Reservation`s that are applied to this subscription or a resource group under this subscription. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetAppliedReservations.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function appliedReservationList() { + const subscriptionId = "23bc208b-083f-4901-ae85-4f98c0c3b4b6"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.getAppliedReservationList(subscriptionId); + console.log(result); +} + +appliedReservationList().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/availableScopes.ts b/sdk/reservations/arm-reservations/samples-dev/availableScopes.ts new file mode 100644 index 00000000000..efe120d2727 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/availableScopes.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get Available Scopes for `Reservation`. + + * + * @summary Get Available Scopes for `Reservation`. + + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetAvailableScope.json + */ +import { + AvailableScopeRequest, + AzureReservationAPI +} from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function availableScopes() { + const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const reservationId = "356e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const body: AvailableScopeRequest = { + properties: { + scopes: ["/subscriptions/efc7c997-7700-4a74-b731-55aec16c15e9"] + } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservation.beginAvailableScopesAndWait( + reservationOrderId, + reservationId, + body + ); + console.log(result); +} + +availableScopes().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/calculateExchange.ts b/sdk/reservations/arm-reservations/samples-dev/calculateExchange.ts new file mode 100644 index 00000000000..1520b2ec073 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/calculateExchange.ts @@ -0,0 +1,59 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Calculates price for exchanging `Reservations` if there are no policy errors. + + * + * @summary Calculates price for exchanging `Reservations` if there are no policy errors. + + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/CalculateExchange.json + */ +import { + CalculateExchangeRequest, + AzureReservationAPI +} from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function calculateExchange() { + const body: CalculateExchangeRequest = { + properties: { + reservationsToExchange: [ + { + quantity: 1, + reservationId: + "/providers/microsoft.capacity/reservationOrders/1f14354c-dc12-4c8d-8090-6f295a3a34aa/reservations/c8c926bd-fc5d-4e29-9d43-b68340ac23a6" + } + ], + reservationsToPurchase: [ + { + appliedScopeType: "Shared", + appliedScopes: [], + billingPlan: "Upfront", + billingScopeId: "/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83", + displayName: "testDisplayName", + location: "westus", + quantity: 1, + renew: false, + reservedResourceProperties: { instanceFlexibility: "On" }, + reservedResourceType: "VirtualMachines", + sku: { name: "Standard_B1ls" }, + term: "P1Y" + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.calculateExchange.beginPostAndWait(body); + console.log(result); +} + +calculateExchange().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/catalog.ts b/sdk/reservations/arm-reservations/samples-dev/catalog.ts new file mode 100644 index 00000000000..c1f824cfd18 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/catalog.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the regions and skus that are available for RI purchase for the specified Azure subscription. + * + * @summary Get the regions and skus that are available for RI purchase for the specified Azure subscription. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetCatalog.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function catalog() { + const subscriptionId = "23bc208b-083f-4901-ae85-4f98c0c3b4b6"; + const reservedResourceType = "VirtualMachines"; + const location = "eastus"; + const options = { + reservedResourceType: reservedResourceType, + location: location + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.getCatalog(subscriptionId, options); + console.log(result); +} + +catalog().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/changeDirectory.ts b/sdk/reservations/arm-reservations/samples-dev/changeDirectory.ts new file mode 100644 index 00000000000..8220f499c52 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/changeDirectory.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id + * + * @summary Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/ChangeDirectoryReservationOrder.json + */ +import { + ChangeDirectoryRequest, + AzureReservationAPI +} from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function changeDirectory() { + const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; + const body: ChangeDirectoryRequest = { + destinationTenantId: "906655ea-30be-4587-9d12-b50e077b0f32" + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservationOrder.changeDirectory( + reservationOrderId, + body + ); + console.log(result); +} + +changeDirectory().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/exchange.ts b/sdk/reservations/arm-reservations/samples-dev/exchange.ts new file mode 100644 index 00000000000..9e27efeee4d --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/exchange.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + + * + * @summary Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/Exchange.json + */ +import { ExchangeRequest, AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function exchange() { + const body: ExchangeRequest = { + properties: { sessionId: "66e2ac8f-439e-4345-8235-6fef07608081" } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.exchange.beginPostAndWait(body); + console.log(result); +} + +exchange().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/getOperations.ts b/sdk/reservations/arm-reservations/samples-dev/getOperations.ts new file mode 100644 index 00000000000..50802236b3c --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/getOperations.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List all the operations. + * + * @summary List all the operations. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetOperations.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getOperations() { + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const resArray = new Array(); + for await (let item of client.operation.list()) { + resArray.push(item); + } + console.log(resArray); +} + +getOperations().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/getReservation.ts b/sdk/reservations/arm-reservations/samples-dev/getReservation.ts new file mode 100644 index 00000000000..a2ed05c49a0 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/getReservation.ts @@ -0,0 +1,28 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the details of the `ReservationOrder`. + * + * @summary Get the details of the `ReservationOrder`. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrderDetails.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getReservation() { + const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservationOrder.get(reservationOrderId); + console.log(result); +} + +getReservation().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/getReservationWithExpandPayments.ts b/sdk/reservations/arm-reservations/samples-dev/getReservationWithExpandPayments.ts new file mode 100644 index 00000000000..0bdd987bcd7 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/getReservationWithExpandPayments.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the details of the `ReservationOrder`. + * + * @summary Get the details of the `ReservationOrder`. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getReservationWithExpandPayments() { + const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; + const expand = "schedule"; + const options = { expand: expand }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservationOrder.get(reservationOrderId, options); + console.log(result); +} + +getReservationWithExpandPayments().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/merge.ts b/sdk/reservations/arm-reservations/samples-dev/merge.ts new file mode 100644 index 00000000000..45fef291f84 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/merge.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have same properties. + * + * @summary Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have same properties. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/MergeReservations.json + */ +import { MergeRequest, AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function merge() { + const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const body: MergeRequest = { + sources: [ + "/providers/Microsoft.Capacity/reservationOrders/c0565a8a-4491-4e77-b07b-5e6d66718e1c/reservations/cea04232-932e-47db-acb5-e29a945ecc73", + "/providers/Microsoft.Capacity/reservationOrders/c0565a8a-4491-4e77-b07b-5e6d66718e1c/reservations/5bf54dc7-dacd-4f46-a16b-7b78f4a59799" + ] + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservation.beginMergeAndWait( + reservationOrderId, + body + ); + console.log(result); +} + +merge().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/patchReservation.ts b/sdk/reservations/arm-reservations/samples-dev/patchReservation.ts new file mode 100644 index 00000000000..3d1d5e645c4 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/patchReservation.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Updates the applied scopes of the `Reservation`. + * + * @summary Updates the applied scopes of the `Reservation`. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/UpdateReservation.json + */ +import { Patch, AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function patchReservation() { + const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc"; + const parameters: Patch = { + appliedScopeType: "Shared", + instanceFlexibility: "Off" + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservation.beginUpdateAndWait( + reservationOrderId, + reservationId, + parameters + ); + console.log(result); +} + +patchReservation().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/purchase.ts b/sdk/reservations/arm-reservations/samples-dev/purchase.ts new file mode 100644 index 00000000000..8c6780772a0 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/purchase.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Purchase `ReservationOrder` and create resource under the specified URI. + * + * @summary Purchase `ReservationOrder` and create resource under the specified URI. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/PurchaseReservationOrder.json + */ +import { PurchaseRequest, AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function purchase() { + const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; + const body: PurchaseRequest = { + appliedScopeType: "Shared", + appliedScopes: [], + billingPlan: "Monthly", + billingScopeId: "/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83", + displayName: "TestReservationOrder", + location: "westus", + quantity: 1, + renew: false, + reservedResourceProperties: { instanceFlexibility: "On" }, + reservedResourceType: "VirtualMachines", + sku: { name: "standard_D1" }, + term: "P1Y" + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservationOrder.beginPurchaseAndWait( + reservationOrderId, + body + ); + console.log(result); +} + +purchase().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/quotaRequestFailed.ts b/sdk/reservations/arm-reservations/samples-dev/quotaRequestFailed.ts new file mode 100644 index 00000000000..494ded8854c --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/quotaRequestFailed.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. + * + * @summary For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusFailed.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotaRequestFailed() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const id = "2B5C8515-37D8-4B6A-879B-CD641A2CF605"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quotaRequestStatus.get( + subscriptionId, + providerId, + location, + id + ); + console.log(result); +} + +quotaRequestFailed().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/quotaRequestHistory.ts b/sdk/reservations/arm-reservations/samples-dev/quotaRequestHistory.ts new file mode 100644 index 00000000000..d80db8a7dae --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/quotaRequestHistory.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to For the specified Azure region (location), subscription, and resource provider, get the history of the quota requests for the past year. To select specific quota requests, use the oData filter. + * + * @summary For the specified Azure region (location), subscription, and resource provider, get the history of the quota requests for the past year. To select specific quota requests, use the oData filter. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestsHistory.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotaRequestHistory() { + const subscriptionId = "3f75fdf7-977e-44ad-990d-99f14f0f299f"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const resArray = new Array(); + for await (let item of client.quotaRequestStatus.list( + subscriptionId, + providerId, + location + )) { + resArray.push(item); + } + console.log(resArray); +} + +quotaRequestHistory().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/quotaRequestInProgress.ts b/sdk/reservations/arm-reservations/samples-dev/quotaRequestInProgress.ts new file mode 100644 index 00000000000..922eb4e18ac --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/quotaRequestInProgress.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. + * + * @summary For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusInProgress.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotaRequestInProgress() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const id = "2B5C8515-37D8-4B6A-879B-CD641A2CF605"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quotaRequestStatus.get( + subscriptionId, + providerId, + location, + id + ); + console.log(result); +} + +quotaRequestInProgress().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/quotaRequestStatus.ts b/sdk/reservations/arm-reservations/samples-dev/quotaRequestStatus.ts new file mode 100644 index 00000000000..36d99733050 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/quotaRequestStatus.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. + * + * @summary For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusById.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotaRequestStatus() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const id = "2B5C8515-37D8-4B6A-879B-CD641A2CF605"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quotaRequestStatus.get( + subscriptionId, + providerId, + location, + id + ); + console.log(result); +} + +quotaRequestStatus().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/quotasListUsagesForCompute.ts b/sdk/reservations/arm-reservations/samples-dev/quotasListUsagesForCompute.ts new file mode 100644 index 00000000000..d9785128cda --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/quotasListUsagesForCompute.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates. + * + * @summary Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeUsages.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotasListUsagesForCompute() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const resArray = new Array(); + for await (let item of client.quota.list( + subscriptionId, + providerId, + location + )) { + resArray.push(item); + } + console.log(resArray); +} + +quotasListUsagesForCompute().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/quotasListUsagesMachineLearningServices.ts b/sdk/reservations/arm-reservations/samples-dev/quotasListUsagesMachineLearningServices.ts new file mode 100644 index 00000000000..3d7a76aaefe --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/quotasListUsagesMachineLearningServices.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates. + * + * @summary Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getMachineLearningServicesUsages.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotasListUsagesMachineLearningServices() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const providerId = "Microsoft.MachineLearningServices"; + const location = "eastus"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const resArray = new Array(); + for await (let item of client.quota.list( + subscriptionId, + providerId, + location + )) { + resArray.push(item); + } + console.log(resArray); +} + +quotasListUsagesMachineLearningServices().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/quotasRequestForCompute.ts b/sdk/reservations/arm-reservations/samples-dev/quotasRequestForCompute.ts new file mode 100644 index 00000000000..50288d66ae7 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/quotasRequestForCompute.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota update request. + * + * @summary Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota update request. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeOneSkuUsages.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotasRequestForCompute() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const resourceName = "standardNDSFamily"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quota.get( + subscriptionId, + providerId, + location, + resourceName + ); + console.log(result); +} + +quotasRequestForCompute().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/quotasRequestPatchForCompute.ts b/sdk/reservations/arm-reservations/samples-dev/quotasRequestPatchForCompute.ts new file mode 100644 index 00000000000..4104b59b3f5 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/quotasRequestPatchForCompute.ts @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Update the quota (service limits) of this resource to the requested value. + + • To get the quota information for specific resource, send a GET request. + + • To increase the quota, update the limit field from the GET response to a new value. + + • To update the quota value, submit the JSON response to the quota request API to update the quota. + • To update the quota. use the PATCH operation. + * + * @summary Update the quota (service limits) of this resource to the requested value. + + • To get the quota information for specific resource, send a GET request. + + • To increase the quota, update the limit field from the GET response to a new value. + + • To update the quota value, submit the JSON response to the quota request API to update the quota. + • To update the quota. use the PATCH operation. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/patchComputeQuotaRequest.json + */ +import { + CurrentQuotaLimitBase, + AzureReservationAPI +} from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotasRequestPatchForCompute() { + const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const resourceName = "standardFSv2Family"; + const createQuotaRequest: CurrentQuotaLimitBase = { + properties: { + name: { value: "standardFSv2Family" }, + limit: 200, + unit: "Count" + } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quota.beginUpdateAndWait( + subscriptionId, + providerId, + location, + resourceName, + createQuotaRequest + ); + console.log(result); +} + +quotasRequestPatchForCompute().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/quotasRequestPutForCompute.ts b/sdk/reservations/arm-reservations/samples-dev/quotasRequestPutForCompute.ts new file mode 100644 index 00000000000..cfcae142b4d --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/quotasRequestPutForCompute.ts @@ -0,0 +1,63 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update the quota (service limits) of a resource to the requested value. + Steps: + + 1. Make the Get request to get the quota information for specific resource. + + 2. To increase the quota, update the limit field in the response from Get request to new value. + + 3. Submit the JSON to the quota request API to update the quota. + The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @summary Create or update the quota (service limits) of a resource to the requested value. + Steps: + + 1. Make the Get request to get the quota information for specific resource. + + 2. To increase the quota, update the limit field in the response from Get request to new value. + + 3. Submit the JSON to the quota request API to update the quota. + The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putComputeOneSkuQuotaRequest.json + */ +import { + CurrentQuotaLimitBase, + AzureReservationAPI +} from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotasRequestPutForCompute() { + const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const resourceName = "standardFSv2Family"; + const createQuotaRequest: CurrentQuotaLimitBase = { + properties: { + name: { value: "standardFSv2Family" }, + limit: 200, + unit: "Count" + } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quota.beginCreateOrUpdateAndWait( + subscriptionId, + providerId, + location, + resourceName, + createQuotaRequest + ); + console.log(result); +} + +quotasRequestPutForCompute().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/quotasRequestPutForMachineLearningServicesDedicatedResource.ts b/sdk/reservations/arm-reservations/samples-dev/quotasRequestPutForMachineLearningServicesDedicatedResource.ts new file mode 100644 index 00000000000..9345e85631e --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/quotasRequestPutForMachineLearningServicesDedicatedResource.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update the quota (service limits) of a resource to the requested value. + Steps: + + 1. Make the Get request to get the quota information for specific resource. + + 2. To increase the quota, update the limit field in the response from Get request to new value. + + 3. Submit the JSON to the quota request API to update the quota. + The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @summary Create or update the quota (service limits) of a resource to the requested value. + Steps: + + 1. Make the Get request to get the quota information for specific resource. + + 2. To increase the quota, update the limit field in the response from Get request to new value. + + 3. Submit the JSON to the quota request API to update the quota. + The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestDedicated.json + */ +import { + CurrentQuotaLimitBase, + AzureReservationAPI +} from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotasRequestPutForMachineLearningServicesDedicatedResource() { + const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3"; + const providerId = "Microsoft.MachineLearningServices"; + const location = "eastus"; + const resourceName = "StandardDv2Family"; + const createQuotaRequest: CurrentQuotaLimitBase = { + properties: { + name: { value: "StandardDv2Family" }, + limit: 200, + resourceType: "dedicated", + unit: "Count" + } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quota.beginCreateOrUpdateAndWait( + subscriptionId, + providerId, + location, + resourceName, + createQuotaRequest + ); + console.log(result); +} + +quotasRequestPutForMachineLearningServicesDedicatedResource().catch( + console.error +); diff --git a/sdk/reservations/arm-reservations/samples-dev/quotasRequestPutForMachineLearningServicesLowPriorityResource.ts b/sdk/reservations/arm-reservations/samples-dev/quotasRequestPutForMachineLearningServicesLowPriorityResource.ts new file mode 100644 index 00000000000..8d21249dfbb --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/quotasRequestPutForMachineLearningServicesLowPriorityResource.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update the quota (service limits) of a resource to the requested value. + Steps: + + 1. Make the Get request to get the quota information for specific resource. + + 2. To increase the quota, update the limit field in the response from Get request to new value. + + 3. Submit the JSON to the quota request API to update the quota. + The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @summary Create or update the quota (service limits) of a resource to the requested value. + Steps: + + 1. Make the Get request to get the quota information for specific resource. + + 2. To increase the quota, update the limit field in the response from Get request to new value. + + 3. Submit the JSON to the quota request API to update the quota. + The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestLowPriority.json + */ +import { + CurrentQuotaLimitBase, + AzureReservationAPI +} from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotasRequestPutForMachineLearningServicesLowPriorityResource() { + const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3"; + const providerId = "Microsoft.MachineLearningServices"; + const location = "eastus"; + const resourceName = "TotalLowPriorityCores"; + const createQuotaRequest: CurrentQuotaLimitBase = { + properties: { + name: { value: "TotalLowPriorityCores" }, + limit: 200, + resourceType: "lowPriority", + unit: "Count" + } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quota.beginCreateOrUpdateAndWait( + subscriptionId, + providerId, + location, + resourceName, + createQuotaRequest + ); + console.log(result); +} + +quotasRequestPutForMachineLearningServicesLowPriorityResource().catch( + console.error +); diff --git a/sdk/reservations/arm-reservations/samples-dev/reservationList.ts b/sdk/reservations/arm-reservations/samples-dev/reservationList.ts new file mode 100644 index 00000000000..3947d3c2e14 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/reservationList.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List `Reservation`s within a single `ReservationOrder`. + * + * @summary List `Reservation`s within a single `ReservationOrder`. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationsFromOrder.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function reservationList() { + const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const resArray = new Array(); + for await (let item of client.reservation.list(reservationOrderId)) { + resArray.push(item); + } + console.log(resArray); +} + +reservationList().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/reservationOrderList.ts b/sdk/reservations/arm-reservations/samples-dev/reservationOrderList.ts new file mode 100644 index 00000000000..e41e72b25bf --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/reservationOrderList.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List of all the `ReservationOrder`s that the user has access to in the current tenant. + * + * @summary List of all the `ReservationOrder`s that the user has access to in the current tenant. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrders.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function reservationOrderList() { + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const resArray = new Array(); + for await (let item of client.reservationOrder.list()) { + resArray.push(item); + } + console.log(resArray); +} + +reservationOrderList().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/reservationRevisions.ts b/sdk/reservations/arm-reservations/samples-dev/reservationRevisions.ts new file mode 100644 index 00000000000..51f5383c949 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/reservationRevisions.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List of all the revisions for the `Reservation`. + * + * @summary List of all the revisions for the `Reservation`. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationRevisions.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function reservationRevisions() { + const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc"; + const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const resArray = new Array(); + for await (let item of client.reservation.listRevisions( + reservationId, + reservationOrderId + )) { + resArray.push(item); + } + console.log(resArray); +} + +reservationRevisions().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples-dev/split.ts b/sdk/reservations/arm-reservations/samples-dev/split.ts new file mode 100644 index 00000000000..d070a1c45d7 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples-dev/split.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * + * @summary Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/SplitReservation.json + */ +import { SplitRequest, AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function split() { + const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const body: SplitRequest = { + quantities: [1, 2], + reservationId: + "/providers/Microsoft.Capacity/reservationOrders/276e7ae4-84d0-4da6-ab4b-d6b94f3557da/reservations/bcae77cd-3119-4766-919f-b50d36c75c7a" + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservation.beginSplitAndWait( + reservationOrderId, + body + ); + console.log(result); +} + +split().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/README.md b/sdk/reservations/arm-reservations/samples/v7/javascript/README.md new file mode 100644 index 00000000000..0422910a9a5 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/README.md @@ -0,0 +1,102 @@ +# client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [appliedReservationList.js][appliedreservationlist] | Get applicable `Reservation`s that are applied to this subscription or a resource group under this subscription. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetAppliedReservations.json | +| [availableScopes.js][availablescopes] | Get Available Scopes for `Reservation`. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetAvailableScope.json | +| [calculateExchange.js][calculateexchange] | Calculates price for exchanging `Reservations` if there are no policy errors. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/CalculateExchange.json | +| [catalog.js][catalog] | Get the regions and skus that are available for RI purchase for the specified Azure subscription. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetCatalog.json | +| [changeDirectory.js][changedirectory] | Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/ChangeDirectoryReservationOrder.json | +| [exchange.js][exchange] | Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/Exchange.json | +| [getOperations.js][getoperations] | List all the operations. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetOperations.json | +| [getReservation.js][getreservation] | Get the details of the `ReservationOrder`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrderDetails.json | +| [getReservationWithExpandPayments.js][getreservationwithexpandpayments] | Get the details of the `ReservationOrder`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json | +| [merge.js][merge] | Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have same properties. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/MergeReservations.json | +| [patchReservation.js][patchreservation] | Updates the applied scopes of the `Reservation`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/UpdateReservation.json | +| [purchase.js][purchase] | Purchase `ReservationOrder` and create resource under the specified URI. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/PurchaseReservationOrder.json | +| [quotaRequestFailed.js][quotarequestfailed] | For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusFailed.json | +| [quotaRequestHistory.js][quotarequesthistory] | For the specified Azure region (location), subscription, and resource provider, get the history of the quota requests for the past year. To select specific quota requests, use the oData filter. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestsHistory.json | +| [quotaRequestInProgress.js][quotarequestinprogress] | For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusInProgress.json | +| [quotaRequestStatus.js][quotarequeststatus] | For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusById.json | +| [quotasListUsagesForCompute.js][quotaslistusagesforcompute] | Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeUsages.json | +| [quotasListUsagesMachineLearningServices.js][quotaslistusagesmachinelearningservices] | Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getMachineLearningServicesUsages.json | +| [quotasRequestForCompute.js][quotasrequestforcompute] | Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota update request. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeOneSkuUsages.json | +| [quotasRequestPatchForCompute.js][quotasrequestpatchforcompute] | Update the quota (service limits) of this resource to the requested value. //@@TS-MAGIC-NEWLINE@@ • To get the quota information for specific resource, send a GET request. //@@TS-MAGIC-NEWLINE@@ • To increase the quota, update the limit field from the GET response to a new value. //@@TS-MAGIC-NEWLINE@@ • To update the quota value, submit the JSON response to the quota request API to update the quota. • To update the quota. use the PATCH operation. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/patchComputeQuotaRequest.json | +| [quotasRequestPutForCompute.js][quotasrequestputforcompute] | Create or update the quota (service limits) of a resource to the requested value. Steps: //@@TS-MAGIC-NEWLINE@@ 1. Make the Get request to get the quota information for specific resource. //@@TS-MAGIC-NEWLINE@@ 2. To increase the quota, update the limit field in the response from Get request to new value. //@@TS-MAGIC-NEWLINE@@ 3. Submit the JSON to the quota request API to update the quota. The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putComputeOneSkuQuotaRequest.json | +| [quotasRequestPutForMachineLearningServicesDedicatedResource.js][quotasrequestputformachinelearningservicesdedicatedresource] | Create or update the quota (service limits) of a resource to the requested value. Steps: //@@TS-MAGIC-NEWLINE@@ 1. Make the Get request to get the quota information for specific resource. //@@TS-MAGIC-NEWLINE@@ 2. To increase the quota, update the limit field in the response from Get request to new value. //@@TS-MAGIC-NEWLINE@@ 3. Submit the JSON to the quota request API to update the quota. The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestDedicated.json | +| [quotasRequestPutForMachineLearningServicesLowPriorityResource.js][quotasrequestputformachinelearningserviceslowpriorityresource] | Create or update the quota (service limits) of a resource to the requested value. Steps: //@@TS-MAGIC-NEWLINE@@ 1. Make the Get request to get the quota information for specific resource. //@@TS-MAGIC-NEWLINE@@ 2. To increase the quota, update the limit field in the response from Get request to new value. //@@TS-MAGIC-NEWLINE@@ 3. Submit the JSON to the quota request API to update the quota. The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestLowPriority.json | +| [reservationList.js][reservationlist] | List `Reservation`s within a single `ReservationOrder`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationsFromOrder.json | +| [reservationOrderList.js][reservationorderlist] | List of all the `ReservationOrder`s that the user has access to in the current tenant. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrders.json | +| [reservationRevisions.js][reservationrevisions] | List of all the revisions for the `Reservation`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationRevisions.json | +| [split.js][split] | Split a `Reservation` into two `Reservation`s with specified quantity distribution. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/SplitReservation.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node appliedReservationList.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node appliedReservationList.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[appliedreservationlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/appliedReservationList.js +[availablescopes]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/availableScopes.js +[calculateexchange]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/calculateExchange.js +[catalog]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/catalog.js +[changedirectory]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/changeDirectory.js +[exchange]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/exchange.js +[getoperations]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/getOperations.js +[getreservation]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/getReservation.js +[getreservationwithexpandpayments]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/getReservationWithExpandPayments.js +[merge]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/merge.js +[patchreservation]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/patchReservation.js +[purchase]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/purchase.js +[quotarequestfailed]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestFailed.js +[quotarequesthistory]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestHistory.js +[quotarequestinprogress]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestInProgress.js +[quotarequeststatus]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestStatus.js +[quotaslistusagesforcompute]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotasListUsagesForCompute.js +[quotaslistusagesmachinelearningservices]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotasListUsagesMachineLearningServices.js +[quotasrequestforcompute]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestForCompute.js +[quotasrequestpatchforcompute]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPatchForCompute.js +[quotasrequestputforcompute]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPutForCompute.js +[quotasrequestputformachinelearningservicesdedicatedresource]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPutForMachineLearningServicesDedicatedResource.js +[quotasrequestputformachinelearningserviceslowpriorityresource]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPutForMachineLearningServicesLowPriorityResource.js +[reservationlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationList.js +[reservationorderlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderList.js +[reservationrevisions]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/reservationRevisions.js +[split]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/javascript/split.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-reservations?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/reservations/arm-reservations/README.md diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/appliedReservationList.js b/sdk/reservations/arm-reservations/samples/v7/javascript/appliedReservationList.js new file mode 100644 index 00000000000..44c3e16cdbe --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/appliedReservationList.js @@ -0,0 +1,28 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get applicable `Reservation`s that are applied to this subscription or a resource group under this subscription. + * + * @summary Get applicable `Reservation`s that are applied to this subscription or a resource group under this subscription. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetAppliedReservations.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function appliedReservationList() { + const subscriptionId = "23bc208b-083f-4901-ae85-4f98c0c3b4b6"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.getAppliedReservationList(subscriptionId); + console.log(result); +} + +appliedReservationList().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/availableScopes.js b/sdk/reservations/arm-reservations/samples/v7/javascript/availableScopes.js new file mode 100644 index 00000000000..b07e992939b --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/availableScopes.js @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get Available Scopes for `Reservation`. + + * + * @summary Get Available Scopes for `Reservation`. + + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetAvailableScope.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function availableScopes() { + const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const reservationId = "356e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const body = { + properties: { + scopes: ["/subscriptions/efc7c997-7700-4a74-b731-55aec16c15e9"], + }, + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservation.beginAvailableScopesAndWait( + reservationOrderId, + reservationId, + body + ); + console.log(result); +} + +availableScopes().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/calculateExchange.js b/sdk/reservations/arm-reservations/samples/v7/javascript/calculateExchange.js new file mode 100644 index 00000000000..c24f79b5344 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/calculateExchange.js @@ -0,0 +1,56 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Calculates price for exchanging `Reservations` if there are no policy errors. + + * + * @summary Calculates price for exchanging `Reservations` if there are no policy errors. + + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/CalculateExchange.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function calculateExchange() { + const body = { + properties: { + reservationsToExchange: [ + { + quantity: 1, + reservationId: + "/providers/microsoft.capacity/reservationOrders/1f14354c-dc12-4c8d-8090-6f295a3a34aa/reservations/c8c926bd-fc5d-4e29-9d43-b68340ac23a6", + }, + ], + reservationsToPurchase: [ + { + appliedScopeType: "Shared", + appliedScopes: [], + billingPlan: "Upfront", + billingScopeId: "/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83", + displayName: "testDisplayName", + location: "westus", + quantity: 1, + renew: false, + reservedResourceProperties: { instanceFlexibility: "On" }, + reservedResourceType: "VirtualMachines", + sku: { name: "Standard_B1ls" }, + term: "P1Y", + }, + ], + }, + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.calculateExchange.beginPostAndWait(body); + console.log(result); +} + +calculateExchange().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/catalog.js b/sdk/reservations/arm-reservations/samples/v7/javascript/catalog.js new file mode 100644 index 00000000000..63512231cea --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/catalog.js @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the regions and skus that are available for RI purchase for the specified Azure subscription. + * + * @summary Get the regions and skus that are available for RI purchase for the specified Azure subscription. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetCatalog.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function catalog() { + const subscriptionId = "23bc208b-083f-4901-ae85-4f98c0c3b4b6"; + const reservedResourceType = "VirtualMachines"; + const location = "eastus"; + const options = { + reservedResourceType: reservedResourceType, + location: location, + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.getCatalog(subscriptionId, options); + console.log(result); +} + +catalog().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/changeDirectory.js b/sdk/reservations/arm-reservations/samples/v7/javascript/changeDirectory.js new file mode 100644 index 00000000000..fec4c0a154d --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/changeDirectory.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id + * + * @summary Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/ChangeDirectoryReservationOrder.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function changeDirectory() { + const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; + const body = { + destinationTenantId: "906655ea-30be-4587-9d12-b50e077b0f32", + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservationOrder.changeDirectory(reservationOrderId, body); + console.log(result); +} + +changeDirectory().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/exchange.js b/sdk/reservations/arm-reservations/samples/v7/javascript/exchange.js new file mode 100644 index 00000000000..0bfdc00e006 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/exchange.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + + * + * @summary Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/Exchange.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function exchange() { + const body = { + properties: { sessionId: "66e2ac8f-439e-4345-8235-6fef07608081" }, + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.exchange.beginPostAndWait(body); + console.log(result); +} + +exchange().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/getOperations.js b/sdk/reservations/arm-reservations/samples/v7/javascript/getOperations.js new file mode 100644 index 00000000000..0e92d5905b7 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/getOperations.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List all the operations. + * + * @summary List all the operations. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetOperations.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function getOperations() { + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const resArray = new Array(); + for await (let item of client.operation.list()) { + resArray.push(item); + } + console.log(resArray); +} + +getOperations().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/getReservation.js b/sdk/reservations/arm-reservations/samples/v7/javascript/getReservation.js new file mode 100644 index 00000000000..c9395acd7ec --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/getReservation.js @@ -0,0 +1,28 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the details of the `ReservationOrder`. + * + * @summary Get the details of the `ReservationOrder`. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrderDetails.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function getReservation() { + const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservationOrder.get(reservationOrderId); + console.log(result); +} + +getReservation().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/getReservationWithExpandPayments.js b/sdk/reservations/arm-reservations/samples/v7/javascript/getReservationWithExpandPayments.js new file mode 100644 index 00000000000..1690ca85fa9 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/getReservationWithExpandPayments.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the details of the `ReservationOrder`. + * + * @summary Get the details of the `ReservationOrder`. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function getReservationWithExpandPayments() { + const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; + const expand = "schedule"; + const options = { expand: expand }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservationOrder.get(reservationOrderId, options); + console.log(result); +} + +getReservationWithExpandPayments().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/merge.js b/sdk/reservations/arm-reservations/samples/v7/javascript/merge.js new file mode 100644 index 00000000000..7ec364f0b0e --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/merge.js @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have same properties. + * + * @summary Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have same properties. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/MergeReservations.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function merge() { + const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const body = { + sources: [ + "/providers/Microsoft.Capacity/reservationOrders/c0565a8a-4491-4e77-b07b-5e6d66718e1c/reservations/cea04232-932e-47db-acb5-e29a945ecc73", + "/providers/Microsoft.Capacity/reservationOrders/c0565a8a-4491-4e77-b07b-5e6d66718e1c/reservations/5bf54dc7-dacd-4f46-a16b-7b78f4a59799", + ], + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservation.beginMergeAndWait(reservationOrderId, body); + console.log(result); +} + +merge().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/package.json b/sdk/reservations/arm-reservations/samples/v7/javascript/package.json new file mode 100644 index 00000000000..bce41bcb808 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "azure-arm-reservations-samples-js", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript", + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/reservations/arm-reservations" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/reservations/arm-reservations", + "dependencies": { + "@azure/arm-reservations": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/patchReservation.js b/sdk/reservations/arm-reservations/samples/v7/javascript/patchReservation.js new file mode 100644 index 00000000000..4e63f2d9cb8 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/patchReservation.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Updates the applied scopes of the `Reservation`. + * + * @summary Updates the applied scopes of the `Reservation`. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/UpdateReservation.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function patchReservation() { + const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc"; + const parameters = { + appliedScopeType: "Shared", + instanceFlexibility: "Off", + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservation.beginUpdateAndWait( + reservationOrderId, + reservationId, + parameters + ); + console.log(result); +} + +patchReservation().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/purchase.js b/sdk/reservations/arm-reservations/samples/v7/javascript/purchase.js new file mode 100644 index 00000000000..9ffe470eff7 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/purchase.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Purchase `ReservationOrder` and create resource under the specified URI. + * + * @summary Purchase `ReservationOrder` and create resource under the specified URI. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/PurchaseReservationOrder.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function purchase() { + const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; + const body = { + appliedScopeType: "Shared", + appliedScopes: [], + billingPlan: "Monthly", + billingScopeId: "/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83", + displayName: "TestReservationOrder", + location: "westus", + quantity: 1, + renew: false, + reservedResourceProperties: { instanceFlexibility: "On" }, + reservedResourceType: "VirtualMachines", + sku: { name: "standard_D1" }, + term: "P1Y", + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservationOrder.beginPurchaseAndWait(reservationOrderId, body); + console.log(result); +} + +purchase().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestFailed.js b/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestFailed.js new file mode 100644 index 00000000000..3f1910d3b73 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestFailed.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. + * + * @summary For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusFailed.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function quotaRequestFailed() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const id = "2B5C8515-37D8-4B6A-879B-CD641A2CF605"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quotaRequestStatus.get(subscriptionId, providerId, location, id); + console.log(result); +} + +quotaRequestFailed().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestHistory.js b/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestHistory.js new file mode 100644 index 00000000000..8dd93fd16d1 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestHistory.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to For the specified Azure region (location), subscription, and resource provider, get the history of the quota requests for the past year. To select specific quota requests, use the oData filter. + * + * @summary For the specified Azure region (location), subscription, and resource provider, get the history of the quota requests for the past year. To select specific quota requests, use the oData filter. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestsHistory.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function quotaRequestHistory() { + const subscriptionId = "3f75fdf7-977e-44ad-990d-99f14f0f299f"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const resArray = new Array(); + for await (let item of client.quotaRequestStatus.list(subscriptionId, providerId, location)) { + resArray.push(item); + } + console.log(resArray); +} + +quotaRequestHistory().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestInProgress.js b/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestInProgress.js new file mode 100644 index 00000000000..a22ca0ad5f4 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestInProgress.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. + * + * @summary For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusInProgress.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function quotaRequestInProgress() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const id = "2B5C8515-37D8-4B6A-879B-CD641A2CF605"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quotaRequestStatus.get(subscriptionId, providerId, location, id); + console.log(result); +} + +quotaRequestInProgress().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestStatus.js b/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestStatus.js new file mode 100644 index 00000000000..41a2157cb55 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/quotaRequestStatus.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. + * + * @summary For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusById.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function quotaRequestStatus() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const id = "2B5C8515-37D8-4B6A-879B-CD641A2CF605"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quotaRequestStatus.get(subscriptionId, providerId, location, id); + console.log(result); +} + +quotaRequestStatus().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/quotasListUsagesForCompute.js b/sdk/reservations/arm-reservations/samples/v7/javascript/quotasListUsagesForCompute.js new file mode 100644 index 00000000000..ff9536b8187 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/quotasListUsagesForCompute.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates. + * + * @summary Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeUsages.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function quotasListUsagesForCompute() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const resArray = new Array(); + for await (let item of client.quota.list(subscriptionId, providerId, location)) { + resArray.push(item); + } + console.log(resArray); +} + +quotasListUsagesForCompute().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/quotasListUsagesMachineLearningServices.js b/sdk/reservations/arm-reservations/samples/v7/javascript/quotasListUsagesMachineLearningServices.js new file mode 100644 index 00000000000..efc5b31c6f3 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/quotasListUsagesMachineLearningServices.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates. + * + * @summary Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getMachineLearningServicesUsages.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function quotasListUsagesMachineLearningServices() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const providerId = "Microsoft.MachineLearningServices"; + const location = "eastus"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const resArray = new Array(); + for await (let item of client.quota.list(subscriptionId, providerId, location)) { + resArray.push(item); + } + console.log(resArray); +} + +quotasListUsagesMachineLearningServices().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestForCompute.js b/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestForCompute.js new file mode 100644 index 00000000000..8f24c1e62e9 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestForCompute.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota update request. + * + * @summary Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota update request. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeOneSkuUsages.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function quotasRequestForCompute() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const resourceName = "standardNDSFamily"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quota.get(subscriptionId, providerId, location, resourceName); + console.log(result); +} + +quotasRequestForCompute().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPatchForCompute.js b/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPatchForCompute.js new file mode 100644 index 00000000000..b9f1db32105 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPatchForCompute.js @@ -0,0 +1,58 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Update the quota (service limits) of this resource to the requested value. + + • To get the quota information for specific resource, send a GET request. + + • To increase the quota, update the limit field from the GET response to a new value. + + • To update the quota value, submit the JSON response to the quota request API to update the quota. + • To update the quota. use the PATCH operation. + * + * @summary Update the quota (service limits) of this resource to the requested value. + + • To get the quota information for specific resource, send a GET request. + + • To increase the quota, update the limit field from the GET response to a new value. + + • To update the quota value, submit the JSON response to the quota request API to update the quota. + • To update the quota. use the PATCH operation. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/patchComputeQuotaRequest.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function quotasRequestPatchForCompute() { + const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const resourceName = "standardFSv2Family"; + const createQuotaRequest = { + properties: { + name: { value: "standardFSv2Family" }, + limit: 200, + unit: "Count", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quota.beginUpdateAndWait( + subscriptionId, + providerId, + location, + resourceName, + createQuotaRequest + ); + console.log(result); +} + +quotasRequestPatchForCompute().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPutForCompute.js b/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPutForCompute.js new file mode 100644 index 00000000000..c28705b2396 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPutForCompute.js @@ -0,0 +1,60 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update the quota (service limits) of a resource to the requested value. + Steps: + + 1. Make the Get request to get the quota information for specific resource. + + 2. To increase the quota, update the limit field in the response from Get request to new value. + + 3. Submit the JSON to the quota request API to update the quota. + The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @summary Create or update the quota (service limits) of a resource to the requested value. + Steps: + + 1. Make the Get request to get the quota information for specific resource. + + 2. To increase the quota, update the limit field in the response from Get request to new value. + + 3. Submit the JSON to the quota request API to update the quota. + The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putComputeOneSkuQuotaRequest.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function quotasRequestPutForCompute() { + const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const resourceName = "standardFSv2Family"; + const createQuotaRequest = { + properties: { + name: { value: "standardFSv2Family" }, + limit: 200, + unit: "Count", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quota.beginCreateOrUpdateAndWait( + subscriptionId, + providerId, + location, + resourceName, + createQuotaRequest + ); + console.log(result); +} + +quotasRequestPutForCompute().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPutForMachineLearningServicesDedicatedResource.js b/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPutForMachineLearningServicesDedicatedResource.js new file mode 100644 index 00000000000..c5432f285be --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPutForMachineLearningServicesDedicatedResource.js @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update the quota (service limits) of a resource to the requested value. + Steps: + + 1. Make the Get request to get the quota information for specific resource. + + 2. To increase the quota, update the limit field in the response from Get request to new value. + + 3. Submit the JSON to the quota request API to update the quota. + The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @summary Create or update the quota (service limits) of a resource to the requested value. + Steps: + + 1. Make the Get request to get the quota information for specific resource. + + 2. To increase the quota, update the limit field in the response from Get request to new value. + + 3. Submit the JSON to the quota request API to update the quota. + The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestDedicated.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function quotasRequestPutForMachineLearningServicesDedicatedResource() { + const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3"; + const providerId = "Microsoft.MachineLearningServices"; + const location = "eastus"; + const resourceName = "StandardDv2Family"; + const createQuotaRequest = { + properties: { + name: { value: "StandardDv2Family" }, + limit: 200, + resourceType: "dedicated", + unit: "Count", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quota.beginCreateOrUpdateAndWait( + subscriptionId, + providerId, + location, + resourceName, + createQuotaRequest + ); + console.log(result); +} + +quotasRequestPutForMachineLearningServicesDedicatedResource().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPutForMachineLearningServicesLowPriorityResource.js b/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPutForMachineLearningServicesLowPriorityResource.js new file mode 100644 index 00000000000..afd4c712eb1 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/quotasRequestPutForMachineLearningServicesLowPriorityResource.js @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update the quota (service limits) of a resource to the requested value. + Steps: + + 1. Make the Get request to get the quota information for specific resource. + + 2. To increase the quota, update the limit field in the response from Get request to new value. + + 3. Submit the JSON to the quota request API to update the quota. + The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @summary Create or update the quota (service limits) of a resource to the requested value. + Steps: + + 1. Make the Get request to get the quota information for specific resource. + + 2. To increase the quota, update the limit field in the response from Get request to new value. + + 3. Submit the JSON to the quota request API to update the quota. + The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestLowPriority.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function quotasRequestPutForMachineLearningServicesLowPriorityResource() { + const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3"; + const providerId = "Microsoft.MachineLearningServices"; + const location = "eastus"; + const resourceName = "TotalLowPriorityCores"; + const createQuotaRequest = { + properties: { + name: { value: "TotalLowPriorityCores" }, + limit: 200, + resourceType: "lowPriority", + unit: "Count", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quota.beginCreateOrUpdateAndWait( + subscriptionId, + providerId, + location, + resourceName, + createQuotaRequest + ); + console.log(result); +} + +quotasRequestPutForMachineLearningServicesLowPriorityResource().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationList.js b/sdk/reservations/arm-reservations/samples/v7/javascript/reservationList.js new file mode 100644 index 00000000000..5c7c1aceea2 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/reservationList.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List `Reservation`s within a single `ReservationOrder`. + * + * @summary List `Reservation`s within a single `ReservationOrder`. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationsFromOrder.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function reservationList() { + const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const resArray = new Array(); + for await (let item of client.reservation.list(reservationOrderId)) { + resArray.push(item); + } + console.log(resArray); +} + +reservationList().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderList.js b/sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderList.js new file mode 100644 index 00000000000..90793e51ef3 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/reservationOrderList.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List of all the `ReservationOrder`s that the user has access to in the current tenant. + * + * @summary List of all the `ReservationOrder`s that the user has access to in the current tenant. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrders.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function reservationOrderList() { + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const resArray = new Array(); + for await (let item of client.reservationOrder.list()) { + resArray.push(item); + } + console.log(resArray); +} + +reservationOrderList().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/reservationRevisions.js b/sdk/reservations/arm-reservations/samples/v7/javascript/reservationRevisions.js new file mode 100644 index 00000000000..373b76c13d8 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/reservationRevisions.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List of all the revisions for the `Reservation`. + * + * @summary List of all the revisions for the `Reservation`. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationRevisions.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function reservationRevisions() { + const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc"; + const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const resArray = new Array(); + for await (let item of client.reservation.listRevisions(reservationId, reservationOrderId)) { + resArray.push(item); + } + console.log(resArray); +} + +reservationRevisions().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/sample.env b/sdk/reservations/arm-reservations/samples/v7/javascript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/reservations/arm-reservations/samples/v7/javascript/split.js b/sdk/reservations/arm-reservations/samples/v7/javascript/split.js new file mode 100644 index 00000000000..e0d0c55ae60 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/javascript/split.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * + * @summary Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/SplitReservation.json + */ +const { AzureReservationAPI } = require("@azure/arm-reservations"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function split() { + const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const body = { + quantities: [1, 2], + reservationId: + "/providers/Microsoft.Capacity/reservationOrders/276e7ae4-84d0-4da6-ab4b-d6b94f3557da/reservations/bcae77cd-3119-4766-919f-b50d36c75c7a", + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservation.beginSplitAndWait(reservationOrderId, body); + console.log(result); +} + +split().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/README.md b/sdk/reservations/arm-reservations/samples/v7/typescript/README.md new file mode 100644 index 00000000000..bfb002dcbc1 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/README.md @@ -0,0 +1,115 @@ +# client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [appliedReservationList.ts][appliedreservationlist] | Get applicable `Reservation`s that are applied to this subscription or a resource group under this subscription. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetAppliedReservations.json | +| [availableScopes.ts][availablescopes] | Get Available Scopes for `Reservation`. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetAvailableScope.json | +| [calculateExchange.ts][calculateexchange] | Calculates price for exchanging `Reservations` if there are no policy errors. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/CalculateExchange.json | +| [catalog.ts][catalog] | Get the regions and skus that are available for RI purchase for the specified Azure subscription. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetCatalog.json | +| [changeDirectory.ts][changedirectory] | Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/ChangeDirectoryReservationOrder.json | +| [exchange.ts][exchange] | Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. //@@TS-MAGIC-NEWLINE@@ x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/Exchange.json | +| [getOperations.ts][getoperations] | List all the operations. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetOperations.json | +| [getReservation.ts][getreservation] | Get the details of the `ReservationOrder`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrderDetails.json | +| [getReservationWithExpandPayments.ts][getreservationwithexpandpayments] | Get the details of the `ReservationOrder`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json | +| [merge.ts][merge] | Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have same properties. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/MergeReservations.json | +| [patchReservation.ts][patchreservation] | Updates the applied scopes of the `Reservation`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/UpdateReservation.json | +| [purchase.ts][purchase] | Purchase `ReservationOrder` and create resource under the specified URI. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/PurchaseReservationOrder.json | +| [quotaRequestFailed.ts][quotarequestfailed] | For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusFailed.json | +| [quotaRequestHistory.ts][quotarequesthistory] | For the specified Azure region (location), subscription, and resource provider, get the history of the quota requests for the past year. To select specific quota requests, use the oData filter. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestsHistory.json | +| [quotaRequestInProgress.ts][quotarequestinprogress] | For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusInProgress.json | +| [quotaRequestStatus.ts][quotarequeststatus] | For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusById.json | +| [quotasListUsagesForCompute.ts][quotaslistusagesforcompute] | Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeUsages.json | +| [quotasListUsagesMachineLearningServices.ts][quotaslistusagesmachinelearningservices] | Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getMachineLearningServicesUsages.json | +| [quotasRequestForCompute.ts][quotasrequestforcompute] | Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota update request. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeOneSkuUsages.json | +| [quotasRequestPatchForCompute.ts][quotasrequestpatchforcompute] | Update the quota (service limits) of this resource to the requested value. //@@TS-MAGIC-NEWLINE@@ • To get the quota information for specific resource, send a GET request. //@@TS-MAGIC-NEWLINE@@ • To increase the quota, update the limit field from the GET response to a new value. //@@TS-MAGIC-NEWLINE@@ • To update the quota value, submit the JSON response to the quota request API to update the quota. • To update the quota. use the PATCH operation. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/patchComputeQuotaRequest.json | +| [quotasRequestPutForCompute.ts][quotasrequestputforcompute] | Create or update the quota (service limits) of a resource to the requested value. Steps: //@@TS-MAGIC-NEWLINE@@ 1. Make the Get request to get the quota information for specific resource. //@@TS-MAGIC-NEWLINE@@ 2. To increase the quota, update the limit field in the response from Get request to new value. //@@TS-MAGIC-NEWLINE@@ 3. Submit the JSON to the quota request API to update the quota. The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putComputeOneSkuQuotaRequest.json | +| [quotasRequestPutForMachineLearningServicesDedicatedResource.ts][quotasrequestputformachinelearningservicesdedicatedresource] | Create or update the quota (service limits) of a resource to the requested value. Steps: //@@TS-MAGIC-NEWLINE@@ 1. Make the Get request to get the quota information for specific resource. //@@TS-MAGIC-NEWLINE@@ 2. To increase the quota, update the limit field in the response from Get request to new value. //@@TS-MAGIC-NEWLINE@@ 3. Submit the JSON to the quota request API to update the quota. The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestDedicated.json | +| [quotasRequestPutForMachineLearningServicesLowPriorityResource.ts][quotasrequestputformachinelearningserviceslowpriorityresource] | Create or update the quota (service limits) of a resource to the requested value. Steps: //@@TS-MAGIC-NEWLINE@@ 1. Make the Get request to get the quota information for specific resource. //@@TS-MAGIC-NEWLINE@@ 2. To increase the quota, update the limit field in the response from Get request to new value. //@@TS-MAGIC-NEWLINE@@ 3. Submit the JSON to the quota request API to update the quota. The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestLowPriority.json | +| [reservationList.ts][reservationlist] | List `Reservation`s within a single `ReservationOrder`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationsFromOrder.json | +| [reservationOrderList.ts][reservationorderlist] | List of all the `ReservationOrder`s that the user has access to in the current tenant. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrders.json | +| [reservationRevisions.ts][reservationrevisions] | List of all the revisions for the `Reservation`. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationRevisions.json | +| [split.ts][split] | Split a `Reservation` into two `Reservation`s with specified quantity distribution. x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/SplitReservation.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/appliedReservationList.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node dist/appliedReservationList.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[appliedreservationlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/appliedReservationList.ts +[availablescopes]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/availableScopes.ts +[calculateexchange]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/calculateExchange.ts +[catalog]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/catalog.ts +[changedirectory]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/changeDirectory.ts +[exchange]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/exchange.ts +[getoperations]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/getOperations.ts +[getreservation]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/getReservation.ts +[getreservationwithexpandpayments]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/getReservationWithExpandPayments.ts +[merge]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/merge.ts +[patchreservation]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/patchReservation.ts +[purchase]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/purchase.ts +[quotarequestfailed]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestFailed.ts +[quotarequesthistory]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestHistory.ts +[quotarequestinprogress]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestInProgress.ts +[quotarequeststatus]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestStatus.ts +[quotaslistusagesforcompute]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasListUsagesForCompute.ts +[quotaslistusagesmachinelearningservices]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasListUsagesMachineLearningServices.ts +[quotasrequestforcompute]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestForCompute.ts +[quotasrequestpatchforcompute]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPatchForCompute.ts +[quotasrequestputforcompute]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPutForCompute.ts +[quotasrequestputformachinelearningservicesdedicatedresource]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPutForMachineLearningServicesDedicatedResource.ts +[quotasrequestputformachinelearningserviceslowpriorityresource]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPutForMachineLearningServicesLowPriorityResource.ts +[reservationlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationList.ts +[reservationorderlist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderList.ts +[reservationrevisions]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationRevisions.ts +[split]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/reservations/arm-reservations/samples/v7/typescript/src/split.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-reservations?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/reservations/arm-reservations/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/package.json b/sdk/reservations/arm-reservations/samples/v7/typescript/package.json new file mode 100644 index 00000000000..4ca8d3e1b55 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "azure-arm-reservations-samples-ts", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript", + "engines": { + "node": ">=12.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/reservations/arm-reservations" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/reservations/arm-reservations", + "dependencies": { + "@azure/arm-reservations": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^12.0.0", + "typescript": "~4.4.0", + "rimraf": "latest" + } +} diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/sample.env b/sdk/reservations/arm-reservations/samples/v7/typescript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/appliedReservationList.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/appliedReservationList.ts new file mode 100644 index 00000000000..bdfa150f90f --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/appliedReservationList.ts @@ -0,0 +1,28 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get applicable `Reservation`s that are applied to this subscription or a resource group under this subscription. + * + * @summary Get applicable `Reservation`s that are applied to this subscription or a resource group under this subscription. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetAppliedReservations.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function appliedReservationList() { + const subscriptionId = "23bc208b-083f-4901-ae85-4f98c0c3b4b6"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.getAppliedReservationList(subscriptionId); + console.log(result); +} + +appliedReservationList().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/availableScopes.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/availableScopes.ts new file mode 100644 index 00000000000..efe120d2727 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/availableScopes.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get Available Scopes for `Reservation`. + + * + * @summary Get Available Scopes for `Reservation`. + + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetAvailableScope.json + */ +import { + AvailableScopeRequest, + AzureReservationAPI +} from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function availableScopes() { + const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const reservationId = "356e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const body: AvailableScopeRequest = { + properties: { + scopes: ["/subscriptions/efc7c997-7700-4a74-b731-55aec16c15e9"] + } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservation.beginAvailableScopesAndWait( + reservationOrderId, + reservationId, + body + ); + console.log(result); +} + +availableScopes().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/calculateExchange.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/calculateExchange.ts new file mode 100644 index 00000000000..1520b2ec073 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/calculateExchange.ts @@ -0,0 +1,59 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Calculates price for exchanging `Reservations` if there are no policy errors. + + * + * @summary Calculates price for exchanging `Reservations` if there are no policy errors. + + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/CalculateExchange.json + */ +import { + CalculateExchangeRequest, + AzureReservationAPI +} from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function calculateExchange() { + const body: CalculateExchangeRequest = { + properties: { + reservationsToExchange: [ + { + quantity: 1, + reservationId: + "/providers/microsoft.capacity/reservationOrders/1f14354c-dc12-4c8d-8090-6f295a3a34aa/reservations/c8c926bd-fc5d-4e29-9d43-b68340ac23a6" + } + ], + reservationsToPurchase: [ + { + appliedScopeType: "Shared", + appliedScopes: [], + billingPlan: "Upfront", + billingScopeId: "/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83", + displayName: "testDisplayName", + location: "westus", + quantity: 1, + renew: false, + reservedResourceProperties: { instanceFlexibility: "On" }, + reservedResourceType: "VirtualMachines", + sku: { name: "Standard_B1ls" }, + term: "P1Y" + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.calculateExchange.beginPostAndWait(body); + console.log(result); +} + +calculateExchange().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/catalog.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/catalog.ts new file mode 100644 index 00000000000..c1f824cfd18 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/catalog.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the regions and skus that are available for RI purchase for the specified Azure subscription. + * + * @summary Get the regions and skus that are available for RI purchase for the specified Azure subscription. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetCatalog.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function catalog() { + const subscriptionId = "23bc208b-083f-4901-ae85-4f98c0c3b4b6"; + const reservedResourceType = "VirtualMachines"; + const location = "eastus"; + const options = { + reservedResourceType: reservedResourceType, + location: location + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.getCatalog(subscriptionId, options); + console.log(result); +} + +catalog().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/changeDirectory.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/changeDirectory.ts new file mode 100644 index 00000000000..8220f499c52 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/changeDirectory.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id + * + * @summary Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant id + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/ChangeDirectoryReservationOrder.json + */ +import { + ChangeDirectoryRequest, + AzureReservationAPI +} from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function changeDirectory() { + const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; + const body: ChangeDirectoryRequest = { + destinationTenantId: "906655ea-30be-4587-9d12-b50e077b0f32" + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservationOrder.changeDirectory( + reservationOrderId, + body + ); + console.log(result); +} + +changeDirectory().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/exchange.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/exchange.ts new file mode 100644 index 00000000000..9e27efeee4d --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/exchange.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + + * + * @summary Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/Exchange.json + */ +import { ExchangeRequest, AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function exchange() { + const body: ExchangeRequest = { + properties: { sessionId: "66e2ac8f-439e-4345-8235-6fef07608081" } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.exchange.beginPostAndWait(body); + console.log(result); +} + +exchange().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/getOperations.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/getOperations.ts new file mode 100644 index 00000000000..50802236b3c --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/getOperations.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List all the operations. + * + * @summary List all the operations. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetOperations.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getOperations() { + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const resArray = new Array(); + for await (let item of client.operation.list()) { + resArray.push(item); + } + console.log(resArray); +} + +getOperations().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/getReservation.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/getReservation.ts new file mode 100644 index 00000000000..a2ed05c49a0 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/getReservation.ts @@ -0,0 +1,28 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the details of the `ReservationOrder`. + * + * @summary Get the details of the `ReservationOrder`. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrderDetails.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getReservation() { + const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservationOrder.get(reservationOrderId); + console.log(result); +} + +getReservation().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/getReservationWithExpandPayments.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/getReservationWithExpandPayments.ts new file mode 100644 index 00000000000..0bdd987bcd7 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/getReservationWithExpandPayments.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the details of the `ReservationOrder`. + * + * @summary Get the details of the `ReservationOrder`. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrderDetailsWithExpandPlanInformation.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function getReservationWithExpandPayments() { + const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; + const expand = "schedule"; + const options = { expand: expand }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservationOrder.get(reservationOrderId, options); + console.log(result); +} + +getReservationWithExpandPayments().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/merge.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/merge.ts new file mode 100644 index 00000000000..45fef291f84 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/merge.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have same properties. + * + * @summary Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged must have same properties. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/MergeReservations.json + */ +import { MergeRequest, AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function merge() { + const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const body: MergeRequest = { + sources: [ + "/providers/Microsoft.Capacity/reservationOrders/c0565a8a-4491-4e77-b07b-5e6d66718e1c/reservations/cea04232-932e-47db-acb5-e29a945ecc73", + "/providers/Microsoft.Capacity/reservationOrders/c0565a8a-4491-4e77-b07b-5e6d66718e1c/reservations/5bf54dc7-dacd-4f46-a16b-7b78f4a59799" + ] + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservation.beginMergeAndWait( + reservationOrderId, + body + ); + console.log(result); +} + +merge().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/patchReservation.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/patchReservation.ts new file mode 100644 index 00000000000..3d1d5e645c4 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/patchReservation.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Updates the applied scopes of the `Reservation`. + * + * @summary Updates the applied scopes of the `Reservation`. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/UpdateReservation.json + */ +import { Patch, AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function patchReservation() { + const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc"; + const parameters: Patch = { + appliedScopeType: "Shared", + instanceFlexibility: "Off" + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservation.beginUpdateAndWait( + reservationOrderId, + reservationId, + parameters + ); + console.log(result); +} + +patchReservation().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/purchase.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/purchase.ts new file mode 100644 index 00000000000..8c6780772a0 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/purchase.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Purchase `ReservationOrder` and create resource under the specified URI. + * + * @summary Purchase `ReservationOrder` and create resource under the specified URI. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/PurchaseReservationOrder.json + */ +import { PurchaseRequest, AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function purchase() { + const reservationOrderId = "a075419f-44cc-497f-b68a-14ee811d48b9"; + const body: PurchaseRequest = { + appliedScopeType: "Shared", + appliedScopes: [], + billingPlan: "Monthly", + billingScopeId: "/subscriptions/ed3a1871-612d-abcd-a849-c2542a68be83", + displayName: "TestReservationOrder", + location: "westus", + quantity: 1, + renew: false, + reservedResourceProperties: { instanceFlexibility: "On" }, + reservedResourceType: "VirtualMachines", + sku: { name: "standard_D1" }, + term: "P1Y" + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservationOrder.beginPurchaseAndWait( + reservationOrderId, + body + ); + console.log(result); +} + +purchase().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestFailed.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestFailed.ts new file mode 100644 index 00000000000..494ded8854c --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestFailed.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. + * + * @summary For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusFailed.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotaRequestFailed() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const id = "2B5C8515-37D8-4B6A-879B-CD641A2CF605"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quotaRequestStatus.get( + subscriptionId, + providerId, + location, + id + ); + console.log(result); +} + +quotaRequestFailed().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestHistory.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestHistory.ts new file mode 100644 index 00000000000..d80db8a7dae --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestHistory.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to For the specified Azure region (location), subscription, and resource provider, get the history of the quota requests for the past year. To select specific quota requests, use the oData filter. + * + * @summary For the specified Azure region (location), subscription, and resource provider, get the history of the quota requests for the past year. To select specific quota requests, use the oData filter. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestsHistory.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotaRequestHistory() { + const subscriptionId = "3f75fdf7-977e-44ad-990d-99f14f0f299f"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const resArray = new Array(); + for await (let item of client.quotaRequestStatus.list( + subscriptionId, + providerId, + location + )) { + resArray.push(item); + } + console.log(resArray); +} + +quotaRequestHistory().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestInProgress.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestInProgress.ts new file mode 100644 index 00000000000..922eb4e18ac --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestInProgress.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. + * + * @summary For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusInProgress.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotaRequestInProgress() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const id = "2B5C8515-37D8-4B6A-879B-CD641A2CF605"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quotaRequestStatus.get( + subscriptionId, + providerId, + location, + id + ); + console.log(result); +} + +quotaRequestInProgress().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestStatus.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestStatus.ts new file mode 100644 index 00000000000..36d99733050 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotaRequestStatus.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. + * + * @summary For the specified Azure region (location), get the details and status of the quota request by the quota request ID for the resources of the resource provider. The PUT request for the quota (service limit) returns a response with the requestId parameter. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getQuotaRequestStatusById.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotaRequestStatus() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const id = "2B5C8515-37D8-4B6A-879B-CD641A2CF605"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quotaRequestStatus.get( + subscriptionId, + providerId, + location, + id + ); + console.log(result); +} + +quotaRequestStatus().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasListUsagesForCompute.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasListUsagesForCompute.ts new file mode 100644 index 00000000000..d9785128cda --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasListUsagesForCompute.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates. + * + * @summary Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeUsages.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotasListUsagesForCompute() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const resArray = new Array(); + for await (let item of client.quota.list( + subscriptionId, + providerId, + location + )) { + resArray.push(item); + } + console.log(resArray); +} + +quotasListUsagesForCompute().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasListUsagesMachineLearningServices.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasListUsagesMachineLearningServices.ts new file mode 100644 index 00000000000..3d7a76aaefe --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasListUsagesMachineLearningServices.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates. + * + * @summary Gets a list of current quotas (service limits) and usage for all resources. The response from the list quota operation can be leveraged to request quota updates. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getMachineLearningServicesUsages.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotasListUsagesMachineLearningServices() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const providerId = "Microsoft.MachineLearningServices"; + const location = "eastus"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const resArray = new Array(); + for await (let item of client.quota.list( + subscriptionId, + providerId, + location + )) { + resArray.push(item); + } + console.log(resArray); +} + +quotasListUsagesMachineLearningServices().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestForCompute.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestForCompute.ts new file mode 100644 index 00000000000..50288d66ae7 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestForCompute.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota update request. + * + * @summary Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota update request. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/getComputeOneSkuUsages.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotasRequestForCompute() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const resourceName = "standardNDSFamily"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quota.get( + subscriptionId, + providerId, + location, + resourceName + ); + console.log(result); +} + +quotasRequestForCompute().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPatchForCompute.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPatchForCompute.ts new file mode 100644 index 00000000000..4104b59b3f5 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPatchForCompute.ts @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Update the quota (service limits) of this resource to the requested value. + + • To get the quota information for specific resource, send a GET request. + + • To increase the quota, update the limit field from the GET response to a new value. + + • To update the quota value, submit the JSON response to the quota request API to update the quota. + • To update the quota. use the PATCH operation. + * + * @summary Update the quota (service limits) of this resource to the requested value. + + • To get the quota information for specific resource, send a GET request. + + • To increase the quota, update the limit field from the GET response to a new value. + + • To update the quota value, submit the JSON response to the quota request API to update the quota. + • To update the quota. use the PATCH operation. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/patchComputeQuotaRequest.json + */ +import { + CurrentQuotaLimitBase, + AzureReservationAPI +} from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotasRequestPatchForCompute() { + const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const resourceName = "standardFSv2Family"; + const createQuotaRequest: CurrentQuotaLimitBase = { + properties: { + name: { value: "standardFSv2Family" }, + limit: 200, + unit: "Count" + } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quota.beginUpdateAndWait( + subscriptionId, + providerId, + location, + resourceName, + createQuotaRequest + ); + console.log(result); +} + +quotasRequestPatchForCompute().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPutForCompute.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPutForCompute.ts new file mode 100644 index 00000000000..cfcae142b4d --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPutForCompute.ts @@ -0,0 +1,63 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update the quota (service limits) of a resource to the requested value. + Steps: + + 1. Make the Get request to get the quota information for specific resource. + + 2. To increase the quota, update the limit field in the response from Get request to new value. + + 3. Submit the JSON to the quota request API to update the quota. + The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @summary Create or update the quota (service limits) of a resource to the requested value. + Steps: + + 1. Make the Get request to get the quota information for specific resource. + + 2. To increase the quota, update the limit field in the response from Get request to new value. + + 3. Submit the JSON to the quota request API to update the quota. + The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putComputeOneSkuQuotaRequest.json + */ +import { + CurrentQuotaLimitBase, + AzureReservationAPI +} from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotasRequestPutForCompute() { + const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3"; + const providerId = "Microsoft.Compute"; + const location = "eastus"; + const resourceName = "standardFSv2Family"; + const createQuotaRequest: CurrentQuotaLimitBase = { + properties: { + name: { value: "standardFSv2Family" }, + limit: 200, + unit: "Count" + } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quota.beginCreateOrUpdateAndWait( + subscriptionId, + providerId, + location, + resourceName, + createQuotaRequest + ); + console.log(result); +} + +quotasRequestPutForCompute().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPutForMachineLearningServicesDedicatedResource.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPutForMachineLearningServicesDedicatedResource.ts new file mode 100644 index 00000000000..9345e85631e --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPutForMachineLearningServicesDedicatedResource.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update the quota (service limits) of a resource to the requested value. + Steps: + + 1. Make the Get request to get the quota information for specific resource. + + 2. To increase the quota, update the limit field in the response from Get request to new value. + + 3. Submit the JSON to the quota request API to update the quota. + The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @summary Create or update the quota (service limits) of a resource to the requested value. + Steps: + + 1. Make the Get request to get the quota information for specific resource. + + 2. To increase the quota, update the limit field in the response from Get request to new value. + + 3. Submit the JSON to the quota request API to update the quota. + The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestDedicated.json + */ +import { + CurrentQuotaLimitBase, + AzureReservationAPI +} from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotasRequestPutForMachineLearningServicesDedicatedResource() { + const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3"; + const providerId = "Microsoft.MachineLearningServices"; + const location = "eastus"; + const resourceName = "StandardDv2Family"; + const createQuotaRequest: CurrentQuotaLimitBase = { + properties: { + name: { value: "StandardDv2Family" }, + limit: 200, + resourceType: "dedicated", + unit: "Count" + } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quota.beginCreateOrUpdateAndWait( + subscriptionId, + providerId, + location, + resourceName, + createQuotaRequest + ); + console.log(result); +} + +quotasRequestPutForMachineLearningServicesDedicatedResource().catch( + console.error +); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPutForMachineLearningServicesLowPriorityResource.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPutForMachineLearningServicesLowPriorityResource.ts new file mode 100644 index 00000000000..8d21249dfbb --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/quotasRequestPutForMachineLearningServicesLowPriorityResource.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update the quota (service limits) of a resource to the requested value. + Steps: + + 1. Make the Get request to get the quota information for specific resource. + + 2. To increase the quota, update the limit field in the response from Get request to new value. + + 3. Submit the JSON to the quota request API to update the quota. + The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * + * @summary Create or update the quota (service limits) of a resource to the requested value. + Steps: + + 1. Make the Get request to get the quota information for specific resource. + + 2. To increase the quota, update the limit field in the response from Get request to new value. + + 3. Submit the JSON to the quota request API to update the quota. + The Create quota request may be constructed as follows. The PUT operation can be used to update the quota. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2020-10-25/examples/putMachineLearningServicesQuotaRequestLowPriority.json + */ +import { + CurrentQuotaLimitBase, + AzureReservationAPI +} from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function quotasRequestPutForMachineLearningServicesLowPriorityResource() { + const subscriptionId = "D7EC67B3-7657-4966-BFFC-41EFD36BAAB3"; + const providerId = "Microsoft.MachineLearningServices"; + const location = "eastus"; + const resourceName = "TotalLowPriorityCores"; + const createQuotaRequest: CurrentQuotaLimitBase = { + properties: { + name: { value: "TotalLowPriorityCores" }, + limit: 200, + resourceType: "lowPriority", + unit: "Count" + } + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.quota.beginCreateOrUpdateAndWait( + subscriptionId, + providerId, + location, + resourceName, + createQuotaRequest + ); + console.log(result); +} + +quotasRequestPutForMachineLearningServicesLowPriorityResource().catch( + console.error +); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationList.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationList.ts new file mode 100644 index 00000000000..3947d3c2e14 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationList.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List `Reservation`s within a single `ReservationOrder`. + * + * @summary List `Reservation`s within a single `ReservationOrder`. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationsFromOrder.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function reservationList() { + const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const resArray = new Array(); + for await (let item of client.reservation.list(reservationOrderId)) { + resArray.push(item); + } + console.log(resArray); +} + +reservationList().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderList.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderList.ts new file mode 100644 index 00000000000..e41e72b25bf --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationOrderList.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List of all the `ReservationOrder`s that the user has access to in the current tenant. + * + * @summary List of all the `ReservationOrder`s that the user has access to in the current tenant. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationOrders.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function reservationOrderList() { + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const resArray = new Array(); + for await (let item of client.reservationOrder.list()) { + resArray.push(item); + } + console.log(resArray); +} + +reservationOrderList().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationRevisions.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationRevisions.ts new file mode 100644 index 00000000000..51f5383c949 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/reservationRevisions.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List of all the revisions for the `Reservation`. + * + * @summary List of all the revisions for the `Reservation`. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/GetReservationRevisions.json + */ +import { AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function reservationRevisions() { + const reservationId = "6ef59113-3482-40da-8d79-787f823e34bc"; + const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const resArray = new Array(); + for await (let item of client.reservation.listRevisions( + reservationId, + reservationOrderId + )) { + resArray.push(item); + } + console.log(resArray); +} + +reservationRevisions().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/src/split.ts b/sdk/reservations/arm-reservations/samples/v7/typescript/src/split.ts new file mode 100644 index 00000000000..d070a1c45d7 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/src/split.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * + * @summary Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * x-ms-original-file: specification/reservations/resource-manager/Microsoft.Capacity/stable/2021-07-01/examples/SplitReservation.json + */ +import { SplitRequest, AzureReservationAPI } from "@azure/arm-reservations"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function split() { + const reservationOrderId = "276e7ae4-84d0-4da6-ab4b-d6b94f3557da"; + const body: SplitRequest = { + quantities: [1, 2], + reservationId: + "/providers/Microsoft.Capacity/reservationOrders/276e7ae4-84d0-4da6-ab4b-d6b94f3557da/reservations/bcae77cd-3119-4766-919f-b50d36c75c7a" + }; + const credential = new DefaultAzureCredential(); + const client = new AzureReservationAPI(credential); + const result = await client.reservation.beginSplitAndWait( + reservationOrderId, + body + ); + console.log(result); +} + +split().catch(console.error); diff --git a/sdk/reservations/arm-reservations/samples/v7/typescript/tsconfig.json b/sdk/reservations/arm-reservations/samples/v7/typescript/tsconfig.json new file mode 100644 index 00000000000..416c2dd82e0 --- /dev/null +++ b/sdk/reservations/arm-reservations/samples/v7/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2018", + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "alwaysStrict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src/**.ts" + ] +} diff --git a/sdk/reservations/arm-reservations/src/azureReservationAPI.ts b/sdk/reservations/arm-reservations/src/azureReservationAPI.ts index 6f761cb07da..37d3da80f33 100644 --- a/sdk/reservations/arm-reservations/src/azureReservationAPI.ts +++ b/sdk/reservations/arm-reservations/src/azureReservationAPI.ts @@ -3,136 +3,145 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "./models"; -import * as Mappers from "./models/mappers"; +import * as coreClient from "@azure/core-client"; +import * as coreAuth from "@azure/core-auth"; +import { + ReservationImpl, + ReservationOrderImpl, + OperationImpl, + CalculateExchangeImpl, + ExchangeImpl, + QuotaImpl, + QuotaRequestStatusImpl +} from "./operations"; +import { + Reservation, + ReservationOrder, + Operation, + CalculateExchange, + Exchange, + Quota, + QuotaRequestStatus +} from "./operationsInterfaces"; import * as Parameters from "./models/parameters"; -import * as operations from "./operations"; -import { AzureReservationAPIContext } from "./azureReservationAPIContext"; +import * as Mappers from "./models/mappers"; +import { + AzureReservationAPIOptionalParams, + GetCatalogOptionalParams, + GetCatalogResponse, + GetAppliedReservationListOptionalParams, + GetAppliedReservationListResponse +} from "./models"; - -class AzureReservationAPI extends AzureReservationAPIContext { - // Operation groups - reservation: operations.Reservation; - reservationOrder: operations.ReservationOrder; - operation: operations.Operation; - calculateExchange: operations.CalculateExchange; - exchange: operations.Exchange; - quota: operations.Quota; - quotaRequestStatus: operations.QuotaRequestStatus; +export class AzureReservationAPI extends coreClient.ServiceClient { + $host: string; /** * Initializes a new instance of the AzureReservationAPI class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param [options] The parameter options + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param options The parameter options */ - constructor(credentials: msRest.ServiceClientCredentials, options?: Models.AzureReservationAPIOptions) { - super(credentials, options); - this.reservation = new operations.Reservation(this); - this.reservationOrder = new operations.ReservationOrder(this); - this.operation = new operations.Operation(this); - this.calculateExchange = new operations.CalculateExchange(this); - this.exchange = new operations.Exchange(this); - this.quota = new operations.Quota(this); - this.quotaRequestStatus = new operations.QuotaRequestStatus(this); + constructor( + credentials: coreAuth.TokenCredential, + options?: AzureReservationAPIOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: AzureReservationAPIOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-reservations/7.0.0`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + if (!options.credentialScopes) { + options.credentialScopes = ["https://management.azure.com/.default"]; + } + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: options.endpoint || "https://management.azure.com" + }; + super(optionsWithDefaults); + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.reservation = new ReservationImpl(this); + this.reservationOrder = new ReservationOrderImpl(this); + this.operation = new OperationImpl(this); + this.calculateExchange = new CalculateExchangeImpl(this); + this.exchange = new ExchangeImpl(this); + this.quota = new QuotaImpl(this); + this.quotaRequestStatus = new QuotaRequestStatusImpl(this); } /** - * @summary Get the regions and skus that are available for RI purchase for the specified Azure + * Get the regions and skus that are available for RI purchase for the specified Azure subscription. + * @param subscriptionId Id of the subscription + * @param options The options parameters. + */ + getCatalog( + subscriptionId: string, + options?: GetCatalogOptionalParams + ): Promise { + return this.sendOperationRequest( + { subscriptionId, options }, + getCatalogOperationSpec + ); + } + + /** + * Get applicable `Reservation`s that are applied to this subscription or a resource group under this * subscription. * @param subscriptionId Id of the subscription - * @param reservedResourceType The type of the resource for which the skus should be provided. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - getCatalog(subscriptionId: string, reservedResourceType: string, options?: Models.AzureReservationAPIGetCatalogOptionalParams): Promise; - /** - * @param subscriptionId Id of the subscription - * @param reservedResourceType The type of the resource for which the skus should be provided. - * @param callback The callback - */ - getCatalog(subscriptionId: string, reservedResourceType: string, callback: msRest.ServiceCallback): void; - /** - * @param subscriptionId Id of the subscription - * @param reservedResourceType The type of the resource for which the skus should be provided. - * @param options The optional parameters - * @param callback The callback - */ - getCatalog(subscriptionId: string, reservedResourceType: string, options: Models.AzureReservationAPIGetCatalogOptionalParams, callback: msRest.ServiceCallback): void; - getCatalog(subscriptionId: string, reservedResourceType: string, options?: Models.AzureReservationAPIGetCatalogOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + getAppliedReservationList( + subscriptionId: string, + options?: GetAppliedReservationListOptionalParams + ): Promise { return this.sendOperationRequest( - { - subscriptionId, - reservedResourceType, - options - }, - getCatalogOperationSpec, - callback) as Promise; + { subscriptionId, options }, + getAppliedReservationListOperationSpec + ); } - /** - * Get applicable `Reservation`s that are applied to this subscription or a resource group under - * this subscription. - * @summary Get list of applicable `Reservation`s. - * @param subscriptionId Id of the subscription - * @param [options] The optional parameters - * @returns Promise - */ - getAppliedReservationList(subscriptionId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param subscriptionId Id of the subscription - * @param callback The callback - */ - getAppliedReservationList(subscriptionId: string, callback: msRest.ServiceCallback): void; - /** - * @param subscriptionId Id of the subscription - * @param options The optional parameters - * @param callback The callback - */ - getAppliedReservationList(subscriptionId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - getAppliedReservationList(subscriptionId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.sendOperationRequest( - { - subscriptionId, - options - }, - getAppliedReservationListOperationSpec, - callback) as Promise; - } + reservation: Reservation; + reservationOrder: ReservationOrder; + operation: Operation; + calculateExchange: CalculateExchange; + exchange: Exchange; + quota: Quota; + quotaRequestStatus: QuotaRequestStatus; } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getCatalogOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getCatalogOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/catalogs", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion0, - Parameters.reservedResourceType, - Parameters.location0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: { - serializedName: "parsedResponse", type: { name: "Sequence", - element: { - type: { - name: "Composite", - className: "Catalog" - } - } + element: { type: { name: "Composite", className: "Catalog" } } } } }, @@ -140,21 +149,19 @@ const getCatalogOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, + queryParameters: [ + Parameters.apiVersion, + Parameters.reservedResourceType, + Parameters.location + ], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], serializer }; - -const getAppliedReservationListOperationSpec: msRest.OperationSpec = { +const getAppliedReservationListOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/appliedReservations", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.AppliedReservations @@ -163,13 +170,8 @@ const getAppliedReservationListOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], serializer }; - -export { - AzureReservationAPI, - AzureReservationAPIContext, - Models as AzureReservationAPIModels, - Mappers as AzureReservationAPIMappers -}; -export * from "./operations"; diff --git a/sdk/reservations/arm-reservations/src/azureReservationAPIContext.ts b/sdk/reservations/arm-reservations/src/azureReservationAPIContext.ts deleted file mode 100644 index 49da34adf76..00000000000 --- a/sdk/reservations/arm-reservations/src/azureReservationAPIContext.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import * as Models from "./models"; -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; - -const packageName = "@azure/arm-reservations"; -const packageVersion = "6.0.0"; - -export class AzureReservationAPIContext extends msRestAzure.AzureServiceClient { - credentials: msRest.ServiceClientCredentials; - - /** - * Initializes a new instance of the AzureReservationAPI class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param [options] The parameter options - */ - constructor(credentials: msRest.ServiceClientCredentials, options?: Models.AzureReservationAPIOptions) { - if (credentials == undefined) { - throw new Error('\'credentials\' cannot be null.'); - } - - if (!options) { - options = {}; - } - if (!options.userAgent) { - const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); - options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; - } - - super(credentials, options); - - this.acceptLanguage = 'en-US'; - this.longRunningOperationRetryTimeout = 30; - this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; - this.requestContentType = "application/json; charset=utf-8"; - this.credentials = credentials; - - if (options.acceptLanguage !== null && options.acceptLanguage !== undefined) { - this.acceptLanguage = options.acceptLanguage; - } - if (options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { - this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; - } - } -} diff --git a/sdk/resourcemover/arm-resourcemover/src/models/unresolvedDependenciesMappers.ts b/sdk/reservations/arm-reservations/src/index.ts similarity index 57% rename from sdk/resourcemover/arm-resourcemover/src/models/unresolvedDependenciesMappers.ts rename to sdk/reservations/arm-reservations/src/index.ts index b97d918b026..17b76c65cbe 100644 --- a/sdk/resourcemover/arm-resourcemover/src/models/unresolvedDependenciesMappers.ts +++ b/sdk/reservations/arm-reservations/src/index.ts @@ -6,11 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -export { - discriminators, - CloudError, - Summary, - SummaryCollection, - UnresolvedDependency, - UnresolvedDependencyCollection -} from "../models/mappers"; +/// +export * from "./models"; +export { AzureReservationAPI } from "./azureReservationAPI"; +export * from "./operationsInterfaces"; diff --git a/sdk/reservations/arm-reservations/src/lroImpl.ts b/sdk/reservations/arm-reservations/src/lroImpl.ts new file mode 100644 index 00000000000..518d5f053b4 --- /dev/null +++ b/sdk/reservations/arm-reservations/src/lroImpl.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export class LroImpl implements LongRunningOperation { + constructor( + private sendOperationFn: (args: any, spec: any) => Promise>, + private args: Record, + private spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record, + public requestPath: string = spec.path!, + public requestMethod: string = spec.httpMethod + ) {} + public async sendInitialRequest(): Promise> { + return this.sendOperationFn(this.args, this.spec); + } + public async sendPollRequest(path: string): Promise> { + const { requestBody, ...restSpec } = this.spec; + return this.sendOperationFn(this.args, { + ...restSpec, + path, + httpMethod: "GET" + }); + } +} diff --git a/sdk/reservations/arm-reservations/src/models/calculateExchangeMappers.ts b/sdk/reservations/arm-reservations/src/models/calculateExchangeMappers.ts deleted file mode 100644 index f7f3a0268aa..00000000000 --- a/sdk/reservations/arm-reservations/src/models/calculateExchangeMappers.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - BillingInformation, - CalculateExchangeOperationResultResponse, - CalculateExchangePostHeaders, - CalculateExchangeRequest, - CalculateExchangeRequestProperties, - CalculateExchangeResponseProperties, - ErrorModel, - ExchangePolicyError, - ExchangePolicyErrors, - ExtendedErrorInfo, - OperationResultError, - Price, - PurchaseRequest, - PurchaseRequestPropertiesReservedResourceProperties, - ReservationToExchange, - ReservationToPurchaseCalculateExchange, - ReservationToReturn, - SkuName -} from "../models/mappers"; diff --git a/sdk/reservations/arm-reservations/src/models/exchangeMappers.ts b/sdk/reservations/arm-reservations/src/models/exchangeMappers.ts deleted file mode 100644 index d948db0c59e..00000000000 --- a/sdk/reservations/arm-reservations/src/models/exchangeMappers.ts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - BillingInformation, - ErrorModel, - ExchangeOperationResultResponse, - ExchangePolicyError, - ExchangePolicyErrors, - ExchangePostHeaders, - ExchangeRequest, - ExchangeRequestProperties, - ExchangeResponseProperties, - ExtendedErrorInfo, - OperationResultError, - Price, - PurchaseRequest, - PurchaseRequestPropertiesReservedResourceProperties, - ReservationToPurchaseExchange, - ReservationToReturnForExchange, - SkuName -} from "../models/mappers"; diff --git a/sdk/reservations/arm-reservations/src/models/index.ts b/sdk/reservations/arm-reservations/src/models/index.ts index 6d94f9ae195..46cce6a15a2 100644 --- a/sdk/reservations/arm-reservations/src/models/index.ts +++ b/sdk/reservations/arm-reservations/src/models/index.ts @@ -6,887 +6,558 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export { BaseResource, CloudError }; +/** Available scope */ +export interface AvailableScopeRequest { + /** Available scope request properties */ + properties?: AvailableScopeRequestProperties; +} -/** - * Available scope request properties - */ +/** Available scope request properties */ export interface AvailableScopeRequestProperties { scopes?: string[]; } -/** - * Available scope - */ -export interface AvailableScopeRequest { - properties?: AvailableScopeRequestProperties; +export interface AvailableScopeProperties { + properties?: SubscriptionScopeProperties; } -/** - * An interface representing SkuName. - */ -export interface SkuName { - name?: string; +export interface SubscriptionScopeProperties { + scopes?: ScopeProperties[]; } -/** - * Properties specific to each reserved resource type. Not required if not applicable. - */ -export interface PurchaseRequestPropertiesReservedResourceProperties { - /** - * Possible values include: 'On', 'Off' - */ - instanceFlexibility?: InstanceFlexibility; +export interface ScopeProperties { + scope?: string; + valid?: boolean; } -/** - * An interface representing PurchaseRequest. - */ -export interface PurchaseRequest { - sku?: SkuName; - /** - * The Azure Region where the reserved resource lives. - */ - location?: string; - /** - * Possible values include: 'VirtualMachines', 'SqlDatabases', 'SuseLinux', 'CosmosDb', 'RedHat', - * 'SqlDataWarehouse', 'VMwareCloudSimple', 'RedHatOsa', 'Databricks', 'AppService', - * 'ManagedDisk', 'BlockBlob', 'RedisCache', 'AzureDataExplorer', 'MySql', 'MariaDb', - * 'PostgreSql', 'DedicatedHost', 'SapHana', 'SqlAzureHybridBenefit' - */ - reservedResourceType?: ReservedResourceType; - billingScopeId?: string; - /** - * Possible values include: 'P1Y', 'P3Y' - */ - term?: ReservationTerm; - /** - * Possible values include: 'Upfront', 'Monthly' - */ - billingPlan?: ReservationBillingPlan; - quantity?: number; - /** - * Friendly name of the Reservation - */ - displayName?: string; - /** - * Possible values include: 'Single', 'Shared' - */ - appliedScopeType?: AppliedScopeType; - appliedScopes?: string[]; - renew?: boolean; - /** - * Properties specific to each reserved resource type. Not required if not applicable. - */ - reservedResourceProperties?: PurchaseRequestPropertiesReservedResourceProperties; -} - -/** - * Reservation to return - */ -export interface ReservationToReturn { - /** - * Fully qualified identifier of the Reservation being returned - */ - reservationId?: string; - /** - * Quantity to be returned. Must be greater than zero. - */ - quantity?: number; -} - -/** - * Calculate exchange request properties - */ -export interface CalculateExchangeRequestProperties { - /** - * List of reservations that are being purchased in this exchange. - */ - reservationsToPurchase?: PurchaseRequest[]; - /** - * List of reservations that are being returned in this exchange. - */ - reservationsToExchange?: ReservationToReturn[]; -} - -/** - * Calculate exchange request - */ -export interface CalculateExchangeRequest { - properties?: CalculateExchangeRequestProperties; -} - -/** - * Exchange request properties - */ -export interface ExchangeRequestProperties { - /** - * SessionId that was returned by CalculateExchange API. - */ - sessionId?: string; -} - -/** - * Exchange request - */ -export interface ExchangeRequest { - properties?: ExchangeRequestProperties; -} - -/** - * An interface representing Price. - */ -export interface Price { - /** - * The ISO 4217 3-letter currency code for the currency used by this purchase record. - */ - currencyCode?: string; - amount?: number; -} - -/** - * Reservation purchase details - */ -export interface ReservationToPurchaseCalculateExchange { - properties?: PurchaseRequest; - billingCurrencyTotal?: Price; -} - -/** - * billing information - */ -export interface BillingInformation { - billingCurrencyTotalPaidAmount?: Price; - billingCurrencyProratedAmount?: Price; - billingCurrencyRemainingCommitmentAmount?: Price; -} - -/** - * Reservation refund details - */ -export interface ReservationToExchange { - /** - * Fully qualified id of the Reservation being returned. - */ - reservationId?: string; - /** - * Quantity to be returned - */ - quantity?: number; - billingRefundAmount?: Price; - billingInformation?: BillingInformation; -} - -/** - * error details - */ -export interface ExchangePolicyError { - code?: string; - message?: string; -} - -/** - * Exchange policy errors - */ -export interface ExchangePolicyErrors { - /** - * Exchange Policy errors - */ - policyErrors?: ExchangePolicyError[]; -} - -/** - * CalculateExchange response properties - */ -export interface CalculateExchangeResponseProperties { - /** - * Exchange session identifier - */ - sessionId?: string; - netPayable?: Price; - refundsTotal?: Price; - purchasesTotal?: Price; - /** - * Details of the reservations being purchased - */ - reservationsToPurchase?: ReservationToPurchaseCalculateExchange[]; - /** - * Details of the reservations being returned - */ - reservationsToExchange?: ReservationToExchange[]; - policyResult?: ExchangePolicyErrors; -} - -/** - * Required if status == failed or status == canceled. - */ -export interface OperationResultError { - /** - * Required if status == failed or status == cancelled. If status == failed, provide an invariant - * error code used for error troubleshooting, aggregation, and analysis. - */ - code?: string; - /** - * Required if status == failed. Localized. If status == failed, provide an actionable error - * message indicating what error occurred, and what the user can do to address the issue. - */ - message?: string; -} - -/** - * CalculateExchange operation result - */ -export interface CalculateExchangeOperationResultResponse { - /** - * It should match what is used to GET the operation result. - */ - id?: string; - /** - * It must match the last segment of the id field, and will typically be a GUID / system - * generated value. - */ - name?: string; - /** - * Status of the operation. Possible values include: 'Succeeded', 'Failed', 'Cancelled', - * 'Pending' - */ - status?: CalculateExchangeOperationResultStatus; - properties?: CalculateExchangeResponseProperties; - error?: OperationResultError; -} - -/** - * Reservation purchase details - */ -export interface ReservationToPurchaseExchange { - /** - * Fully qualified id of the ReservationOrder being purchased - */ - reservationOrderId?: string; - /** - * Fully qualified id of the Reservation being purchased. This value is only guaranteed to be - * non-null if the purchase is successful. - */ - reservationId?: string; - properties?: PurchaseRequest; - billingCurrencyTotal?: Price; - /** - * Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Pending' - */ - status?: OperationStatus; -} - -/** - * Reservation refund details - */ -export interface ReservationToReturnForExchange { - /** - * Fully qualified id of the Reservation being returned. - */ - reservationId?: string; - /** - * Quantity to be returned - */ - quantity?: number; - billingRefundAmount?: Price; - billingInformation?: BillingInformation; - /** - * Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Pending' - */ - status?: OperationStatus; -} - -/** - * Exchange response properties - */ -export interface ExchangeResponseProperties { - /** - * Exchange session identifier - */ - sessionId?: string; - netPayable?: Price; - refundsTotal?: Price; - purchasesTotal?: Price; - /** - * Details of the reservations being purchased - */ - reservationsToPurchase?: ReservationToPurchaseExchange[]; - /** - * Details of the reservations being returned - */ - reservationsToExchange?: ReservationToReturnForExchange[]; - policyResult?: ExchangePolicyErrors; -} - -/** - * Exchange operation result - */ -export interface ExchangeOperationResultResponse { - /** - * It should match what is used to GET the operation result. - */ - id?: string; - /** - * It must match the last segment of the id field, and will typically be a GUID / system - * generated value. - */ - name?: string; - /** - * Status of the operation. Possible values include: 'Succeeded', 'Failed', 'Cancelled', - * 'PendingRefunds', 'PendingPurchases' - */ - status?: ExchangeOperationResultStatus; - properties?: ExchangeResponseProperties; - error?: OperationResultError; -} - -/** - * An interface representing SkuProperty. - */ -export interface SkuProperty { - /** - * An invariant to describe the feature. - */ - name?: string; - /** - * An invariant if the feature is measured by quantity. - */ - value?: string; -} - -/** - * An interface representing SkuRestriction. - */ -export interface SkuRestriction { - /** - * The type of restrictions. - */ - type?: string; - /** - * The value of restrictions. If the restriction type is set to location. This would be different - * locations where the SKU is restricted. - */ - values?: string[]; - /** - * The reason for restriction. - */ - reasonCode?: string; -} - -/** - * An interface representing Catalog. - */ -export interface Catalog { - /** - * The type of resource the SKU applies to. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly resourceType?: string; - /** - * The name of SKU - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * The billing plan options available for this SKU. - */ - billingPlans?: { [propertyName: string]: ReservationBillingPlan[] }; - /** - * Available reservation terms for this resource - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly terms?: ReservationTerm[]; - /** - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly locations?: string[]; - /** - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly skuProperties?: SkuProperty[]; - /** - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly restrictions?: SkuRestriction[]; -} - -/** - * An interface representing ExtendedStatusInfo. - */ -export interface ExtendedStatusInfo { - /** - * Possible values include: 'None', 'Pending', 'Active', 'PurchaseError', - * 'PaymentInstrumentError', 'Split', 'Merged', 'Expired', 'Succeeded' - */ - statusCode?: ReservationStatusCode; - /** - * The message giving detailed information about the status code. - */ - message?: string; -} - -/** - * Information about payment related to a reservation order. - */ -export interface PaymentDetail { - /** - * Date when the payment needs to be done. - */ - dueDate?: Date; - /** - * Date when the transaction is completed. Is null when it is scheduled. - */ - paymentDate?: Date; - /** - * Amount in pricing currency. Tax not included. - */ - pricingCurrencyTotal?: Price; - /** - * Amount charged in Billing currency. Tax not included. Is null for future payments - */ - billingCurrencyTotal?: Price; - /** - * Shows the Account that is charged for this payment. - */ - billingAccount?: string; - /** - * Possible values include: 'Succeeded', 'Failed', 'Scheduled', 'Cancelled' - */ - status?: PaymentStatus; - extendedStatusInfo?: ExtendedStatusInfo; -} - -/** - * Information describing the type of billing plan for this reservation. - */ -export interface ReservationOrderBillingPlanInformation { - /** - * Amount of money to be paid for the Order. Tax is not included. - */ - pricingCurrencyTotal?: Price; - /** - * Date when the billing plan has started. - */ - startDate?: Date; - /** - * For recurring billing plans, indicates the date when next payment will be processed. Null when - * total is paid off. - */ - nextPaymentDueDate?: Date; - transactions?: PaymentDetail[]; -} - -/** - * An interface representing ReservationSplitProperties. - */ -export interface ReservationSplitProperties { - /** - * List of destination Resource Id that are created due to split. Format of the resource Id is - * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} - */ - splitDestinations?: string[]; - /** - * Resource Id of the Reservation from which this is split. Format of the resource Id is - * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} - */ - splitSource?: string; -} - -/** - * An interface representing ReservationMergeProperties. - */ -export interface ReservationMergeProperties { - /** - * Reservation Resource Id Created due to the merge. Format of the resource Id is - * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} - */ - mergeDestination?: string; - /** - * Resource Ids of the Source Reservation's merged to form this Reservation. Format of the - * resource Id is - * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} - */ - mergeSources?: string[]; -} - -/** - * Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is - * not included. This is locked price 30 days before expiry. - */ -export interface RenewPropertiesResponsePricingCurrencyTotal { - currencyCode?: string; - amount?: number; -} - -/** - * Currency and amount that customer will be charged in customer's local currency for renewal - * purchase. Tax is not included. - */ -export interface RenewPropertiesResponseBillingCurrencyTotal { - currencyCode?: string; - amount?: number; -} - -/** - * An interface representing RenewPropertiesResponse. - */ -export interface RenewPropertiesResponse { - purchaseProperties?: PurchaseRequest; - /** - * Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is - * not included. This is locked price 30 days before expiry. - */ - pricingCurrencyTotal?: RenewPropertiesResponsePricingCurrencyTotal; - /** - * Currency and amount that customer will be charged in customer's local currency for renewal - * purchase. Tax is not included. - */ - billingCurrencyTotal?: RenewPropertiesResponseBillingCurrencyTotal; -} - -/** - * An interface representing ReservationProperties. - */ -export interface ReservationProperties { - /** - * Possible values include: 'VirtualMachines', 'SqlDatabases', 'SuseLinux', 'CosmosDb', 'RedHat', - * 'SqlDataWarehouse', 'VMwareCloudSimple', 'RedHatOsa', 'Databricks', 'AppService', - * 'ManagedDisk', 'BlockBlob', 'RedisCache', 'AzureDataExplorer', 'MySql', 'MariaDb', - * 'PostgreSql', 'DedicatedHost', 'SapHana', 'SqlAzureHybridBenefit' - */ - reservedResourceType?: ReservedResourceType; - /** - * Possible values include: 'On', 'Off' - */ - instanceFlexibility?: InstanceFlexibility; - /** - * Friendly name for user to easily identify the reservation - */ - displayName?: string; - appliedScopes?: string[]; - /** - * Possible values include: 'Single', 'Shared' - */ - appliedScopeType?: AppliedScopeType; - quantity?: number; - /** - * Current state of the reservation. - */ - provisioningState?: string; - /** - * DateTime of the Reservation starting when this version is effective from. - */ - effectiveDateTime?: Date; - /** - * DateTime of the last time the Reservation was updated. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly lastUpdatedDateTime?: Date; - /** - * This is the date when the Reservation will expire. - */ - expiryDate?: Date; - /** - * Description of the SKU in english. - */ - skuDescription?: string; - extendedStatusInfo?: ExtendedStatusInfo; - /** - * Possible values include: 'Upfront', 'Monthly' - */ - billingPlan?: ReservationBillingPlan; - splitProperties?: ReservationSplitProperties; - mergeProperties?: ReservationMergeProperties; - billingScopeId?: string; - renew?: boolean; - /** - * Reservation Id of the reservation from which this reservation is renewed. Format of the - * resource Id is - * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. - */ - renewSource?: string; - /** - * Reservation Id of the reservation which is purchased because of renew. Format of the resource - * Id is - * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. - */ - renewDestination?: string; - renewProperties?: RenewPropertiesResponse; - /** - * Possible values include: 'P1Y', 'P3Y' - */ - term?: ReservationTerm; -} - -/** - * An interface representing ReservationResponse. - */ -export interface ReservationResponse extends BaseResource { - /** - * The Azure Region where the reserved resource lives. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly location?: string; - etag?: number; - /** - * Identifier of the reservation - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * Name of the reservation - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - sku?: SkuName; - properties?: ReservationProperties; - /** - * Type of resource. "Microsoft.Capacity/reservationOrders/reservations" - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; -} - -/** - * An interface representing ReservationOrderResponse. - */ -export interface ReservationOrderResponse extends BaseResource { - etag?: number; - /** - * Identifier of the reservation - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * Name of the reservation - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * Friendly name for user to easily identified the reservation. - */ - displayName?: string; - /** - * This is the DateTime when the reservation was initially requested for purchase. - */ - requestDateTime?: Date; - /** - * This is the DateTime when the reservation was created. - */ - createdDateTime?: Date; - /** - * This is the date when the Reservation will expire. - */ - expiryDate?: Date; - originalQuantity?: number; - /** - * Possible values include: 'P1Y', 'P3Y' - */ - term?: ReservationTerm; - /** - * Current state of the reservation. - */ - provisioningState?: string; - /** - * Possible values include: 'Upfront', 'Monthly' - */ - billingPlan?: ReservationBillingPlan; - planInformation?: ReservationOrderBillingPlanInformation; - reservations?: ReservationResponse[]; - /** - * Type of resource. "Microsoft.Capacity/reservations" - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; -} - -/** - * Currency and amount that customer will be charged in customer's local currency. Tax is not - * included. - */ -export interface CalculatePriceResponsePropertiesBillingCurrencyTotal { - currencyCode?: string; - amount?: number; -} - -/** - * Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is - * not included. - */ -export interface CalculatePriceResponsePropertiesPricingCurrencyTotal { - currencyCode?: string; - amount?: number; -} - -/** - * An interface representing CalculatePriceResponseProperties. - */ -export interface CalculatePriceResponseProperties { - /** - * Currency and amount that customer will be charged in customer's local currency. Tax is not - * included. - */ - billingCurrencyTotal?: CalculatePriceResponsePropertiesBillingCurrencyTotal; - /** - * True if billing is managed by Microsoft Partner. Used only for CSP accounts. - */ - isBillingPartnerManaged?: boolean; - /** - * GUID that represents reservation order that can be placed after calculating price. - */ - reservationOrderId?: string; - /** - * Title of SKU that is being purchased. - */ - skuTitle?: string; - /** - * Description of SKU that is being purchased. - */ - skuDescription?: string; - /** - * Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is - * not included. - */ - pricingCurrencyTotal?: CalculatePriceResponsePropertiesPricingCurrencyTotal; - paymentSchedule?: PaymentDetail[]; -} - -/** - * An interface representing CalculatePriceResponse. - */ -export interface CalculatePriceResponse { - properties?: CalculatePriceResponseProperties; -} - -/** - * An interface representing PatchPropertiesRenewProperties. - */ -export interface PatchPropertiesRenewProperties { - purchaseProperties?: PurchaseRequest; -} - -/** - * An interface representing MergeRequest. - */ -export interface MergeRequest { - /** - * Format of the resource id should be - * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} - */ - sources?: string[]; -} - -/** - * An interface representing Patch. - */ -export interface Patch { - /** - * Possible values include: 'Single', 'Shared' - */ - appliedScopeType?: AppliedScopeType; - appliedScopes?: string[]; - /** - * Possible values include: 'On', 'Off' - */ - instanceFlexibility?: InstanceFlexibility; - /** - * Name of the Reservation - */ - name?: string; - renew?: boolean; - renewProperties?: PatchPropertiesRenewProperties; -} - -/** - * An interface representing SplitRequest. - */ -export interface SplitRequest { - /** - * List of the quantities in the new reservations to create. - */ - quantities?: number[]; - /** - * Resource id of the reservation to be split. Format of the resource id should be - * /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} - */ - reservationId?: string; -} - -/** - * An interface representing ExtendedErrorInfo. - */ -export interface ExtendedErrorInfo { - /** - * Possible values include: 'NotSpecified', 'InternalServerError', 'ServerTimeout', - * 'AuthorizationFailed', 'BadRequest', 'ClientCertificateThumbprintNotSet', - * 'InvalidRequestContent', 'OperationFailed', 'HttpMethodNotSupported', 'InvalidRequestUri', - * 'MissingTenantId', 'InvalidTenantId', 'InvalidReservationOrderId', 'InvalidReservationId', - * 'ReservationIdNotInReservationOrder', 'ReservationOrderNotFound', 'InvalidSubscriptionId', - * 'InvalidAccessToken', 'InvalidLocationId', 'UnauthenticatedRequestsThrottled', - * 'InvalidHealthCheckType', 'Forbidden', 'BillingScopeIdCannotBeChanged', - * 'AppliedScopesNotAssociatedWithCommerceAccount', 'PatchValuesSameAsExisting', - * 'RoleAssignmentCreationFailed', 'ReservationOrderCreationFailed', - * 'ReservationOrderNotEnabled', 'CapacityUpdateScopesFailed', 'UnsupportedReservationTerm', - * 'ReservationOrderIdAlreadyExists', 'RiskCheckFailed', 'CreateQuoteFailed', - * 'ActivateQuoteFailed', 'NonsupportedAccountId', 'PaymentInstrumentNotFound', - * 'MissingAppliedScopesForSingle', 'NoValidReservationsToReRate', 'ReRateOnlyAllowedForEA', - * 'OperationCannotBePerformedInCurrentState', 'InvalidSingleAppliedScopesCount', - * 'InvalidFulfillmentRequestParameters', 'NotSupportedCountry', 'InvalidRefundQuantity', - * 'PurchaseError', 'BillingCustomerInputError', 'BillingPaymentInstrumentSoftError', - * 'BillingPaymentInstrumentHardError', 'BillingTransientError', 'BillingError', - * 'FulfillmentConfigurationError', 'FulfillmentOutOfStockError', 'FulfillmentTransientError', - * 'FulfillmentError', 'CalculatePriceFailed' - */ - code?: ErrorResponseCode; - message?: string; -} - -/** - * An interface representing ErrorModel. - */ export interface ErrorModel { error?: ExtendedErrorInfo; } -/** - * An interface representing AppliedReservationList. - */ -export interface AppliedReservationList { - value?: string[]; - /** - * Url to get the next page of reservations - */ - nextLink?: string; +export interface ExtendedErrorInfo { + code?: ErrorResponseCode; + message?: string; +} + +export interface Catalog { + /** + * The type of resource the SKU applies to. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resourceType?: string; + /** + * The name of SKU + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** The billing plan options available for this SKU. */ + billingPlans?: { [propertyName: string]: ReservationBillingPlan[] }; + /** + * Available reservation terms for this resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly terms?: ReservationTerm[]; + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly locations?: string[]; + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly skuProperties?: SkuProperty[]; + /** + * Pricing information about the SKU + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly msrp?: CatalogMsrp; + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly restrictions?: SkuRestriction[]; + /** + * The tier of this SKU + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tier?: string; + /** + * The size of this SKU + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly size?: string; + /** NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly capabilities?: SkuCapability[]; +} + +export interface SkuProperty { + /** An invariant to describe the feature. */ + name?: string; + /** An invariant if the feature is measured by quantity. */ + value?: string; +} + +/** Pricing information about the SKU */ +export interface CatalogMsrp { + /** Amount in pricing currency. Tax not included. */ + p1Y?: Price; +} + +export interface Price { + /** The ISO 4217 3-letter currency code for the currency used by this purchase record. */ + currencyCode?: string; + amount?: number; +} + +export interface SkuRestriction { + /** The type of restrictions. */ + type?: string; + /** The value of restrictions. If the restriction type is set to location. This would be different locations where the SKU is restricted. */ + values?: string[]; + /** The reason for restriction. */ + reasonCode?: string; +} + +export interface SkuCapability { + /** An invariant to describe the feature. */ + name?: string; + /** An invariant if the feature is measured by quantity. */ + value?: string; } -/** - * An interface representing AppliedReservations. - */ export interface AppliedReservations { /** * Identifier of the applied reservations - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly id?: string; /** * Name of resource - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly name?: string; /** * Type of resource. "Microsoft.Capacity/AppliedReservations" - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly type?: string; reservationOrderIds?: AppliedReservationList; } -/** - * An interface representing OperationDisplay. - */ +export interface AppliedReservationList { + value?: string[]; + /** Url to get the next page of reservations */ + nextLink?: string; +} + +export interface PurchaseRequest { + sku?: SkuName; + /** The Azure Region where the reserved resource lives. */ + location?: string; + /** The type of the resource that is being reserved. */ + reservedResourceType?: ReservedResourceType; + /** Subscription that will be charged for purchasing Reservation */ + billingScopeId?: string; + /** Represent the term of Reservation. */ + term?: ReservationTerm; + /** Represent the billing plans. */ + billingPlan?: ReservationBillingPlan; + /** Quantity of the SKUs that are part of the Reservation. */ + quantity?: number; + /** Friendly name of the Reservation */ + displayName?: string; + /** Type of the Applied Scope. */ + appliedScopeType?: AppliedScopeType; + /** List of the subscriptions that the benefit will be applied. Do not specify if AppliedScopeType is Shared. */ + appliedScopes?: string[]; + /** Setting this to true will automatically purchase a new reservation on the expiration date time. */ + renew?: boolean; + /** Properties specific to each reserved resource type. Not required if not applicable. */ + reservedResourceProperties?: PurchaseRequestPropertiesReservedResourceProperties; +} + +export interface SkuName { + name?: string; +} + +/** Properties specific to each reserved resource type. Not required if not applicable. */ +export interface PurchaseRequestPropertiesReservedResourceProperties { + /** Turning this on will apply the reservation discount to other VMs in the same VM size group. Only specify for VirtualMachines reserved resource type. */ + instanceFlexibility?: InstanceFlexibility; +} + +export interface CalculatePriceResponse { + properties?: CalculatePriceResponseProperties; +} + +export interface CalculatePriceResponseProperties { + /** Currency and amount that customer will be charged in customer's local currency. Tax is not included. */ + billingCurrencyTotal?: CalculatePriceResponsePropertiesBillingCurrencyTotal; + /** Net total amount in pricing currency. */ + netTotal?: number; + /** Tax amount in pricing currency. */ + taxTotal?: number; + /** Total amount in pricing currency. */ + grandTotal?: number; + /** Whether or not tax is included in grand total */ + isTaxIncluded?: boolean; + /** True if billing is managed by Microsoft Partner. Used only for CSP accounts. */ + isBillingPartnerManaged?: boolean; + /** GUID that represents reservation order that can be placed after calculating price. */ + reservationOrderId?: string; + /** Title of SKU that is being purchased. */ + skuTitle?: string; + /** Description of SKU that is being purchased. */ + skuDescription?: string; + /** Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. */ + pricingCurrencyTotal?: CalculatePriceResponsePropertiesPricingCurrencyTotal; + paymentSchedule?: PaymentDetail[]; +} + +/** Currency and amount that customer will be charged in customer's local currency. Tax is not included. */ +export interface CalculatePriceResponsePropertiesBillingCurrencyTotal { + /** The ISO 4217 3-letter currency code for the currency used by this purchase record. */ + currencyCode?: string; + /** Amount in pricing currency. Tax is not included. */ + amount?: number; +} + +/** Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. */ +export interface CalculatePriceResponsePropertiesPricingCurrencyTotal { + /** The ISO 4217 3-letter currency code for the currency used by this purchase record. */ + currencyCode?: string; + amount?: number; +} + +/** Information about payment related to a reservation order. */ +export interface PaymentDetail { + /** Date when the payment needs to be done. */ + dueDate?: Date; + /** Date when the transaction is completed. Is null when it is scheduled. */ + paymentDate?: Date; + /** Amount in pricing currency. Tax not included. */ + pricingCurrencyTotal?: Price; + /** Amount charged in Billing currency. Tax not included. Is null for future payments */ + billingCurrencyTotal?: Price; + /** Shows the Account that is charged for this payment. */ + billingAccount?: string; + /** Describes whether the payment is completed, failed, cancelled or scheduled in the future. */ + status?: PaymentStatus; + extendedStatusInfo?: ExtendedStatusInfo; +} + +export interface ExtendedStatusInfo { + statusCode?: ReservationStatusCode; + /** The message giving detailed information about the status code. */ + message?: string; +} + +export interface ReservationOrderList { + value?: ReservationOrderResponse[]; + /** Url to get the next page of reservationOrders. */ + nextLink?: string; +} + +export interface ReservationOrderResponse { + etag?: number; + /** + * Identifier of the reservation + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * Name of the reservation + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Type of resource. "Microsoft.Capacity/reservations" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * Metadata pertaining to creation and last modification of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; + /** Friendly name for user to easily identified the reservation. */ + displayName?: string; + /** This is the DateTime when the reservation was initially requested for purchase. */ + requestDateTime?: Date; + /** This is the DateTime when the reservation was created. */ + createdDateTime?: Date; + /** This is the date when the Reservation will expire. */ + expiryDate?: Date; + /** Total Quantity of the SKUs purchased in the Reservation. */ + originalQuantity?: number; + /** Represent the term of Reservation. */ + term?: ReservationTerm; + /** Current state of the reservation. */ + provisioningState?: ProvisioningState; + /** Represent the billing plans. */ + billingPlan?: ReservationBillingPlan; + /** Information describing the type of billing plan for this reservation. */ + planInformation?: ReservationOrderBillingPlanInformation; + reservations?: ReservationResponse[]; +} + +/** Information describing the type of billing plan for this reservation. */ +export interface ReservationOrderBillingPlanInformation { + /** Amount of money to be paid for the Order. Tax is not included. */ + pricingCurrencyTotal?: Price; + /** Date when the billing plan has started. */ + startDate?: Date; + /** For recurring billing plans, indicates the date when next payment will be processed. Null when total is paid off. */ + nextPaymentDueDate?: Date; + transactions?: PaymentDetail[]; +} + +/** The definition of the reservation. */ +export interface ReservationResponse { + /** The Azure Region where the reserved resource lives. */ + location?: string; + etag?: number; + /** + * Identifier of the reservation + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * Name of the reservation + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** The sku information associated to this reservation */ + sku?: SkuName; + /** The properties associated to this reservation */ + properties?: ReservationsProperties; + /** + * Type of resource. "Microsoft.Capacity/reservationOrders/reservations" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** Resource Provider type to be reserved. */ + kind?: "Microsoft.Compute"; + /** + * Metadata pertaining to creation and last modification of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** The properties of the reservations */ +export interface ReservationsProperties { + /** The type of the resource that is being reserved. */ + reservedResourceType?: ReservedResourceType; + /** Allows reservation discount to be applied across skus within the same Autofit group. Not all skus support instance size flexibility. */ + instanceFlexibility?: InstanceFlexibility; + /** Friendly name for user to easily identify the reservation */ + displayName?: string; + /** The list of applied scopes */ + appliedScopes?: string[]; + /** The applied scope type */ + appliedScopeType?: AppliedScopeType; + /** Indicates if the reservation is archived */ + archived?: boolean; + /** Capabilities of the reservation */ + capabilities?: string; + /** Quantity of the SKUs that are part of the Reservation. */ + quantity?: number; + /** Current state of the reservation. */ + provisioningState?: ProvisioningState; + /** DateTime of the Reservation starting when this version is effective from. */ + effectiveDateTime?: Date; + /** + * DateTime of the last time the Reservation was updated. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastUpdatedDateTime?: Date; + /** This is the date when the Reservation will expire. */ + expiryDate?: Date; + /** Description of the SKU in english. */ + skuDescription?: string; + /** The message giving detailed information about the status code. */ + extendedStatusInfo?: ExtendedStatusInfo; + /** The billing plan options available for this SKU. */ + billingPlan?: ReservationBillingPlan; + /** + * The provisioning state of the reservation for display, e.g. Succeeded + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly displayProvisioningState?: string; + /** + * The provisioning state of the reservation, e.g. Succeeded + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningSubState?: string; + /** This is the date when the Reservation was purchased. */ + purchaseDate?: Date; + splitProperties?: ReservationSplitProperties; + mergeProperties?: ReservationMergeProperties; + /** Subscription that will be charged for purchasing Reservation */ + billingScopeId?: string; + /** Setting this to true will automatically purchase a new reservation on the expiration date time. */ + renew?: boolean; + /** Reservation Id of the reservation from which this reservation is renewed. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. */ + renewSource?: string; + /** Reservation Id of the reservation which is purchased because of renew. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}. */ + renewDestination?: string; + renewProperties?: RenewPropertiesResponse; + /** Represent the term of Reservation. */ + term?: ReservationTerm; + /** + * The applied scope type of the reservation for display, e.g. Shared + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly userFriendlyAppliedScopeType?: string; + /** + * The renew state of the reservation for display, e.g. On + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly userFriendlyRenewState?: string; + /** + * Reservation utilization + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly utilization?: ReservationsPropertiesUtilization; +} + +export interface ReservationSplitProperties { + /** List of destination Resource Id that are created due to split. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} */ + splitDestinations?: string[]; + /** Resource Id of the Reservation from which this is split. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} */ + splitSource?: string; +} + +export interface ReservationMergeProperties { + /** Reservation Resource Id Created due to the merge. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} */ + mergeDestination?: string; + /** Resource Ids of the Source Reservation's merged to form this Reservation. Format of the resource Id is /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} */ + mergeSources?: string[]; +} + +export interface RenewPropertiesResponse { + purchaseProperties?: PurchaseRequest; + /** Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. This is locked price 30 days before expiry. */ + pricingCurrencyTotal?: RenewPropertiesResponsePricingCurrencyTotal; + /** Currency and amount that customer will be charged in customer's local currency for renewal purchase. Tax is not included. */ + billingCurrencyTotal?: RenewPropertiesResponseBillingCurrencyTotal; +} + +/** Amount that Microsoft uses for record. Used during refund for calculating refund limit. Tax is not included. This is locked price 30 days before expiry. */ +export interface RenewPropertiesResponsePricingCurrencyTotal { + /** The ISO 4217 3-letter currency code for the currency used by this purchase record. */ + currencyCode?: string; + amount?: number; +} + +/** Currency and amount that customer will be charged in customer's local currency for renewal purchase. Tax is not included. */ +export interface RenewPropertiesResponseBillingCurrencyTotal { + /** The ISO 4217 3-letter currency code for the currency used by this purchase record. */ + currencyCode?: string; + amount?: number; +} + +/** Reservation utilization */ +export interface ReservationsPropertiesUtilization { + /** + * The number of days trend for a reservation + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly trend?: string; + /** The array of aggregates of a reservation's utilization */ + aggregates?: ReservationUtilizationAggregates[]; +} + +/** The aggregate values of reservation utilization */ +export interface ReservationUtilizationAggregates { + /** + * The grain of the aggregate + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly grain?: number; + /** + * The grain unit of the aggregate + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly grainUnit?: string; + /** + * The aggregate value + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: number; + /** + * The aggregate value unit + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly valueUnit?: string; +} + +/** 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 interface SplitRequest { + /** List of the quantities in the new reservations to create. */ + quantities?: number[]; + /** Resource id of the reservation to be split. Format of the resource id should be /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} */ + reservationId?: string; +} + +export interface MergeRequest { + /** Format of the resource id should be /providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId} */ + sources?: string[]; +} + +export interface ReservationList { + value?: ReservationResponse[]; + /** Url to get the next page of reservations. */ + nextLink?: string; +} + +export interface Patch { + /** Type of the Applied Scope. */ + appliedScopeType?: AppliedScopeType; + /** List of the subscriptions that the benefit will be applied. Do not specify if AppliedScopeType is Shared. */ + appliedScopes?: string[]; + /** Turning this on will apply the reservation discount to other VMs in the same VM size group. Only specify for VirtualMachines reserved resource type. */ + instanceFlexibility?: InstanceFlexibility; + /** Name of the Reservation */ + name?: string; + /** Setting this to true will automatically purchase a new reservation on the expiration date time. */ + renew?: boolean; + renewProperties?: PatchPropertiesRenewProperties; +} + +export interface PatchPropertiesRenewProperties { + purchaseProperties?: PurchaseRequest; +} + +export interface OperationList { + value?: OperationResponse[]; + /** Url to get the next page of items. */ + nextLink?: string; +} + +export interface OperationResponse { + /** Name of the operation */ + name?: string; + /** Indicates whether the operation is a data action */ + isDataAction?: boolean; + /** Display of the operation */ + display?: OperationDisplay; + /** Origin of the operation */ + origin?: string; + /** Properties of the operation */ + properties?: Record; +} + export interface OperationDisplay { provider?: string; resource?: string; @@ -894,1425 +565,1511 @@ export interface OperationDisplay { description?: string; } -/** - * An interface representing OperationResponse. - */ -export interface OperationResponse { +/** Calculate exchange request */ +export interface CalculateExchangeRequest { + /** Calculate exchange request properties */ + properties?: CalculateExchangeRequestProperties; +} + +/** Calculate exchange request properties */ +export interface CalculateExchangeRequestProperties { + /** List of reservations that are being purchased in this exchange. */ + reservationsToPurchase?: PurchaseRequest[]; + /** List of reservations that are being returned in this exchange. */ + reservationsToExchange?: ReservationToReturn[]; +} + +/** Reservation to return */ +export interface ReservationToReturn { + /** Fully qualified identifier of the Reservation being returned */ + reservationId?: string; + /** Quantity to be returned. Must be greater than zero. */ + quantity?: number; +} + +/** CalculateExchange operation result */ +export interface CalculateExchangeOperationResultResponse { + /** It should match what is used to GET the operation result. */ + id?: string; + /** It must match the last segment of the id field, and will typically be a GUID / system generated value. */ name?: string; - display?: OperationDisplay; - origin?: string; + /** Status of the operation. */ + status?: CalculateExchangeOperationResultStatus; + /** CalculateExchange response properties */ + properties?: CalculateExchangeResponseProperties; + /** Required if status == failed or status == canceled. */ + error?: OperationResultError; } -/** - * An interface representing ScopeProperties. - */ -export interface ScopeProperties { - scope?: string; - valid?: boolean; +/** CalculateExchange response properties */ +export interface CalculateExchangeResponseProperties { + /** Exchange session identifier */ + sessionId?: string; + netPayable?: Price; + refundsTotal?: Price; + purchasesTotal?: Price; + /** Details of the reservations being purchased */ + reservationsToPurchase?: ReservationToPurchaseCalculateExchange[]; + /** Details of the reservations being returned */ + reservationsToExchange?: ReservationToExchange[]; + /** Exchange policy errors */ + policyResult?: ExchangePolicyErrors; } -/** - * An interface representing SubscriptionScopeProperties. - */ -export interface SubscriptionScopeProperties { - scopes?: ScopeProperties[]; +/** Reservation purchase details */ +export interface ReservationToPurchaseCalculateExchange { + properties?: PurchaseRequest; + billingCurrencyTotal?: Price; } -/** - * An interface representing AvailableScopeProperties. - */ -export interface AvailableScopeProperties { - properties?: SubscriptionScopeProperties; +/** Reservation refund details */ +export interface ReservationToExchange { + /** Fully qualified id of the Reservation being returned. */ + reservationId?: string; + /** Quantity to be returned */ + quantity?: number; + billingRefundAmount?: Price; + /** billing information */ + billingInformation?: BillingInformation; } -/** - * Resource name provided by the resource provider. Use this property for quotaRequest parameter. - */ -export interface ResourceName { +/** billing information */ +export interface BillingInformation { + billingCurrencyTotalPaidAmount?: Price; + billingCurrencyProratedAmount?: Price; + billingCurrencyRemainingCommitmentAmount?: Price; +} + +/** Exchange policy errors */ +export interface ExchangePolicyErrors { + /** Exchange Policy errors */ + policyErrors?: ExchangePolicyError[]; +} + +/** error details */ +export interface ExchangePolicyError { + code?: string; + message?: string; +} + +/** Required if status == failed or status == canceled. */ +export interface OperationResultError { + /** Required if status == failed or status == cancelled. If status == failed, provide an invariant error code used for error troubleshooting, aggregation, and analysis. */ + code?: string; + /** Required if status == failed. Localized. If status == failed, provide an actionable error message indicating what error occurred, and what the user can do to address the issue. */ + message?: string; +} + +/** Exchange request */ +export interface ExchangeRequest { + /** Exchange request properties */ + properties?: ExchangeRequestProperties; +} + +/** Exchange request properties */ +export interface ExchangeRequestProperties { + /** SessionId that was returned by CalculateExchange API. */ + sessionId?: string; +} + +/** Exchange operation result */ +export interface ExchangeOperationResultResponse { + /** It should match what is used to GET the operation result. */ + id?: string; + /** It must match the last segment of the id field, and will typically be a GUID / system generated value. */ + name?: string; + /** Status of the operation. */ + status?: ExchangeOperationResultStatus; + /** Exchange response properties */ + properties?: ExchangeResponseProperties; + /** Required if status == failed or status == canceled. */ + error?: OperationResultError; +} + +/** Exchange response properties */ +export interface ExchangeResponseProperties { + /** Exchange session identifier */ + sessionId?: string; + netPayable?: Price; + refundsTotal?: Price; + purchasesTotal?: Price; + /** Details of the reservations being purchased */ + reservationsToPurchase?: ReservationToPurchaseExchange[]; + /** Details of the reservations being returned */ + reservationsToExchange?: ReservationToReturnForExchange[]; + /** Exchange policy errors */ + policyResult?: ExchangePolicyErrors; +} + +/** Reservation purchase details */ +export interface ReservationToPurchaseExchange { + /** Fully qualified id of the ReservationOrder being purchased */ + reservationOrderId?: string; + /** Fully qualified id of the Reservation being purchased. This value is only guaranteed to be non-null if the purchase is successful. */ + reservationId?: string; + properties?: PurchaseRequest; + billingCurrencyTotal?: Price; + /** Status of the individual operation. */ + status?: OperationStatus; +} + +/** Reservation refund details */ +export interface ReservationToReturnForExchange { + /** Fully qualified id of the Reservation being returned. */ + reservationId?: string; + /** Quantity to be returned */ + quantity?: number; + billingRefundAmount?: Price; + /** billing information */ + billingInformation?: BillingInformation; + /** Status of the individual operation. */ + status?: OperationStatus; +} + +/** The list of reservations and summary of roll out count of reservations in each state. */ +export interface ReservationsListResult { /** - * Resource name. + * The list of reservations. + * NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly value?: ReservationResponse[]; + /** + * The link (url) to the next page of results. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; + /** The roll out count summary of the reservations */ + summary?: ReservationSummary; +} + +/** The roll up count summary of reservations in each state */ +export interface ReservationSummary { + /** + * The number of reservation in Succeeded state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly succeededCount?: number; + /** + * The number of reservation in Failed state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly failedCount?: number; + /** + * The number of reservation in Expiring state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly expiringCount?: number; + /** + * The number of reservation in Expired state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly expiredCount?: number; + /** + * The number of reservation in Pending state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly pendingCount?: number; + /** + * The number of reservation in Cancelled state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly cancelledCount?: number; +} + +/** Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message. */ +export interface ErrorResponse { + /** The details of the error. */ + error?: ErrorDetails; +} + +/** The details of the error. */ +export interface ErrorDetails { + /** + * Error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * Error message indicating why the operation failed. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The target of the particular error. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; +} + +export interface ChangeDirectoryRequest { + /** Tenant id GUID that reservation order is to be transferred to */ + destinationTenantId?: string; +} + +/** Change directory response */ +export interface ChangeDirectoryResponse { + /** Change directory result for reservation order or reservation */ + reservationOrder?: ChangeDirectoryResult; + reservations?: ChangeDirectoryResult[]; +} + +/** Change directory result for reservation order or reservation */ +export interface ChangeDirectoryResult { + /** Identifier of the reservation order or reservation */ + id?: string; + /** Name of the reservation order or reservation */ + name?: string; + /** True if change directory operation succeeded on this reservation order or reservation */ + isSucceeded?: boolean; + /** Error reason if operation failed. Null otherwise */ + error?: string; +} + +/** Quota properties. */ +export interface CurrentQuotaLimitBase { + /** Quota properties for the resource. */ + properties?: QuotaProperties; +} + +/** Quota properties for the resource. */ +export interface QuotaProperties { + /** Quota properties. */ + limit?: number; + /** + * Current usage value for the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly currentValue?: number; + /** The limit units, such as **count** and **bytes**. Use the unit field provided in the response of the GET quota operation. */ + unit?: string; + /** Name of the resource provide by the resource provider. Use this property for quotaRequests resource operations. */ + name?: ResourceName; + /** The name of the resource type. */ + resourceType?: ResourceType; + /** + * The time period over which the quota usage values are summarized. For example, P1D (per one day), PT1M (per one minute), and PT1S (per one second). This parameter is optional because, for some resources such as compute, the time period is irrelevant. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly quotaPeriod?: string; + /** Additional properties for the specified resource provider. */ + properties?: Record; +} + +/** Resource name provided by the resource provider. Use this property for quotaRequest parameter. */ +export interface ResourceName { + /** Resource name. */ value?: string; /** * Resource display localized name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly localizedValue?: string; } -/** - * Quota properties for the resource. - */ -export interface QuotaProperties { - /** - * Quota properties. - */ - limit?: number; - /** - * Current usage value for the resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly currentValue?: number; - /** - * The limit units, such as **count** and **bytes**. Use the unit field provided in the response - * of the GET quota operation. - */ - unit?: string; - /** - * Name of the resource provide by the resource provider. Use this property for quotaRequests - * resource operations. - */ - name?: ResourceName; - /** - * The name of the resource type. - */ - resourceType?: any; - /** - * The time period over which the quota usage values are summarized. For example, P1D (per one - * day), PT1M (per one minute), and PT1S (per one second). This parameter is optional because, - * for some resources such as compute, the time period is irrelevant. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly quotaPeriod?: string; - /** - * Additional properties for the specified resource provider. - */ - properties?: any; +/** The API error. */ +export interface ExceptionResponse { + /** The API error details. */ + error?: ServiceError; } -/** - * Quota properties. - */ -export interface CurrentQuotaLimitBase extends BaseResource { - /** - * Quota properties for the resource. - */ - properties?: QuotaProperties; -} - -/** - * Current quota limits. - */ -export interface CurrentQuotaLimit extends BaseResource { - /** - * Quota properties for the resource. - */ - properties?: QuotaProperties; - /** - * The details of the quota request status. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly provisioningState?: any; - /** - * A user friendly message. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly message?: string; -} - -/** - * Quotas (service limits) in the request response. - */ -export interface QuotaLimitsResponse { - /** - * List of quotas with the quota request status. - */ - value?: CurrentQuotaLimit[]; - /** - * The URI for fetching the next page of quota limits. When no more pages exist, the value is - * null. - */ - nextLink?: string; -} - -/** - * Quota change requests information. - */ -export interface CreateGenericQuotaRequestParameters { - /** - * Quota change requests. - */ - value?: CurrentQuotaLimitBase[]; -} - -/** - * The sub-request submitted with the quota request. - */ -export interface SubRequest { - /** - * Quota (resource limit). - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly limit?: number; - /** - * The resource name. - */ - name?: ResourceName; - /** - * Resource type for which the quota check was made. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly resourceType?: string; - /** - * The limit units, such as **count** and **bytes**. Use the unit field provided in the response - * of the GET quota operation. - */ - unit?: string; - /** - * The quota request status. - */ - provisioningState?: any; - /** - * User-friendly status message. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly message?: string; - /** - * Sub request ID for individual request. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly subRequestId?: string; -} - -/** - * Response for the quota submission request. - */ -export interface QuotaRequestOneResourceSubmitResponse extends BaseResource { - /** - * The quota request ID. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * The name of the quota request. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * Type of resource. "Microsoft.Capacity/ServiceLimits" - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * The quota request status. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly provisioningState?: any; - /** - * User friendly status message. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly message?: string; - /** - * The time when the quota request was submitted using format: yyyy-MM-ddTHH:mm:ssZ as specified - * by the ISO 8601 standard. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly requestSubmitTime?: Date; - /** - * Quota properties for the resource. - */ - properties?: QuotaProperties; -} - -/** - * The details of quota request. - */ -export interface QuotaRequestProperties { - /** - * The quota request status. - */ - provisioningState?: any; - /** - * User friendly status message. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly message?: string; - /** - * The time when the quota request was submitted using format: yyyy-MM-ddTHH:mm:ssZ as specified - * by the ISO 8601 standard. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly requestSubmitTime?: Date; - /** - * The quotaRequests. - */ - value?: SubRequest[]; -} - -/** - * Response for the quota submission request. - */ -export interface QuotaRequestSubmitResponse extends BaseResource { - /** - * The quota request ID. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * The name of the quota request. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * The quota request details. - */ - properties?: QuotaRequestProperties; - /** - * Type of resource. "Microsoft.Capacity/serviceLimits" - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; -} - -/** - * Response with request ID that the quota request was accepted. - */ -export interface QuotaRequestSubmitResponse201 { - /** - * The quota request ID. Use the requestId parameter to check the request status. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * Operation ID - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * Resource type - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * The details of the quota request status. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly provisioningState?: any; - /** - * A user friendly message. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly message?: string; -} - -/** - * Quota request details. - */ -export interface QuotaRequestDetails extends BaseResource { - /** - * Quota request ID. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * Quota request name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * The quota request status. - */ - provisioningState?: any; - /** - * User friendly status message. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly message?: string; - /** - * The time when the quota request was submitted using format: yyyy-MM-ddTHH:mm:ssZ as specified - * by the ISO 8601 standard. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly requestSubmitTime?: Date; - /** - * The quotaRequests. - */ - value?: SubRequest[]; - /** - * Resource type - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; -} - -/** - * The error details. - */ -export interface ServiceErrorDetail { - /** - * The error code. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly code?: string; - /** - * The error message. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly message?: string; -} - -/** - * The API error details. - */ +/** The API error details. */ export interface ServiceError { - /** - * The error code. - */ + /** The error code. */ code?: string; - /** - * The error message text. - */ + /** The error message text. */ message?: string; /** * The list of error details. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly details?: ServiceErrorDetail[]; } -/** - * The API error. - */ -export interface ExceptionResponse { +/** The error details. */ +export interface ServiceErrorDetail { /** - * The API error details. + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - error?: ServiceError; + readonly code?: string; + /** + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; +} + +/** Response for the quota submission request. */ +export interface QuotaRequestOneResourceSubmitResponse { + /** + * The quota request ID. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The name of the quota request. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Type of resource. "Microsoft.Capacity/ServiceLimits" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The quota request status. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: QuotaRequestState; + /** + * User friendly status message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The time when the quota request was submitted using format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly requestSubmitTime?: Date; + /** Quota properties for the resource. */ + properties?: QuotaProperties; +} + +/** Response with request ID that the quota request was accepted. */ +export interface QuotaRequestSubmitResponse201 { + /** + * The quota request ID. Use the requestId parameter to check the request status. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * Operation ID + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Resource type + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The details of the quota request status. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: QuotaRequestState; + /** + * A user friendly message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; +} + +/** Quota limits. */ +export interface QuotaLimits { + /** List of quotas (service limits). */ + value?: CurrentQuotaLimitBase[]; + /** The URI for fetching the next page of quotas (service limits). When no more pages exist, the value is null. */ + nextLink?: string; +} + +/** Quota request details. */ +export interface QuotaRequestDetails { + /** + * Quota request ID. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * Quota request name. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Resource type + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** The quota request status. */ + provisioningState?: QuotaRequestState; + /** + * User friendly status message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The time when the quota request was submitted using format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly requestSubmitTime?: Date; + /** The quotaRequests. */ + value?: SubRequest[]; +} + +/** The details of quota request. */ +export interface QuotaRequestProperties { + /** The quota request status. */ + provisioningState?: QuotaRequestState; + /** + * User friendly status message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The time when the quota request was submitted using format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly requestSubmitTime?: Date; + /** The quotaRequests. */ + value?: SubRequest[]; +} + +/** The sub-request submitted with the quota request. */ +export interface SubRequest { + /** + * Quota (resource limit). + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly limit?: number; + /** The resource name. */ + name?: ResourceName; + /** + * Resource type for which the quota check was made. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resourceType?: string; + /** The limit units, such as **count** and **bytes**. Use the unit field provided in the response of the GET quota operation. */ + unit?: string; + /** The quota request status. */ + provisioningState?: QuotaRequestState; + /** + * User-friendly status message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * Sub request ID for individual request. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly subRequestId?: string; +} + +/** Quota request details. */ +export interface QuotaRequestDetailsList { + /** The quota requests. */ + value?: QuotaRequestDetails[]; + /** The URI to fetch the next page of quota limits. When there are no more pages, this is null. */ + nextLink?: string; +} + +/** Current quota limits. */ +export interface CurrentQuotaLimit { + /** + * The details of the quota request status. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: QuotaRequestState; + /** + * A user friendly message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** Quota properties for the resource. */ + properties?: QuotaProperties; +} + +/** Quotas (service limits) in the request response. */ +export interface QuotaLimitsResponse { + /** List of quotas with the quota request status. */ + value?: CurrentQuotaLimit[]; + /** The URI for fetching the next page of quota limits. When no more pages exist, the value is null. */ + nextLink?: string; +} + +/** Quota change requests information. */ +export interface CreateGenericQuotaRequestParameters { + /** Quota change requests. */ + value?: CurrentQuotaLimitBase[]; +} + +/** Response for the quota submission request. */ +export interface QuotaRequestSubmitResponse { + /** + * The quota request ID. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The name of the quota request. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** The quota request details. */ + properties?: QuotaRequestProperties; + /** + * Type of resource. "Microsoft.Capacity/serviceLimits" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; +} + +/** Defines headers for CalculateExchange_post operation. */ +export interface CalculateExchangePostHeaders { + /** URL for checking the ongoing status of the operation. */ + azureAsyncOperation?: string; + /** URL for determining when an operation has completed. Only use this value only when Azure-AsyncOperation isn't returned. */ + location?: string; + /** Clients should wait for the Retry-After interval before polling again */ + retryAfter?: number; +} + +/** Defines headers for Exchange_post operation. */ +export interface ExchangePostHeaders { + /** URL for checking the ongoing status of the operation. */ + azureAsyncOperation?: string; + /** URL for determining when an operation has completed. Only use this value only when Azure-AsyncOperation isn't returned. */ + location?: string; + /** Clients should wait for the Retry-After interval before polling again */ + retryAfter?: number; +} + +/** Defines headers for Quota_get operation. */ +export interface QuotaGetHeaders { + /** Current entity state version. It should be treated as opaque and used to make conditional HTTP requests. */ + eTag?: string; +} + +/** Defines headers for Quota_list operation. */ +export interface QuotaListHeaders { + /** Current entity state version. Should be treated as opaque and used to make conditional HTTP requests. */ + eTag?: string; +} + +/** Defines headers for Quota_listNext operation. */ +export interface QuotaListNextHeaders { + /** Current entity state version. Should be treated as opaque and used to make conditional HTTP requests. */ + eTag?: string; +} + +/** Known values of {@link ErrorResponseCode} that the service accepts. */ +export enum KnownErrorResponseCode { + NotSpecified = "NotSpecified", + InternalServerError = "InternalServerError", + ServerTimeout = "ServerTimeout", + AuthorizationFailed = "AuthorizationFailed", + BadRequest = "BadRequest", + ClientCertificateThumbprintNotSet = "ClientCertificateThumbprintNotSet", + InvalidRequestContent = "InvalidRequestContent", + OperationFailed = "OperationFailed", + HttpMethodNotSupported = "HttpMethodNotSupported", + InvalidRequestUri = "InvalidRequestUri", + MissingTenantId = "MissingTenantId", + InvalidTenantId = "InvalidTenantId", + InvalidReservationOrderId = "InvalidReservationOrderId", + InvalidReservationId = "InvalidReservationId", + ReservationIdNotInReservationOrder = "ReservationIdNotInReservationOrder", + ReservationOrderNotFound = "ReservationOrderNotFound", + InvalidSubscriptionId = "InvalidSubscriptionId", + InvalidAccessToken = "InvalidAccessToken", + InvalidLocationId = "InvalidLocationId", + UnauthenticatedRequestsThrottled = "UnauthenticatedRequestsThrottled", + InvalidHealthCheckType = "InvalidHealthCheckType", + Forbidden = "Forbidden", + BillingScopeIdCannotBeChanged = "BillingScopeIdCannotBeChanged", + AppliedScopesNotAssociatedWithCommerceAccount = "AppliedScopesNotAssociatedWithCommerceAccount", + PatchValuesSameAsExisting = "PatchValuesSameAsExisting", + RoleAssignmentCreationFailed = "RoleAssignmentCreationFailed", + ReservationOrderCreationFailed = "ReservationOrderCreationFailed", + ReservationOrderNotEnabled = "ReservationOrderNotEnabled", + CapacityUpdateScopesFailed = "CapacityUpdateScopesFailed", + UnsupportedReservationTerm = "UnsupportedReservationTerm", + ReservationOrderIdAlreadyExists = "ReservationOrderIdAlreadyExists", + RiskCheckFailed = "RiskCheckFailed", + CreateQuoteFailed = "CreateQuoteFailed", + ActivateQuoteFailed = "ActivateQuoteFailed", + NonsupportedAccountId = "NonsupportedAccountId", + PaymentInstrumentNotFound = "PaymentInstrumentNotFound", + MissingAppliedScopesForSingle = "MissingAppliedScopesForSingle", + NoValidReservationsToReRate = "NoValidReservationsToReRate", + ReRateOnlyAllowedForEA = "ReRateOnlyAllowedForEA", + OperationCannotBePerformedInCurrentState = "OperationCannotBePerformedInCurrentState", + InvalidSingleAppliedScopesCount = "InvalidSingleAppliedScopesCount", + InvalidFulfillmentRequestParameters = "InvalidFulfillmentRequestParameters", + NotSupportedCountry = "NotSupportedCountry", + InvalidRefundQuantity = "InvalidRefundQuantity", + PurchaseError = "PurchaseError", + BillingCustomerInputError = "BillingCustomerInputError", + BillingPaymentInstrumentSoftError = "BillingPaymentInstrumentSoftError", + BillingPaymentInstrumentHardError = "BillingPaymentInstrumentHardError", + BillingTransientError = "BillingTransientError", + BillingError = "BillingError", + FulfillmentConfigurationError = "FulfillmentConfigurationError", + FulfillmentOutOfStockError = "FulfillmentOutOfStockError", + FulfillmentTransientError = "FulfillmentTransientError", + FulfillmentError = "FulfillmentError", + CalculatePriceFailed = "CalculatePriceFailed", + AppliedScopesSameAsExisting = "AppliedScopesSameAsExisting" } /** - * Optional Parameters. + * Defines values for ErrorResponseCode. \ + * {@link KnownErrorResponseCode} can be used interchangeably with ErrorResponseCode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **NotSpecified** \ + * **InternalServerError** \ + * **ServerTimeout** \ + * **AuthorizationFailed** \ + * **BadRequest** \ + * **ClientCertificateThumbprintNotSet** \ + * **InvalidRequestContent** \ + * **OperationFailed** \ + * **HttpMethodNotSupported** \ + * **InvalidRequestUri** \ + * **MissingTenantId** \ + * **InvalidTenantId** \ + * **InvalidReservationOrderId** \ + * **InvalidReservationId** \ + * **ReservationIdNotInReservationOrder** \ + * **ReservationOrderNotFound** \ + * **InvalidSubscriptionId** \ + * **InvalidAccessToken** \ + * **InvalidLocationId** \ + * **UnauthenticatedRequestsThrottled** \ + * **InvalidHealthCheckType** \ + * **Forbidden** \ + * **BillingScopeIdCannotBeChanged** \ + * **AppliedScopesNotAssociatedWithCommerceAccount** \ + * **PatchValuesSameAsExisting** \ + * **RoleAssignmentCreationFailed** \ + * **ReservationOrderCreationFailed** \ + * **ReservationOrderNotEnabled** \ + * **CapacityUpdateScopesFailed** \ + * **UnsupportedReservationTerm** \ + * **ReservationOrderIdAlreadyExists** \ + * **RiskCheckFailed** \ + * **CreateQuoteFailed** \ + * **ActivateQuoteFailed** \ + * **NonsupportedAccountId** \ + * **PaymentInstrumentNotFound** \ + * **MissingAppliedScopesForSingle** \ + * **NoValidReservationsToReRate** \ + * **ReRateOnlyAllowedForEA** \ + * **OperationCannotBePerformedInCurrentState** \ + * **InvalidSingleAppliedScopesCount** \ + * **InvalidFulfillmentRequestParameters** \ + * **NotSupportedCountry** \ + * **InvalidRefundQuantity** \ + * **PurchaseError** \ + * **BillingCustomerInputError** \ + * **BillingPaymentInstrumentSoftError** \ + * **BillingPaymentInstrumentHardError** \ + * **BillingTransientError** \ + * **BillingError** \ + * **FulfillmentConfigurationError** \ + * **FulfillmentOutOfStockError** \ + * **FulfillmentTransientError** \ + * **FulfillmentError** \ + * **CalculatePriceFailed** \ + * **AppliedScopesSameAsExisting** */ -export interface ReservationGetOptionalParams extends msRest.RequestOptionsBase { - /** - * Supported value of this query is renewProperties - */ +export type ErrorResponseCode = string; + +/** Known values of {@link ReservationBillingPlan} that the service accepts. */ +export enum KnownReservationBillingPlan { + Upfront = "Upfront", + Monthly = "Monthly" +} + +/** + * Defines values for ReservationBillingPlan. \ + * {@link KnownReservationBillingPlan} can be used interchangeably with ReservationBillingPlan, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Upfront** \ + * **Monthly** + */ +export type ReservationBillingPlan = string; + +/** Known values of {@link ReservationTerm} that the service accepts. */ +export enum KnownReservationTerm { + P1Y = "P1Y", + P3Y = "P3Y", + P5Y = "P5Y" +} + +/** + * Defines values for ReservationTerm. \ + * {@link KnownReservationTerm} can be used interchangeably with ReservationTerm, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **P1Y** \ + * **P3Y** \ + * **P5Y** + */ +export type ReservationTerm = string; + +/** Known values of {@link ReservedResourceType} that the service accepts. */ +export enum KnownReservedResourceType { + VirtualMachines = "VirtualMachines", + SqlDatabases = "SqlDatabases", + SuseLinux = "SuseLinux", + CosmosDb = "CosmosDb", + RedHat = "RedHat", + SqlDataWarehouse = "SqlDataWarehouse", + VMwareCloudSimple = "VMwareCloudSimple", + RedHatOsa = "RedHatOsa", + Databricks = "Databricks", + AppService = "AppService", + ManagedDisk = "ManagedDisk", + BlockBlob = "BlockBlob", + RedisCache = "RedisCache", + AzureDataExplorer = "AzureDataExplorer", + MySql = "MySql", + MariaDb = "MariaDb", + PostgreSql = "PostgreSql", + DedicatedHost = "DedicatedHost", + SapHana = "SapHana", + SqlAzureHybridBenefit = "SqlAzureHybridBenefit", + AVS = "AVS", + DataFactory = "DataFactory", + NetAppStorage = "NetAppStorage", + AzureFiles = "AzureFiles", + SqlEdge = "SqlEdge" +} + +/** + * Defines values for ReservedResourceType. \ + * {@link KnownReservedResourceType} can be used interchangeably with ReservedResourceType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **VirtualMachines** \ + * **SqlDatabases** \ + * **SuseLinux** \ + * **CosmosDb** \ + * **RedHat** \ + * **SqlDataWarehouse** \ + * **VMwareCloudSimple** \ + * **RedHatOsa** \ + * **Databricks** \ + * **AppService** \ + * **ManagedDisk** \ + * **BlockBlob** \ + * **RedisCache** \ + * **AzureDataExplorer** \ + * **MySql** \ + * **MariaDb** \ + * **PostgreSql** \ + * **DedicatedHost** \ + * **SapHana** \ + * **SqlAzureHybridBenefit** \ + * **AVS** \ + * **DataFactory** \ + * **NetAppStorage** \ + * **AzureFiles** \ + * **SqlEdge** + */ +export type ReservedResourceType = string; + +/** Known values of {@link AppliedScopeType} that the service accepts. */ +export enum KnownAppliedScopeType { + Single = "Single", + Shared = "Shared" +} + +/** + * Defines values for AppliedScopeType. \ + * {@link KnownAppliedScopeType} can be used interchangeably with AppliedScopeType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Single** \ + * **Shared** + */ +export type AppliedScopeType = string; + +/** Known values of {@link InstanceFlexibility} that the service accepts. */ +export enum KnownInstanceFlexibility { + On = "On", + Off = "Off" +} + +/** + * Defines values for InstanceFlexibility. \ + * {@link KnownInstanceFlexibility} can be used interchangeably with InstanceFlexibility, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **On** \ + * **Off** + */ +export type InstanceFlexibility = string; + +/** Known values of {@link PaymentStatus} that the service accepts. */ +export enum KnownPaymentStatus { + Succeeded = "Succeeded", + Failed = "Failed", + Scheduled = "Scheduled", + Cancelled = "Cancelled" +} + +/** + * Defines values for PaymentStatus. \ + * {@link KnownPaymentStatus} can be used interchangeably with PaymentStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Failed** \ + * **Scheduled** \ + * **Cancelled** + */ +export type PaymentStatus = string; + +/** Known values of {@link ReservationStatusCode} that the service accepts. */ +export enum KnownReservationStatusCode { + None = "None", + Pending = "Pending", + Active = "Active", + PurchaseError = "PurchaseError", + PaymentInstrumentError = "PaymentInstrumentError", + Split = "Split", + Merged = "Merged", + Expired = "Expired", + Succeeded = "Succeeded" +} + +/** + * Defines values for ReservationStatusCode. \ + * {@link KnownReservationStatusCode} can be used interchangeably with ReservationStatusCode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **Pending** \ + * **Active** \ + * **PurchaseError** \ + * **PaymentInstrumentError** \ + * **Split** \ + * **Merged** \ + * **Expired** \ + * **Succeeded** + */ +export type ReservationStatusCode = string; + +/** Known values of {@link ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + Creating = "Creating", + PendingResourceHold = "PendingResourceHold", + ConfirmedResourceHold = "ConfirmedResourceHold", + PendingBilling = "PendingBilling", + ConfirmedBilling = "ConfirmedBilling", + Created = "Created", + Succeeded = "Succeeded", + Cancelled = "Cancelled", + Expired = "Expired", + BillingFailed = "BillingFailed", + Failed = "Failed", + Split = "Split", + Merged = "Merged" +} + +/** + * Defines values for ProvisioningState. \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Creating** \ + * **PendingResourceHold** \ + * **ConfirmedResourceHold** \ + * **PendingBilling** \ + * **ConfirmedBilling** \ + * **Created** \ + * **Succeeded** \ + * **Cancelled** \ + * **Expired** \ + * **BillingFailed** \ + * **Failed** \ + * **Split** \ + * **Merged** + */ +export type ProvisioningState = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + User = "User", + Application = "Application", + ManagedIdentity = "ManagedIdentity", + Key = "Key" +} + +/** + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** + */ +export type CreatedByType = string; + +/** Known values of {@link CalculateExchangeOperationResultStatus} that the service accepts. */ +export enum KnownCalculateExchangeOperationResultStatus { + Succeeded = "Succeeded", + Failed = "Failed", + Cancelled = "Cancelled", + Pending = "Pending" +} + +/** + * Defines values for CalculateExchangeOperationResultStatus. \ + * {@link KnownCalculateExchangeOperationResultStatus} can be used interchangeably with CalculateExchangeOperationResultStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Failed** \ + * **Cancelled** \ + * **Pending** + */ +export type CalculateExchangeOperationResultStatus = string; + +/** Known values of {@link ExchangeOperationResultStatus} that the service accepts. */ +export enum KnownExchangeOperationResultStatus { + Succeeded = "Succeeded", + Failed = "Failed", + Cancelled = "Cancelled", + PendingRefunds = "PendingRefunds", + PendingPurchases = "PendingPurchases" +} + +/** + * Defines values for ExchangeOperationResultStatus. \ + * {@link KnownExchangeOperationResultStatus} can be used interchangeably with ExchangeOperationResultStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Failed** \ + * **Cancelled** \ + * **PendingRefunds** \ + * **PendingPurchases** + */ +export type ExchangeOperationResultStatus = string; + +/** Known values of {@link OperationStatus} that the service accepts. */ +export enum KnownOperationStatus { + Succeeded = "Succeeded", + Failed = "Failed", + Cancelled = "Cancelled", + Pending = "Pending" +} + +/** + * Defines values for OperationStatus. \ + * {@link KnownOperationStatus} can be used interchangeably with OperationStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Failed** \ + * **Cancelled** \ + * **Pending** + */ +export type OperationStatus = string; + +/** Known values of {@link ResourceType} that the service accepts. */ +export enum KnownResourceType { + Standard = "standard", + Dedicated = "dedicated", + LowPriority = "lowPriority", + Shared = "shared", + ServiceSpecific = "serviceSpecific" +} + +/** + * Defines values for ResourceType. \ + * {@link KnownResourceType} can be used interchangeably with ResourceType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **standard** \ + * **dedicated** \ + * **lowPriority** \ + * **shared** \ + * **serviceSpecific** + */ +export type ResourceType = string; + +/** Known values of {@link QuotaRequestState} that the service accepts. */ +export enum KnownQuotaRequestState { + Accepted = "Accepted", + Invalid = "Invalid", + Succeeded = "Succeeded", + Failed = "Failed", + InProgress = "InProgress" +} + +/** + * Defines values for QuotaRequestState. \ + * {@link KnownQuotaRequestState} can be used interchangeably with QuotaRequestState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Accepted** \ + * **Invalid** \ + * **Succeeded** \ + * **Failed** \ + * **InProgress** + */ +export type QuotaRequestState = string; + +/** Known values of {@link Location} that the service accepts. */ +export enum KnownLocation { + Westus = "westus", + Eastus = "eastus", + Eastus2 = "eastus2", + Northcentralus = "northcentralus", + Westus2 = "westus2", + Southcentralus = "southcentralus", + Centralus = "centralus", + Westeurope = "westeurope", + Northeurope = "northeurope", + Eastasia = "eastasia", + Southeastasia = "southeastasia", + Japaneast = "japaneast", + Japanwest = "japanwest", + Brazilsouth = "brazilsouth", + Australiaeast = "australiaeast", + Australiasoutheast = "australiasoutheast", + Southindia = "southindia", + Westindia = "westindia", + Centralindia = "centralindia", + Canadacentral = "canadacentral", + Canadaeast = "canadaeast", + Uksouth = "uksouth", + Westcentralus = "westcentralus", + Ukwest = "ukwest" +} + +/** + * Defines values for Location. \ + * {@link KnownLocation} can be used interchangeably with Location, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **westus** \ + * **eastus** \ + * **eastus2** \ + * **northcentralus** \ + * **westus2** \ + * **southcentralus** \ + * **centralus** \ + * **westeurope** \ + * **northeurope** \ + * **eastasia** \ + * **southeastasia** \ + * **japaneast** \ + * **japanwest** \ + * **brazilsouth** \ + * **australiaeast** \ + * **australiasoutheast** \ + * **southindia** \ + * **westindia** \ + * **centralindia** \ + * **canadacentral** \ + * **canadaeast** \ + * **uksouth** \ + * **westcentralus** \ + * **ukwest** + */ +export type Location = string; + +/** Known values of {@link DisplayProvisioningState} that the service accepts. */ +export enum KnownDisplayProvisioningState { + Succeeded = "Succeeded", + Expiring = "Expiring", + Expired = "Expired", + Pending = "Pending", + Cancelled = "Cancelled", + Failed = "Failed" +} + +/** + * Defines values for DisplayProvisioningState. \ + * {@link KnownDisplayProvisioningState} can be used interchangeably with DisplayProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Expiring** \ + * **Expired** \ + * **Pending** \ + * **Cancelled** \ + * **Failed** + */ +export type DisplayProvisioningState = string; + +/** Known values of {@link UserFriendlyAppliedScopeType} that the service accepts. */ +export enum KnownUserFriendlyAppliedScopeType { + None = "None", + Shared = "Shared", + Single = "Single", + ResourceGroup = "ResourceGroup", + ManagementGroup = "ManagementGroup" +} + +/** + * Defines values for UserFriendlyAppliedScopeType. \ + * {@link KnownUserFriendlyAppliedScopeType} can be used interchangeably with UserFriendlyAppliedScopeType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **Shared** \ + * **Single** \ + * **ResourceGroup** \ + * **ManagementGroup** + */ +export type UserFriendlyAppliedScopeType = string; + +/** Known values of {@link UserFriendlyRenewState} that the service accepts. */ +export enum KnownUserFriendlyRenewState { + On = "On", + Off = "Off", + Renewed = "Renewed", + NotRenewed = "NotRenewed", + NotApplicable = "NotApplicable" +} + +/** + * Defines values for UserFriendlyRenewState. \ + * {@link KnownUserFriendlyRenewState} can be used interchangeably with UserFriendlyRenewState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **On** \ + * **Off** \ + * **Renewed** \ + * **NotRenewed** \ + * **NotApplicable** + */ +export type UserFriendlyRenewState = string; + +/** Optional parameters. */ +export interface ReservationAvailableScopesOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the availableScopes operation. */ +export type ReservationAvailableScopesResponse = AvailableScopeProperties; + +/** Optional parameters. */ +export interface ReservationSplitOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the split operation. */ +export type ReservationSplitResponse = ReservationResponse[]; + +/** Optional parameters. */ +export interface ReservationMergeOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the merge operation. */ +export type ReservationMergeResponse = ReservationResponse[]; + +/** Optional parameters. */ +export interface ReservationListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type ReservationListResponse = ReservationList; + +/** Optional parameters. */ +export interface ReservationGetOptionalParams + extends coreClient.OperationOptions { + /** Supported value of this query is renewProperties */ expand?: string; } -/** - * Optional Parameters. - */ -export interface AzureReservationAPIGetCatalogOptionalParams extends msRest.RequestOptionsBase { - /** - * Filters the skus based on the location specified in this parameter. This can be an azure - * region or global - */ +/** Contains response data for the get operation. */ +export type ReservationGetResponse = ReservationResponse; + +/** Optional parameters. */ +export interface ReservationUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the update operation. */ +export type ReservationUpdateResponse = ReservationResponse; + +/** Optional parameters. */ +export interface ReservationListRevisionsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listRevisions operation. */ +export type ReservationListRevisionsResponse = ReservationList; + +/** Optional parameters. */ +export interface ReservationListAllOptionalParams + extends coreClient.OperationOptions { + /** May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does not currently support 'ne', 'gt', 'le', 'ge', or 'not'. Reservation properties include sku/name, properties/{appliedScopeType, archived, displayName, displayProvisioningState, effectiveDateTime, expiryDate, provisioningState, quantity, renew, reservedResourceType, term, userFriendlyAppliedScopeType, userFriendlyRenewState} */ + filter?: string; + /** May be used to sort order by reservation properties. */ + orderby?: string; + /** To indicate whether to refresh the roll up counts of the reservations group by provisioning states */ + refreshSummary?: string; + /** The number of reservations to skip from the list before returning results */ + skiptoken?: number; + /** The selected provisioning state */ + selectedState?: string; + /** To number of reservations to return */ + take?: number; +} + +/** Contains response data for the listAll operation. */ +export type ReservationListAllResponse = ReservationsListResult; + +/** Optional parameters. */ +export interface ReservationListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type ReservationListNextResponse = ReservationList; + +/** Optional parameters. */ +export interface ReservationListRevisionsNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listRevisionsNext operation. */ +export type ReservationListRevisionsNextResponse = ReservationList; + +/** Optional parameters. */ +export interface ReservationListAllNextOptionalParams + extends coreClient.OperationOptions { + /** May be used to filter by reservation properties. The filter supports 'eq', 'or', and 'and'. It does not currently support 'ne', 'gt', 'le', 'ge', or 'not'. Reservation properties include sku/name, properties/{appliedScopeType, archived, displayName, displayProvisioningState, effectiveDateTime, expiryDate, provisioningState, quantity, renew, reservedResourceType, term, userFriendlyAppliedScopeType, userFriendlyRenewState} */ + filter?: string; + /** May be used to sort order by reservation properties. */ + orderby?: string; + /** To indicate whether to refresh the roll up counts of the reservations group by provisioning states */ + refreshSummary?: string; + /** The number of reservations to skip from the list before returning results */ + skiptoken?: number; + /** The selected provisioning state */ + selectedState?: string; + /** To number of reservations to return */ + take?: number; +} + +/** Contains response data for the listAllNext operation. */ +export type ReservationListAllNextResponse = ReservationsListResult; + +/** Optional parameters. */ +export interface GetCatalogOptionalParams extends coreClient.OperationOptions { + /** The type of the resource for which the skus should be provided. */ + reservedResourceType?: string; + /** Filters the skus based on the location specified in this parameter. This can be an azure region or global */ location?: string; } -/** - * Optional Parameters. - */ -export interface ReservationOrderGetOptionalParams extends msRest.RequestOptionsBase { - /** - * May be used to expand the planInformation. - */ +/** Contains response data for the getCatalog operation. */ +export type GetCatalogResponse = Catalog[]; + +/** Optional parameters. */ +export interface GetAppliedReservationListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getAppliedReservationList operation. */ +export type GetAppliedReservationListResponse = AppliedReservations; + +/** Optional parameters. */ +export interface ReservationOrderCalculateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the calculate operation. */ +export type ReservationOrderCalculateResponse = CalculatePriceResponse; + +/** Optional parameters. */ +export interface ReservationOrderListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type ReservationOrderListResponse = ReservationOrderList; + +/** Optional parameters. */ +export interface ReservationOrderPurchaseOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the purchase operation. */ +export type ReservationOrderPurchaseResponse = ReservationOrderResponse; + +/** Optional parameters. */ +export interface ReservationOrderGetOptionalParams + extends coreClient.OperationOptions { + /** May be used to expand the planInformation. */ expand?: string; } -/** - * Optional Parameters. - */ -export interface QuotaRequestStatusListOptionalParams extends msRest.RequestOptionsBase { +/** Contains response data for the get operation. */ +export type ReservationOrderGetResponse = ReservationOrderResponse; + +/** Optional parameters. */ +export interface ReservationOrderChangeDirectoryOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the changeDirectory operation. */ +export type ReservationOrderChangeDirectoryResponse = ChangeDirectoryResponse; + +/** Optional parameters. */ +export interface ReservationOrderListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type ReservationOrderListNextResponse = ReservationOrderList; + +/** Optional parameters. */ +export interface OperationListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OperationListResponse = OperationList; + +/** Optional parameters. */ +export interface OperationListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OperationListNextResponse = OperationList; + +/** Optional parameters. */ +export interface CalculateExchangePostOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the post operation. */ +export type CalculateExchangePostResponse = CalculateExchangeOperationResultResponse; + +/** Optional parameters. */ +export interface ExchangePostOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the post operation. */ +export type ExchangePostResponse = ExchangeOperationResultResponse; + +/** Optional parameters. */ +export interface QuotaGetOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type QuotaGetResponse = QuotaGetHeaders & CurrentQuotaLimitBase; + +/** Optional parameters. */ +export interface QuotaCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type QuotaCreateOrUpdateResponse = QuotaRequestOneResourceSubmitResponse; + +/** Optional parameters. */ +export interface QuotaUpdateOptionalParams extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the update operation. */ +export type QuotaUpdateResponse = QuotaRequestOneResourceSubmitResponse; + +/** Optional parameters. */ +export interface QuotaListOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type QuotaListResponse = QuotaListHeaders & QuotaLimits; + +/** Optional parameters. */ +export interface QuotaListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type QuotaListNextResponse = QuotaListNextHeaders & QuotaLimits; + +/** Optional parameters. */ +export interface QuotaRequestStatusGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type QuotaRequestStatusGetResponse = QuotaRequestDetails; + +/** Optional parameters. */ +export interface QuotaRequestStatusListOptionalParams + extends coreClient.OperationOptions { /** * | Field | Supported operators * |---------------------|------------------------ * * |requestSubmitTime | ge, le, eq, gt, lt + * */ filter?: string; - /** - * Number of records to return. - */ + /** Number of records to return. */ top?: number; - /** - * Skiptoken is only used if a previous operation returned a partial result. If a previous - * response contains a nextLink element, the value of the nextLink element includes a skiptoken - * parameter that specifies a starting point to use for subsequent calls. - */ + /** Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element includes a skiptoken parameter that specifies a starting point to use for subsequent calls. */ skiptoken?: string; } -/** - * Optional Parameters. - */ -export interface QuotaRequestStatusListNextOptionalParams extends msRest.RequestOptionsBase { +/** Contains response data for the list operation. */ +export type QuotaRequestStatusListResponse = QuotaRequestDetailsList; + +/** Optional parameters. */ +export interface QuotaRequestStatusListNextOptionalParams + extends coreClient.OperationOptions { /** * | Field | Supported operators * |---------------------|------------------------ * * |requestSubmitTime | ge, le, eq, gt, lt + * */ filter?: string; - /** - * Number of records to return. - */ + /** Number of records to return. */ top?: number; - /** - * Skiptoken is only used if a previous operation returned a partial result. If a previous - * response contains a nextLink element, the value of the nextLink element includes a skiptoken - * parameter that specifies a starting point to use for subsequent calls. - */ + /** Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element includes a skiptoken parameter that specifies a starting point to use for subsequent calls. */ skiptoken?: string; } -/** - * An interface representing AzureReservationAPIOptions. - */ -export interface AzureReservationAPIOptions extends AzureServiceClientOptions { - baseUri?: string; +/** Contains response data for the listNext operation. */ +export type QuotaRequestStatusListNextResponse = QuotaRequestDetailsList; + +/** Optional parameters. */ +export interface AzureReservationAPIOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Overrides client endpoint. */ + endpoint?: string; } - -/** - * Defines headers for Post operation. - */ -export interface CalculateExchangePostHeaders { - /** - * URL for checking the ongoing status of the operation. - */ - azureAsyncOperation: string; - /** - * URL for determining when an operation has completed. Only use this value only when - * Azure-AsyncOperation isn't returned. - */ - location: string; - /** - * Clients should wait for the Retry-After interval before polling again - */ - retryAfter: number; -} - -/** - * Defines headers for Post operation. - */ -export interface ExchangePostHeaders { - /** - * URL for checking the ongoing status of the operation. - */ - azureAsyncOperation: string; - /** - * URL for determining when an operation has completed. Only use this value only when - * Azure-AsyncOperation isn't returned. - */ - location: string; - /** - * Clients should wait for the Retry-After interval before polling again - */ - retryAfter: number; -} - -/** - * Defines headers for Get operation. - */ -export interface QuotaGetHeaders { - /** - * Current entity state version. It should be treated as opaque and used to make conditional HTTP - * requests. - */ - eTag: string; -} - -/** - * Defines headers for List operation. - */ -export interface QuotaListHeaders { - /** - * Current entity state version. Should be treated as opaque and used to make conditional HTTP - * requests. - */ - eTag: string; -} - -/** - * @interface - * An interface representing the ReservationList. - * @extends Array - */ -export interface ReservationList extends Array { - /** - * Url to get the next page of reservations. - */ - nextLink?: string; -} - -/** - * @interface - * An interface representing the ReservationOrderList. - * @extends Array - */ -export interface ReservationOrderList extends Array { - /** - * Url to get the next page of reservationOrders. - */ - nextLink?: string; -} - -/** - * @interface - * An interface representing the OperationList. - * @extends Array - */ -export interface OperationList extends Array { - /** - * Url to get the next page of items. - */ - nextLink?: string; -} - -/** - * @interface - * Quota limits. - * @extends Array - */ -export interface QuotaLimits extends Array { - /** - * The URI for fetching the next page of quotas (service limits). When no more pages exist, the - * value is null. - */ - nextLink?: string; -} - -/** - * @interface - * Quota request details. - * @extends Array - */ -export interface QuotaRequestDetailsList extends Array { - /** - * The URI to fetch the next page of quota limits. When there are no more pages, this is null. - */ - nextLink?: string; -} - -/** - * Defines values for ReservedResourceType. - * Possible values include: 'VirtualMachines', 'SqlDatabases', 'SuseLinux', 'CosmosDb', 'RedHat', - * 'SqlDataWarehouse', 'VMwareCloudSimple', 'RedHatOsa', 'Databricks', 'AppService', 'ManagedDisk', - * 'BlockBlob', 'RedisCache', 'AzureDataExplorer', 'MySql', 'MariaDb', 'PostgreSql', - * 'DedicatedHost', 'SapHana', 'SqlAzureHybridBenefit' - * @readonly - * @enum {string} - */ -export type ReservedResourceType = 'VirtualMachines' | 'SqlDatabases' | 'SuseLinux' | 'CosmosDb' | 'RedHat' | 'SqlDataWarehouse' | 'VMwareCloudSimple' | 'RedHatOsa' | 'Databricks' | 'AppService' | 'ManagedDisk' | 'BlockBlob' | 'RedisCache' | 'AzureDataExplorer' | 'MySql' | 'MariaDb' | 'PostgreSql' | 'DedicatedHost' | 'SapHana' | 'SqlAzureHybridBenefit'; - -/** - * Defines values for ReservationTerm. - * Possible values include: 'P1Y', 'P3Y' - * @readonly - * @enum {string} - */ -export type ReservationTerm = 'P1Y' | 'P3Y'; - -/** - * Defines values for ReservationBillingPlan. - * Possible values include: 'Upfront', 'Monthly' - * @readonly - * @enum {string} - */ -export type ReservationBillingPlan = 'Upfront' | 'Monthly'; - -/** - * Defines values for AppliedScopeType. - * Possible values include: 'Single', 'Shared' - * @readonly - * @enum {string} - */ -export type AppliedScopeType = 'Single' | 'Shared'; - -/** - * Defines values for InstanceFlexibility. - * Possible values include: 'On', 'Off' - * @readonly - * @enum {string} - */ -export type InstanceFlexibility = 'On' | 'Off'; - -/** - * Defines values for ReservationStatusCode. - * Possible values include: 'None', 'Pending', 'Active', 'PurchaseError', 'PaymentInstrumentError', - * 'Split', 'Merged', 'Expired', 'Succeeded' - * @readonly - * @enum {string} - */ -export type ReservationStatusCode = 'None' | 'Pending' | 'Active' | 'PurchaseError' | 'PaymentInstrumentError' | 'Split' | 'Merged' | 'Expired' | 'Succeeded'; - -/** - * Defines values for ErrorResponseCode. - * Possible values include: 'NotSpecified', 'InternalServerError', 'ServerTimeout', - * 'AuthorizationFailed', 'BadRequest', 'ClientCertificateThumbprintNotSet', - * 'InvalidRequestContent', 'OperationFailed', 'HttpMethodNotSupported', 'InvalidRequestUri', - * 'MissingTenantId', 'InvalidTenantId', 'InvalidReservationOrderId', 'InvalidReservationId', - * 'ReservationIdNotInReservationOrder', 'ReservationOrderNotFound', 'InvalidSubscriptionId', - * 'InvalidAccessToken', 'InvalidLocationId', 'UnauthenticatedRequestsThrottled', - * 'InvalidHealthCheckType', 'Forbidden', 'BillingScopeIdCannotBeChanged', - * 'AppliedScopesNotAssociatedWithCommerceAccount', 'PatchValuesSameAsExisting', - * 'RoleAssignmentCreationFailed', 'ReservationOrderCreationFailed', 'ReservationOrderNotEnabled', - * 'CapacityUpdateScopesFailed', 'UnsupportedReservationTerm', 'ReservationOrderIdAlreadyExists', - * 'RiskCheckFailed', 'CreateQuoteFailed', 'ActivateQuoteFailed', 'NonsupportedAccountId', - * 'PaymentInstrumentNotFound', 'MissingAppliedScopesForSingle', 'NoValidReservationsToReRate', - * 'ReRateOnlyAllowedForEA', 'OperationCannotBePerformedInCurrentState', - * 'InvalidSingleAppliedScopesCount', 'InvalidFulfillmentRequestParameters', 'NotSupportedCountry', - * 'InvalidRefundQuantity', 'PurchaseError', 'BillingCustomerInputError', - * 'BillingPaymentInstrumentSoftError', 'BillingPaymentInstrumentHardError', - * 'BillingTransientError', 'BillingError', 'FulfillmentConfigurationError', - * 'FulfillmentOutOfStockError', 'FulfillmentTransientError', 'FulfillmentError', - * 'CalculatePriceFailed' - * @readonly - * @enum {string} - */ -export type ErrorResponseCode = 'NotSpecified' | 'InternalServerError' | 'ServerTimeout' | 'AuthorizationFailed' | 'BadRequest' | 'ClientCertificateThumbprintNotSet' | 'InvalidRequestContent' | 'OperationFailed' | 'HttpMethodNotSupported' | 'InvalidRequestUri' | 'MissingTenantId' | 'InvalidTenantId' | 'InvalidReservationOrderId' | 'InvalidReservationId' | 'ReservationIdNotInReservationOrder' | 'ReservationOrderNotFound' | 'InvalidSubscriptionId' | 'InvalidAccessToken' | 'InvalidLocationId' | 'UnauthenticatedRequestsThrottled' | 'InvalidHealthCheckType' | 'Forbidden' | 'BillingScopeIdCannotBeChanged' | 'AppliedScopesNotAssociatedWithCommerceAccount' | 'PatchValuesSameAsExisting' | 'RoleAssignmentCreationFailed' | 'ReservationOrderCreationFailed' | 'ReservationOrderNotEnabled' | 'CapacityUpdateScopesFailed' | 'UnsupportedReservationTerm' | 'ReservationOrderIdAlreadyExists' | 'RiskCheckFailed' | 'CreateQuoteFailed' | 'ActivateQuoteFailed' | 'NonsupportedAccountId' | 'PaymentInstrumentNotFound' | 'MissingAppliedScopesForSingle' | 'NoValidReservationsToReRate' | 'ReRateOnlyAllowedForEA' | 'OperationCannotBePerformedInCurrentState' | 'InvalidSingleAppliedScopesCount' | 'InvalidFulfillmentRequestParameters' | 'NotSupportedCountry' | 'InvalidRefundQuantity' | 'PurchaseError' | 'BillingCustomerInputError' | 'BillingPaymentInstrumentSoftError' | 'BillingPaymentInstrumentHardError' | 'BillingTransientError' | 'BillingError' | 'FulfillmentConfigurationError' | 'FulfillmentOutOfStockError' | 'FulfillmentTransientError' | 'FulfillmentError' | 'CalculatePriceFailed'; - -/** - * Defines values for CalculateExchangeOperationResultStatus. - * Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Pending' - * @readonly - * @enum {string} - */ -export type CalculateExchangeOperationResultStatus = 'Succeeded' | 'Failed' | 'Cancelled' | 'Pending'; - -/** - * Defines values for ExchangeOperationResultStatus. - * Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'PendingRefunds', - * 'PendingPurchases' - * @readonly - * @enum {string} - */ -export type ExchangeOperationResultStatus = 'Succeeded' | 'Failed' | 'Cancelled' | 'PendingRefunds' | 'PendingPurchases'; - -/** - * Defines values for OperationStatus. - * Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Pending' - * @readonly - * @enum {string} - */ -export type OperationStatus = 'Succeeded' | 'Failed' | 'Cancelled' | 'Pending'; - -/** - * Defines values for PaymentStatus. - * Possible values include: 'Succeeded', 'Failed', 'Scheduled', 'Cancelled' - * @readonly - * @enum {string} - */ -export type PaymentStatus = 'Succeeded' | 'Failed' | 'Scheduled' | 'Cancelled'; - -/** - * Contains response data for the availableScopes operation. - */ -export type ReservationAvailableScopesResponse = AvailableScopeProperties & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: AvailableScopeProperties; - }; -}; - -/** - * Contains response data for the split operation. - */ -export type ReservationSplitResponse = Array & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationResponse[]; - }; -}; - -/** - * Contains response data for the merge operation. - */ -export type ReservationMergeResponse = Array & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationResponse[]; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type ReservationListResponse = ReservationList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationList; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type ReservationGetResponse = ReservationResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationResponse; - }; -}; - -/** - * Contains response data for the update operation. - */ -export type ReservationUpdateResponse = ReservationResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationResponse; - }; -}; - -/** - * Contains response data for the listRevisions operation. - */ -export type ReservationListRevisionsResponse = ReservationList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationList; - }; -}; - -/** - * Contains response data for the beginAvailableScopes operation. - */ -export type ReservationBeginAvailableScopesResponse = AvailableScopeProperties & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: AvailableScopeProperties; - }; -}; - -/** - * Contains response data for the beginSplit operation. - */ -export type ReservationBeginSplitResponse = Array & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationResponse[]; - }; -}; - -/** - * Contains response data for the beginMerge operation. - */ -export type ReservationBeginMergeResponse = Array & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationResponse[]; - }; -}; - -/** - * Contains response data for the beginUpdate operation. - */ -export type ReservationBeginUpdateResponse = ReservationResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationResponse; - }; -}; - -/** - * Contains response data for the listNext operation. - */ -export type ReservationListNextResponse = ReservationList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationList; - }; -}; - -/** - * Contains response data for the listRevisionsNext operation. - */ -export type ReservationListRevisionsNextResponse = ReservationList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationList; - }; -}; - -/** - * Contains response data for the getCatalog operation. - */ -export type GetCatalogResponse = Array & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Catalog[]; - }; -}; - -/** - * Contains response data for the getAppliedReservationList operation. - */ -export type GetAppliedReservationListResponse = AppliedReservations & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: AppliedReservations; - }; -}; - -/** - * Contains response data for the calculate operation. - */ -export type ReservationOrderCalculateResponse = CalculatePriceResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: CalculatePriceResponse; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type ReservationOrderListResponse = ReservationOrderList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationOrderList; - }; -}; - -/** - * Contains response data for the purchase operation. - */ -export type ReservationOrderPurchaseResponse = ReservationOrderResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationOrderResponse; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type ReservationOrderGetResponse = ReservationOrderResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationOrderResponse; - }; -}; - -/** - * Contains response data for the beginPurchase operation. - */ -export type ReservationOrderBeginPurchaseResponse = ReservationOrderResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationOrderResponse; - }; -}; - -/** - * Contains response data for the listNext operation. - */ -export type ReservationOrderListNextResponse = ReservationOrderList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ReservationOrderList; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type OperationListResponse = OperationList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationList; - }; -}; - -/** - * Contains response data for the listNext operation. - */ -export type OperationListNextResponse = OperationList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationList; - }; -}; - -/** - * Contains response data for the post operation. - */ -export type CalculateExchangePostResponse = CalculateExchangeOperationResultResponse & CalculateExchangePostHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: CalculateExchangePostHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: CalculateExchangeOperationResultResponse; - }; -}; - -/** - * Contains response data for the post operation. - */ -export type ExchangePostResponse = ExchangeOperationResultResponse & ExchangePostHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: ExchangePostHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ExchangeOperationResultResponse; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type QuotaGetResponse = CurrentQuotaLimitBase & QuotaGetHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: QuotaGetHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: CurrentQuotaLimitBase; - }; -}; - -/** - * Contains response data for the createOrUpdate operation. - */ -export type QuotaCreateOrUpdateResponse = { - /** - * The parsed response body. - */ - body: any; - - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; -}; - -/** - * Contains response data for the update operation. - */ -export type QuotaUpdateResponse = { - /** - * The parsed response body. - */ - body: any; - - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type QuotaListResponse = QuotaLimits & QuotaListHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: QuotaListHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: QuotaLimits; - }; -}; - -/** - * Contains response data for the beginCreateOrUpdate operation. - */ -export type QuotaBeginCreateOrUpdateResponse = { - /** - * The parsed response body. - */ - body: any; - - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; -}; - -/** - * Contains response data for the beginUpdate operation. - */ -export type QuotaBeginUpdateResponse = { - /** - * The parsed response body. - */ - body: any; - - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type QuotaRequestStatusGetResponse = QuotaRequestDetails & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: QuotaRequestDetails; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type QuotaRequestStatusListResponse = QuotaRequestDetailsList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: QuotaRequestDetailsList; - }; -}; - -/** - * Contains response data for the listNext operation. - */ -export type QuotaRequestStatusListNextResponse = QuotaRequestDetailsList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: QuotaRequestDetailsList; - }; -}; diff --git a/sdk/reservations/arm-reservations/src/models/mappers.ts b/sdk/reservations/arm-reservations/src/models/mappers.ts index 8101745ae01..81339b6fe63 100644 --- a/sdk/reservations/arm-reservations/src/models/mappers.ts +++ b/sdk/reservations/arm-reservations/src/models/mappers.ts @@ -6,14 +6,25 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export const CloudError = CloudErrorMapper; -export const BaseResource = BaseResourceMapper; +export const AvailableScopeRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AvailableScopeRequest", + modelProperties: { + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "AvailableScopeRequestProperties" + } + } + } + } +}; -export const AvailableScopeRequestProperties: msRest.CompositeMapper = { - serializedName: "AvailableScopeRequestProperties", +export const AvailableScopeRequestProperties: coreClient.CompositeMapper = { type: { name: "Composite", className: "AvailableScopeRequestProperties", @@ -33,47 +44,230 @@ export const AvailableScopeRequestProperties: msRest.CompositeMapper = { } }; -export const AvailableScopeRequest: msRest.CompositeMapper = { - serializedName: "AvailableScopeRequest", +export const AvailableScopeProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "AvailableScopeRequest", + className: "AvailableScopeProperties", modelProperties: { properties: { serializedName: "properties", type: { name: "Composite", - className: "AvailableScopeRequestProperties" + className: "SubscriptionScopeProperties" } } } } }; -export const SkuName: msRest.CompositeMapper = { - serializedName: "SkuName", +export const SubscriptionScopeProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "SkuName", + className: "SubscriptionScopeProperties", + modelProperties: { + scopes: { + serializedName: "scopes", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ScopeProperties" + } + } + } + } + } + } +}; + +export const ScopeProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ScopeProperties", + modelProperties: { + scope: { + serializedName: "scope", + type: { + name: "String" + } + }, + valid: { + serializedName: "valid", + type: { + name: "Boolean" + } + } + } + } +}; + +export const ErrorModel: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorModel", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ExtendedErrorInfo" + } + } + } + } +}; + +export const ExtendedErrorInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExtendedErrorInfo", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const Catalog: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Catalog", + modelProperties: { + resourceType: { + serializedName: "resourceType", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + billingPlans: { + serializedName: "billingPlans", + type: { + name: "Dictionary", + value: { + type: { name: "Sequence", element: { type: { name: "String" } } } + } + } + }, + terms: { + serializedName: "terms", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + locations: { + serializedName: "locations", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + skuProperties: { + serializedName: "skuProperties", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SkuProperty" + } + } + } + }, + msrp: { + serializedName: "msrp", + type: { + name: "Composite", + className: "CatalogMsrp" + } + }, + restrictions: { + serializedName: "restrictions", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SkuRestriction" + } + } + } + }, + tier: { + serializedName: "tier", + readOnly: true, + type: { + name: "String" + } + }, + size: { + serializedName: "size", + readOnly: true, + type: { + name: "String" + } + }, + capabilities: { + serializedName: "capabilities", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SkuCapability" + } + } + } + } + } + } +}; + +export const SkuProperty: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SkuProperty", modelProperties: { name: { serializedName: "name", type: { name: "String" } - } - } - } -}; - -export const PurchaseRequestPropertiesReservedResourceProperties: msRest.CompositeMapper = { - serializedName: "PurchaseRequestProperties_reservedResourceProperties", - type: { - name: "Composite", - className: "PurchaseRequestPropertiesReservedResourceProperties", - modelProperties: { - instanceFlexibility: { - serializedName: "instanceFlexibility", + }, + value: { + serializedName: "value", type: { name: "String" } @@ -82,8 +276,160 @@ export const PurchaseRequestPropertiesReservedResourceProperties: msRest.Composi } }; -export const PurchaseRequest: msRest.CompositeMapper = { - serializedName: "PurchaseRequest", +export const CatalogMsrp: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CatalogMsrp", + modelProperties: { + p1Y: { + serializedName: "p1Y", + type: { + name: "Composite", + className: "Price" + } + } + } + } +}; + +export const Price: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Price", + modelProperties: { + currencyCode: { + serializedName: "currencyCode", + type: { + name: "String" + } + }, + amount: { + serializedName: "amount", + type: { + name: "Number" + } + } + } + } +}; + +export const SkuRestriction: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SkuRestriction", + modelProperties: { + type: { + serializedName: "type", + type: { + name: "String" + } + }, + values: { + serializedName: "values", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + reasonCode: { + serializedName: "reasonCode", + type: { + name: "String" + } + } + } + } +}; + +export const SkuCapability: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SkuCapability", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "String" + } + } + } + } +}; + +export const AppliedReservations: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AppliedReservations", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + reservationOrderIds: { + serializedName: "properties.reservationOrderIds", + type: { + name: "Composite", + className: "AppliedReservationList" + } + } + } + } +}; + +export const AppliedReservationList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AppliedReservationList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const PurchaseRequest: coreClient.CompositeMapper = { type: { name: "Composite", className: "PurchaseRequest", @@ -155,6 +501,7 @@ export const PurchaseRequest: msRest.CompositeMapper = { } }, renew: { + defaultValue: false, serializedName: "properties.renew", type: { name: "Boolean" @@ -171,117 +518,139 @@ export const PurchaseRequest: msRest.CompositeMapper = { } }; -export const ReservationToReturn: msRest.CompositeMapper = { - serializedName: "ReservationToReturn", +export const SkuName: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ReservationToReturn", + className: "SkuName", modelProperties: { - reservationId: { - serializedName: "reservationId", + name: { + serializedName: "name", type: { name: "String" } + } + } + } +}; + +export const PurchaseRequestPropertiesReservedResourceProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PurchaseRequestPropertiesReservedResourceProperties", + modelProperties: { + instanceFlexibility: { + serializedName: "instanceFlexibility", + type: { + name: "String" + } + } + } + } +}; + +export const CalculatePriceResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CalculatePriceResponse", + modelProperties: { + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "CalculatePriceResponseProperties" + } + } + } + } +}; + +export const CalculatePriceResponseProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CalculatePriceResponseProperties", + modelProperties: { + billingCurrencyTotal: { + serializedName: "billingCurrencyTotal", + type: { + name: "Composite", + className: "CalculatePriceResponsePropertiesBillingCurrencyTotal" + } }, - quantity: { - serializedName: "quantity", + netTotal: { + serializedName: "netTotal", type: { name: "Number" } - } - } - } -}; - -export const CalculateExchangeRequestProperties: msRest.CompositeMapper = { - serializedName: "CalculateExchangeRequestProperties", - type: { - name: "Composite", - className: "CalculateExchangeRequestProperties", - modelProperties: { - reservationsToPurchase: { - serializedName: "reservationsToPurchase", + }, + taxTotal: { + serializedName: "taxTotal", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "PurchaseRequest" - } - } + name: "Number" } }, - reservationsToExchange: { - serializedName: "reservationsToExchange", + grandTotal: { + serializedName: "grandTotal", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ReservationToReturn" - } - } + name: "Number" } - } - } - } -}; - -export const CalculateExchangeRequest: msRest.CompositeMapper = { - serializedName: "CalculateExchangeRequest", - type: { - name: "Composite", - className: "CalculateExchangeRequest", - modelProperties: { - properties: { - serializedName: "properties", + }, + isTaxIncluded: { + serializedName: "isTaxIncluded", type: { - name: "Composite", - className: "CalculateExchangeRequestProperties" + name: "Boolean" } - } - } - } -}; - -export const ExchangeRequestProperties: msRest.CompositeMapper = { - serializedName: "ExchangeRequestProperties", - type: { - name: "Composite", - className: "ExchangeRequestProperties", - modelProperties: { - sessionId: { - serializedName: "sessionId", + }, + isBillingPartnerManaged: { + serializedName: "isBillingPartnerManaged", + type: { + name: "Boolean" + } + }, + reservationOrderId: { + serializedName: "reservationOrderId", type: { name: "String" } - } - } - } -}; - -export const ExchangeRequest: msRest.CompositeMapper = { - serializedName: "ExchangeRequest", - type: { - name: "Composite", - className: "ExchangeRequest", - modelProperties: { - properties: { - serializedName: "properties", + }, + skuTitle: { + serializedName: "skuTitle", + type: { + name: "String" + } + }, + skuDescription: { + serializedName: "skuDescription", + type: { + name: "String" + } + }, + pricingCurrencyTotal: { + serializedName: "pricingCurrencyTotal", type: { name: "Composite", - className: "ExchangeRequestProperties" + className: "CalculatePriceResponsePropertiesPricingCurrencyTotal" + } + }, + paymentSchedule: { + serializedName: "paymentSchedule", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PaymentDetail" + } + } } } } } }; -export const Price: msRest.CompositeMapper = { - serializedName: "Price", +export const CalculatePriceResponsePropertiesBillingCurrencyTotal: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Price", + className: "CalculatePriceResponsePropertiesBillingCurrencyTotal", modelProperties: { currencyCode: { serializedName: "currencyCode", @@ -299,636 +668,28 @@ export const Price: msRest.CompositeMapper = { } }; -export const ReservationToPurchaseCalculateExchange: msRest.CompositeMapper = { - serializedName: "ReservationToPurchaseCalculateExchange", +export const CalculatePriceResponsePropertiesPricingCurrencyTotal: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ReservationToPurchaseCalculateExchange", + className: "CalculatePriceResponsePropertiesPricingCurrencyTotal", modelProperties: { - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "PurchaseRequest" - } - }, - billingCurrencyTotal: { - serializedName: "billingCurrencyTotal", - type: { - name: "Composite", - className: "Price" - } - } - } - } -}; - -export const BillingInformation: msRest.CompositeMapper = { - serializedName: "BillingInformation", - type: { - name: "Composite", - className: "BillingInformation", - modelProperties: { - billingCurrencyTotalPaidAmount: { - serializedName: "billingCurrencyTotalPaidAmount", - type: { - name: "Composite", - className: "Price" - } - }, - billingCurrencyProratedAmount: { - serializedName: "billingCurrencyProratedAmount", - type: { - name: "Composite", - className: "Price" - } - }, - billingCurrencyRemainingCommitmentAmount: { - serializedName: "billingCurrencyRemainingCommitmentAmount", - type: { - name: "Composite", - className: "Price" - } - } - } - } -}; - -export const ReservationToExchange: msRest.CompositeMapper = { - serializedName: "ReservationToExchange", - type: { - name: "Composite", - className: "ReservationToExchange", - modelProperties: { - reservationId: { - serializedName: "reservationId", + currencyCode: { + serializedName: "currencyCode", type: { name: "String" } }, - quantity: { - serializedName: "quantity", + amount: { + serializedName: "amount", type: { name: "Number" } - }, - billingRefundAmount: { - serializedName: "billingRefundAmount", - type: { - name: "Composite", - className: "Price" - } - }, - billingInformation: { - serializedName: "billingInformation", - type: { - name: "Composite", - className: "BillingInformation" - } } } } }; -export const ExchangePolicyError: msRest.CompositeMapper = { - serializedName: "ExchangePolicyError", - type: { - name: "Composite", - className: "ExchangePolicyError", - modelProperties: { - code: { - serializedName: "code", - type: { - name: "String" - } - }, - message: { - serializedName: "message", - type: { - name: "String" - } - } - } - } -}; - -export const ExchangePolicyErrors: msRest.CompositeMapper = { - serializedName: "ExchangePolicyErrors", - type: { - name: "Composite", - className: "ExchangePolicyErrors", - modelProperties: { - policyErrors: { - serializedName: "policyErrors", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ExchangePolicyError" - } - } - } - } - } - } -}; - -export const CalculateExchangeResponseProperties: msRest.CompositeMapper = { - serializedName: "CalculateExchangeResponseProperties", - type: { - name: "Composite", - className: "CalculateExchangeResponseProperties", - modelProperties: { - sessionId: { - serializedName: "sessionId", - type: { - name: "String" - } - }, - netPayable: { - serializedName: "netPayable", - type: { - name: "Composite", - className: "Price" - } - }, - refundsTotal: { - serializedName: "refundsTotal", - type: { - name: "Composite", - className: "Price" - } - }, - purchasesTotal: { - serializedName: "purchasesTotal", - type: { - name: "Composite", - className: "Price" - } - }, - reservationsToPurchase: { - serializedName: "reservationsToPurchase", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ReservationToPurchaseCalculateExchange" - } - } - } - }, - reservationsToExchange: { - serializedName: "reservationsToExchange", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ReservationToExchange" - } - } - } - }, - policyResult: { - serializedName: "policyResult", - type: { - name: "Composite", - className: "ExchangePolicyErrors" - } - } - } - } -}; - -export const OperationResultError: msRest.CompositeMapper = { - serializedName: "OperationResultError", - type: { - name: "Composite", - className: "OperationResultError", - modelProperties: { - code: { - serializedName: "code", - type: { - name: "String" - } - }, - message: { - serializedName: "message", - type: { - name: "String" - } - } - } - } -}; - -export const CalculateExchangeOperationResultResponse: msRest.CompositeMapper = { - serializedName: "CalculateExchangeOperationResultResponse", - type: { - name: "Composite", - className: "CalculateExchangeOperationResultResponse", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String" - } - }, - name: { - serializedName: "name", - type: { - name: "String" - } - }, - status: { - serializedName: "status", - type: { - name: "String" - } - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "CalculateExchangeResponseProperties" - } - }, - error: { - serializedName: "error", - type: { - name: "Composite", - className: "OperationResultError" - } - } - } - } -}; - -export const ReservationToPurchaseExchange: msRest.CompositeMapper = { - serializedName: "ReservationToPurchaseExchange", - type: { - name: "Composite", - className: "ReservationToPurchaseExchange", - modelProperties: { - reservationOrderId: { - serializedName: "reservationOrderId", - type: { - name: "String" - } - }, - reservationId: { - serializedName: "reservationId", - type: { - name: "String" - } - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "PurchaseRequest" - } - }, - billingCurrencyTotal: { - serializedName: "billingCurrencyTotal", - type: { - name: "Composite", - className: "Price" - } - }, - status: { - serializedName: "status", - type: { - name: "String" - } - } - } - } -}; - -export const ReservationToReturnForExchange: msRest.CompositeMapper = { - serializedName: "ReservationToReturnForExchange", - type: { - name: "Composite", - className: "ReservationToReturnForExchange", - modelProperties: { - reservationId: { - serializedName: "reservationId", - type: { - name: "String" - } - }, - quantity: { - serializedName: "quantity", - type: { - name: "Number" - } - }, - billingRefundAmount: { - serializedName: "billingRefundAmount", - type: { - name: "Composite", - className: "Price" - } - }, - billingInformation: { - serializedName: "billingInformation", - type: { - name: "Composite", - className: "BillingInformation" - } - }, - status: { - serializedName: "status", - type: { - name: "String" - } - } - } - } -}; - -export const ExchangeResponseProperties: msRest.CompositeMapper = { - serializedName: "ExchangeResponseProperties", - type: { - name: "Composite", - className: "ExchangeResponseProperties", - modelProperties: { - sessionId: { - serializedName: "sessionId", - type: { - name: "String" - } - }, - netPayable: { - serializedName: "netPayable", - type: { - name: "Composite", - className: "Price" - } - }, - refundsTotal: { - serializedName: "refundsTotal", - type: { - name: "Composite", - className: "Price" - } - }, - purchasesTotal: { - serializedName: "purchasesTotal", - type: { - name: "Composite", - className: "Price" - } - }, - reservationsToPurchase: { - serializedName: "reservationsToPurchase", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ReservationToPurchaseExchange" - } - } - } - }, - reservationsToExchange: { - serializedName: "reservationsToExchange", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ReservationToReturnForExchange" - } - } - } - }, - policyResult: { - serializedName: "policyResult", - type: { - name: "Composite", - className: "ExchangePolicyErrors" - } - } - } - } -}; - -export const ExchangeOperationResultResponse: msRest.CompositeMapper = { - serializedName: "ExchangeOperationResultResponse", - type: { - name: "Composite", - className: "ExchangeOperationResultResponse", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String" - } - }, - name: { - serializedName: "name", - type: { - name: "String" - } - }, - status: { - serializedName: "status", - type: { - name: "String" - } - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "ExchangeResponseProperties" - } - }, - error: { - serializedName: "error", - type: { - name: "Composite", - className: "OperationResultError" - } - } - } - } -}; - -export const SkuProperty: msRest.CompositeMapper = { - serializedName: "SkuProperty", - type: { - name: "Composite", - className: "SkuProperty", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String" - } - }, - value: { - serializedName: "value", - type: { - name: "String" - } - } - } - } -}; - -export const SkuRestriction: msRest.CompositeMapper = { - serializedName: "SkuRestriction", - type: { - name: "Composite", - className: "SkuRestriction", - modelProperties: { - type: { - serializedName: "type", - type: { - name: "String" - } - }, - values: { - serializedName: "values", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - reasonCode: { - serializedName: "reasonCode", - type: { - name: "String" - } - } - } - } -}; - -export const Catalog: msRest.CompositeMapper = { - serializedName: "Catalog", - type: { - name: "Composite", - className: "Catalog", - modelProperties: { - resourceType: { - readOnly: true, - serializedName: "resourceType", - type: { - name: "String" - } - }, - name: { - readOnly: true, - serializedName: "name", - type: { - name: "String" - } - }, - billingPlans: { - serializedName: "billingPlans", - type: { - name: "Dictionary", - value: { - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - } - } - }, - terms: { - readOnly: true, - serializedName: "terms", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - locations: { - readOnly: true, - serializedName: "locations", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - skuProperties: { - readOnly: true, - serializedName: "skuProperties", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "SkuProperty" - } - } - } - }, - restrictions: { - readOnly: true, - serializedName: "restrictions", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "SkuRestriction" - } - } - } - } - } - } -}; - -export const ExtendedStatusInfo: msRest.CompositeMapper = { - serializedName: "ExtendedStatusInfo", - type: { - name: "Composite", - className: "ExtendedStatusInfo", - modelProperties: { - statusCode: { - serializedName: "statusCode", - type: { - name: "String" - } - }, - message: { - serializedName: "message", - type: { - name: "String" - } - } - } - } -}; - -export const PaymentDetail: msRest.CompositeMapper = { - serializedName: "PaymentDetail", +export const PaymentDetail: coreClient.CompositeMapper = { type: { name: "Composite", className: "PaymentDetail", @@ -982,66 +743,46 @@ export const PaymentDetail: msRest.CompositeMapper = { } }; -export const ReservationOrderBillingPlanInformation: msRest.CompositeMapper = { - serializedName: "ReservationOrderBillingPlanInformation", +export const ExtendedStatusInfo: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ReservationOrderBillingPlanInformation", + className: "ExtendedStatusInfo", modelProperties: { - pricingCurrencyTotal: { - serializedName: "pricingCurrencyTotal", + statusCode: { + serializedName: "statusCode", type: { - name: "Composite", - className: "Price" + name: "String" } }, - startDate: { - serializedName: "startDate", + message: { + serializedName: "message", type: { - name: "Date" + name: "String" } - }, - nextPaymentDueDate: { - serializedName: "nextPaymentDueDate", - type: { - name: "Date" - } - }, - transactions: { - serializedName: "transactions", + } + } + } +}; + +export const ReservationOrderList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationOrderList", + modelProperties: { + value: { + serializedName: "value", type: { name: "Sequence", element: { type: { name: "Composite", - className: "PaymentDetail" - } - } - } - } - } - } -}; - -export const ReservationSplitProperties: msRest.CompositeMapper = { - serializedName: "ReservationSplitProperties", - type: { - name: "Composite", - className: "ReservationSplitProperties", - modelProperties: { - splitDestinations: { - serializedName: "splitDestinations", - type: { - name: "Sequence", - element: { - type: { - name: "String" + className: "ReservationOrderResponse" } } } }, - splitSource: { - serializedName: "splitSource", + nextLink: { + serializedName: "nextLink", type: { name: "String" } @@ -1050,314 +791,7 @@ export const ReservationSplitProperties: msRest.CompositeMapper = { } }; -export const ReservationMergeProperties: msRest.CompositeMapper = { - serializedName: "ReservationMergeProperties", - type: { - name: "Composite", - className: "ReservationMergeProperties", - modelProperties: { - mergeDestination: { - serializedName: "mergeDestination", - type: { - name: "String" - } - }, - mergeSources: { - serializedName: "mergeSources", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - } - } - } -}; - -export const RenewPropertiesResponsePricingCurrencyTotal: msRest.CompositeMapper = { - serializedName: "RenewPropertiesResponse_pricingCurrencyTotal", - type: { - name: "Composite", - className: "RenewPropertiesResponsePricingCurrencyTotal", - modelProperties: { - currencyCode: { - serializedName: "currencyCode", - type: { - name: "String" - } - }, - amount: { - serializedName: "amount", - type: { - name: "Number" - } - } - } - } -}; - -export const RenewPropertiesResponseBillingCurrencyTotal: msRest.CompositeMapper = { - serializedName: "RenewPropertiesResponse_billingCurrencyTotal", - type: { - name: "Composite", - className: "RenewPropertiesResponseBillingCurrencyTotal", - modelProperties: { - currencyCode: { - serializedName: "currencyCode", - type: { - name: "String" - } - }, - amount: { - serializedName: "amount", - type: { - name: "Number" - } - } - } - } -}; - -export const RenewPropertiesResponse: msRest.CompositeMapper = { - serializedName: "RenewPropertiesResponse", - type: { - name: "Composite", - className: "RenewPropertiesResponse", - modelProperties: { - purchaseProperties: { - serializedName: "purchaseProperties", - type: { - name: "Composite", - className: "PurchaseRequest" - } - }, - pricingCurrencyTotal: { - serializedName: "pricingCurrencyTotal", - type: { - name: "Composite", - className: "RenewPropertiesResponsePricingCurrencyTotal" - } - }, - billingCurrencyTotal: { - serializedName: "billingCurrencyTotal", - type: { - name: "Composite", - className: "RenewPropertiesResponseBillingCurrencyTotal" - } - } - } - } -}; - -export const ReservationProperties: msRest.CompositeMapper = { - serializedName: "ReservationProperties", - type: { - name: "Composite", - className: "ReservationProperties", - modelProperties: { - reservedResourceType: { - serializedName: "reservedResourceType", - type: { - name: "String" - } - }, - instanceFlexibility: { - serializedName: "instanceFlexibility", - type: { - name: "String" - } - }, - displayName: { - serializedName: "displayName", - type: { - name: "String" - } - }, - appliedScopes: { - serializedName: "appliedScopes", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - appliedScopeType: { - serializedName: "appliedScopeType", - type: { - name: "String" - } - }, - quantity: { - serializedName: "quantity", - type: { - name: "Number" - } - }, - provisioningState: { - serializedName: "provisioningState", - type: { - name: "String" - } - }, - effectiveDateTime: { - serializedName: "effectiveDateTime", - type: { - name: "DateTime" - } - }, - lastUpdatedDateTime: { - readOnly: true, - serializedName: "lastUpdatedDateTime", - type: { - name: "DateTime" - } - }, - expiryDate: { - serializedName: "expiryDate", - type: { - name: "Date" - } - }, - skuDescription: { - serializedName: "skuDescription", - type: { - name: "String" - } - }, - extendedStatusInfo: { - serializedName: "extendedStatusInfo", - type: { - name: "Composite", - className: "ExtendedStatusInfo" - } - }, - billingPlan: { - serializedName: "billingPlan", - type: { - name: "String" - } - }, - splitProperties: { - serializedName: "splitProperties", - type: { - name: "Composite", - className: "ReservationSplitProperties" - } - }, - mergeProperties: { - serializedName: "mergeProperties", - type: { - name: "Composite", - className: "ReservationMergeProperties" - } - }, - billingScopeId: { - serializedName: "billingScopeId", - type: { - name: "String" - } - }, - renew: { - serializedName: "renew", - type: { - name: "Boolean" - } - }, - renewSource: { - serializedName: "renewSource", - type: { - name: "String" - } - }, - renewDestination: { - serializedName: "renewDestination", - type: { - name: "String" - } - }, - renewProperties: { - serializedName: "renewProperties", - type: { - name: "Composite", - className: "RenewPropertiesResponse" - } - }, - term: { - serializedName: "term", - type: { - name: "String" - } - } - } - } -}; - -export const ReservationResponse: msRest.CompositeMapper = { - serializedName: "ReservationResponse", - type: { - name: "Composite", - className: "ReservationResponse", - modelProperties: { - location: { - readOnly: true, - serializedName: "location", - type: { - name: "String" - } - }, - etag: { - serializedName: "etag", - type: { - name: "Number" - } - }, - id: { - readOnly: true, - serializedName: "id", - type: { - name: "String" - } - }, - name: { - readOnly: true, - serializedName: "name", - type: { - name: "String" - } - }, - sku: { - serializedName: "sku", - type: { - name: "Composite", - className: "SkuName" - } - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "ReservationProperties" - } - }, - type: { - readOnly: true, - serializedName: "type", - type: { - name: "String" - } - } - } - } -}; - -export const ReservationOrderResponse: msRest.CompositeMapper = { - serializedName: "ReservationOrderResponse", +export const ReservationOrderResponse: coreClient.CompositeMapper = { type: { name: "Composite", className: "ReservationOrderResponse", @@ -1369,19 +803,33 @@ export const ReservationOrderResponse: msRest.CompositeMapper = { } }, id: { - readOnly: true, serializedName: "id", + readOnly: true, type: { name: "String" } }, name: { - readOnly: true, serializedName: "name", + readOnly: true, type: { name: "String" } }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, displayName: { serializedName: "properties.displayName", type: { @@ -1448,108 +896,37 @@ export const ReservationOrderResponse: msRest.CompositeMapper = { } } } - }, - type: { - readOnly: true, - serializedName: "type", - type: { - name: "String" - } } } } }; -export const CalculatePriceResponsePropertiesBillingCurrencyTotal: msRest.CompositeMapper = { - serializedName: "CalculatePriceResponseProperties_billingCurrencyTotal", +export const ReservationOrderBillingPlanInformation: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CalculatePriceResponsePropertiesBillingCurrencyTotal", + className: "ReservationOrderBillingPlanInformation", modelProperties: { - currencyCode: { - serializedName: "currencyCode", - type: { - name: "String" - } - }, - amount: { - serializedName: "amount", - type: { - name: "Number" - } - } - } - } -}; - -export const CalculatePriceResponsePropertiesPricingCurrencyTotal: msRest.CompositeMapper = { - serializedName: "CalculatePriceResponseProperties_pricingCurrencyTotal", - type: { - name: "Composite", - className: "CalculatePriceResponsePropertiesPricingCurrencyTotal", - modelProperties: { - currencyCode: { - serializedName: "currencyCode", - type: { - name: "String" - } - }, - amount: { - serializedName: "amount", - type: { - name: "Number" - } - } - } - } -}; - -export const CalculatePriceResponseProperties: msRest.CompositeMapper = { - serializedName: "CalculatePriceResponseProperties", - type: { - name: "Composite", - className: "CalculatePriceResponseProperties", - modelProperties: { - billingCurrencyTotal: { - serializedName: "billingCurrencyTotal", - type: { - name: "Composite", - className: "CalculatePriceResponsePropertiesBillingCurrencyTotal" - } - }, - isBillingPartnerManaged: { - serializedName: "isBillingPartnerManaged", - type: { - name: "Boolean" - } - }, - reservationOrderId: { - serializedName: "reservationOrderId", - type: { - name: "String" - } - }, - skuTitle: { - serializedName: "skuTitle", - type: { - name: "String" - } - }, - skuDescription: { - serializedName: "skuDescription", - type: { - name: "String" - } - }, pricingCurrencyTotal: { serializedName: "pricingCurrencyTotal", type: { name: "Composite", - className: "CalculatePriceResponsePropertiesPricingCurrencyTotal" + className: "Price" } }, - paymentSchedule: { - serializedName: "paymentSchedule", + startDate: { + serializedName: "startDate", + type: { + name: "Date" + } + }, + nextPaymentDueDate: { + serializedName: "nextPaymentDueDate", + type: { + name: "Date" + } + }, + transactions: { + serializedName: "transactions", type: { name: "Sequence", element: { @@ -1564,28 +941,332 @@ export const CalculatePriceResponseProperties: msRest.CompositeMapper = { } }; -export const CalculatePriceResponse: msRest.CompositeMapper = { - serializedName: "CalculatePriceResponse", +export const ReservationResponse: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CalculatePriceResponse", + className: "ReservationResponse", modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + etag: { + serializedName: "etag", + type: { + name: "Number" + } + }, + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "SkuName" + } + }, properties: { serializedName: "properties", type: { name: "Composite", - className: "CalculatePriceResponseProperties" + className: "ReservationsProperties" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + kind: { + defaultValue: "Microsoft.Compute", + isConstant: true, + serializedName: "kind", + type: { + name: "String" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" } } } } }; -export const PatchPropertiesRenewProperties: msRest.CompositeMapper = { - serializedName: "PatchProperties_renewProperties", +export const ReservationsProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "PatchPropertiesRenewProperties", + className: "ReservationsProperties", + modelProperties: { + reservedResourceType: { + serializedName: "reservedResourceType", + type: { + name: "String" + } + }, + instanceFlexibility: { + serializedName: "instanceFlexibility", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + appliedScopes: { + serializedName: "appliedScopes", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + appliedScopeType: { + serializedName: "appliedScopeType", + type: { + name: "String" + } + }, + archived: { + serializedName: "archived", + type: { + name: "Boolean" + } + }, + capabilities: { + serializedName: "capabilities", + type: { + name: "String" + } + }, + quantity: { + serializedName: "quantity", + type: { + name: "Number" + } + }, + provisioningState: { + serializedName: "provisioningState", + type: { + name: "String" + } + }, + effectiveDateTime: { + serializedName: "effectiveDateTime", + type: { + name: "DateTime" + } + }, + lastUpdatedDateTime: { + serializedName: "lastUpdatedDateTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + expiryDate: { + serializedName: "expiryDate", + type: { + name: "Date" + } + }, + skuDescription: { + serializedName: "skuDescription", + type: { + name: "String" + } + }, + extendedStatusInfo: { + serializedName: "extendedStatusInfo", + type: { + name: "Composite", + className: "ExtendedStatusInfo" + } + }, + billingPlan: { + serializedName: "billingPlan", + type: { + name: "String" + } + }, + displayProvisioningState: { + serializedName: "displayProvisioningState", + readOnly: true, + type: { + name: "String" + } + }, + provisioningSubState: { + serializedName: "provisioningSubState", + readOnly: true, + type: { + name: "String" + } + }, + purchaseDate: { + serializedName: "purchaseDate", + type: { + name: "Date" + } + }, + splitProperties: { + serializedName: "splitProperties", + type: { + name: "Composite", + className: "ReservationSplitProperties" + } + }, + mergeProperties: { + serializedName: "mergeProperties", + type: { + name: "Composite", + className: "ReservationMergeProperties" + } + }, + billingScopeId: { + serializedName: "billingScopeId", + type: { + name: "String" + } + }, + renew: { + defaultValue: false, + serializedName: "renew", + type: { + name: "Boolean" + } + }, + renewSource: { + serializedName: "renewSource", + type: { + name: "String" + } + }, + renewDestination: { + serializedName: "renewDestination", + type: { + name: "String" + } + }, + renewProperties: { + serializedName: "renewProperties", + type: { + name: "Composite", + className: "RenewPropertiesResponse" + } + }, + term: { + serializedName: "term", + type: { + name: "String" + } + }, + userFriendlyAppliedScopeType: { + serializedName: "userFriendlyAppliedScopeType", + readOnly: true, + type: { + name: "String" + } + }, + userFriendlyRenewState: { + serializedName: "userFriendlyRenewState", + readOnly: true, + type: { + name: "String" + } + }, + utilization: { + serializedName: "utilization", + type: { + name: "Composite", + className: "ReservationsPropertiesUtilization" + } + } + } + } +}; + +export const ReservationSplitProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationSplitProperties", + modelProperties: { + splitDestinations: { + serializedName: "splitDestinations", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + splitSource: { + serializedName: "splitSource", + type: { + name: "String" + } + } + } + } +}; + +export const ReservationMergeProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationMergeProperties", + modelProperties: { + mergeDestination: { + serializedName: "mergeDestination", + type: { + name: "String" + } + }, + mergeSources: { + serializedName: "mergeSources", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const RenewPropertiesResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RenewPropertiesResponse", modelProperties: { purchaseProperties: { serializedName: "purchaseProperties", @@ -1593,13 +1274,204 @@ export const PatchPropertiesRenewProperties: msRest.CompositeMapper = { name: "Composite", className: "PurchaseRequest" } + }, + pricingCurrencyTotal: { + serializedName: "pricingCurrencyTotal", + type: { + name: "Composite", + className: "RenewPropertiesResponsePricingCurrencyTotal" + } + }, + billingCurrencyTotal: { + serializedName: "billingCurrencyTotal", + type: { + name: "Composite", + className: "RenewPropertiesResponseBillingCurrencyTotal" + } } } } }; -export const MergeRequest: msRest.CompositeMapper = { - serializedName: "MergeRequest", +export const RenewPropertiesResponsePricingCurrencyTotal: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RenewPropertiesResponsePricingCurrencyTotal", + modelProperties: { + currencyCode: { + serializedName: "currencyCode", + type: { + name: "String" + } + }, + amount: { + serializedName: "amount", + type: { + name: "Number" + } + } + } + } +}; + +export const RenewPropertiesResponseBillingCurrencyTotal: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RenewPropertiesResponseBillingCurrencyTotal", + modelProperties: { + currencyCode: { + serializedName: "currencyCode", + type: { + name: "String" + } + }, + amount: { + serializedName: "amount", + type: { + name: "Number" + } + } + } + } +}; + +export const ReservationsPropertiesUtilization: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationsPropertiesUtilization", + modelProperties: { + trend: { + serializedName: "trend", + readOnly: true, + type: { + name: "String" + } + }, + aggregates: { + serializedName: "aggregates", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ReservationUtilizationAggregates" + } + } + } + } + } + } +}; + +export const ReservationUtilizationAggregates: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationUtilizationAggregates", + modelProperties: { + grain: { + serializedName: "grain", + readOnly: true, + type: { + name: "Number" + } + }, + grainUnit: { + serializedName: "grainUnit", + readOnly: true, + type: { + name: "String" + } + }, + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Number" + } + }, + valueUnit: { + serializedName: "valueUnit", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime" + } + } + } + } +}; + +export const SplitRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SplitRequest", + modelProperties: { + quantities: { + serializedName: "properties.quantities", + type: { + name: "Sequence", + element: { + type: { + name: "Number" + } + } + } + }, + reservationId: { + serializedName: "properties.reservationId", + type: { + name: "String" + } + } + } + } +}; + +export const MergeRequest: coreClient.CompositeMapper = { type: { name: "Composite", className: "MergeRequest", @@ -1619,8 +1491,34 @@ export const MergeRequest: msRest.CompositeMapper = { } }; -export const Patch: msRest.CompositeMapper = { - serializedName: "Patch", +export const ReservationList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ReservationResponse" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const Patch: coreClient.CompositeMapper = { type: { name: "Composite", className: "Patch", @@ -1655,6 +1553,7 @@ export const Patch: msRest.CompositeMapper = { } }, renew: { + defaultValue: false, serializedName: "properties.renew", type: { name: "Boolean" @@ -1671,77 +1570,26 @@ export const Patch: msRest.CompositeMapper = { } }; -export const SplitRequest: msRest.CompositeMapper = { - serializedName: "SplitRequest", +export const PatchPropertiesRenewProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "SplitRequest", + className: "PatchPropertiesRenewProperties", modelProperties: { - quantities: { - serializedName: "properties.quantities", - type: { - name: "Sequence", - element: { - type: { - name: "Number" - } - } - } - }, - reservationId: { - serializedName: "properties.reservationId", - type: { - name: "String" - } - } - } - } -}; - -export const ExtendedErrorInfo: msRest.CompositeMapper = { - serializedName: "ExtendedErrorInfo", - type: { - name: "Composite", - className: "ExtendedErrorInfo", - modelProperties: { - code: { - serializedName: "code", - type: { - name: "String" - } - }, - message: { - serializedName: "message", - type: { - name: "String" - } - } - } - } -}; - -export const ErrorModel: msRest.CompositeMapper = { - serializedName: "Error", - type: { - name: "Composite", - className: "ErrorModel", - modelProperties: { - error: { - serializedName: "error", + purchaseProperties: { + serializedName: "purchaseProperties", type: { name: "Composite", - className: "ExtendedErrorInfo" + className: "PurchaseRequest" } } } } }; -export const AppliedReservationList: msRest.CompositeMapper = { - serializedName: "AppliedReservationList", +export const OperationList: coreClient.CompositeMapper = { type: { name: "Composite", - className: "AppliedReservationList", + className: "OperationList", modelProperties: { value: { serializedName: "value", @@ -1749,7 +1597,8 @@ export const AppliedReservationList: msRest.CompositeMapper = { name: "Sequence", element: { type: { - name: "String" + name: "Composite", + className: "OperationResponse" } } } @@ -1764,46 +1613,48 @@ export const AppliedReservationList: msRest.CompositeMapper = { } }; -export const AppliedReservations: msRest.CompositeMapper = { - serializedName: "AppliedReservations", +export const OperationResponse: coreClient.CompositeMapper = { type: { name: "Composite", - className: "AppliedReservations", + className: "OperationResponse", modelProperties: { - id: { - readOnly: true, - serializedName: "id", - type: { - name: "String" - } - }, name: { - readOnly: true, serializedName: "name", type: { name: "String" } }, - type: { - readOnly: true, - serializedName: "type", + isDataAction: { + serializedName: "isDataAction", + type: { + name: "Boolean" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + origin: { + serializedName: "origin", type: { name: "String" } }, - reservationOrderIds: { - serializedName: "properties.reservationOrderIds", + properties: { + serializedName: "properties", type: { - name: "Composite", - className: "AppliedReservationList" + name: "Dictionary", + value: { type: { name: "any" } } } } } } }; -export const OperationDisplay: msRest.CompositeMapper = { - serializedName: "OperationDisplay", +export const OperationDisplay: coreClient.CompositeMapper = { type: { name: "Composite", className: "OperationDisplay", @@ -1836,71 +1687,47 @@ export const OperationDisplay: msRest.CompositeMapper = { } }; -export const OperationResponse: msRest.CompositeMapper = { - serializedName: "OperationResponse", +export const CalculateExchangeRequest: coreClient.CompositeMapper = { type: { name: "Composite", - className: "OperationResponse", + className: "CalculateExchangeRequest", modelProperties: { - name: { - serializedName: "name", - type: { - name: "String" - } - }, - display: { - serializedName: "display", + properties: { + serializedName: "properties", type: { name: "Composite", - className: "OperationDisplay" - } - }, - origin: { - serializedName: "origin", - type: { - name: "String" + className: "CalculateExchangeRequestProperties" } } } } }; -export const ScopeProperties: msRest.CompositeMapper = { - serializedName: "ScopeProperties", +export const CalculateExchangeRequestProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ScopeProperties", + className: "CalculateExchangeRequestProperties", modelProperties: { - scope: { - serializedName: "scope", - type: { - name: "String" - } - }, - valid: { - serializedName: "valid", - type: { - name: "Boolean" - } - } - } - } -}; - -export const SubscriptionScopeProperties: msRest.CompositeMapper = { - serializedName: "SubscriptionScopeProperties", - type: { - name: "Composite", - className: "SubscriptionScopeProperties", - modelProperties: { - scopes: { - serializedName: "scopes", + reservationsToPurchase: { + serializedName: "reservationsToPurchase", type: { name: "Sequence", element: { type: { name: "Composite", - className: "ScopeProperties" + className: "PurchaseRequest" + } + } + } + }, + reservationsToExchange: { + serializedName: "reservationsToExchange", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ReservationToReturn" } } } @@ -1909,38 +1736,257 @@ export const SubscriptionScopeProperties: msRest.CompositeMapper = { } }; -export const AvailableScopeProperties: msRest.CompositeMapper = { - serializedName: "AvailableScopeProperties", +export const ReservationToReturn: coreClient.CompositeMapper = { type: { name: "Composite", - className: "AvailableScopeProperties", + className: "ReservationToReturn", + modelProperties: { + reservationId: { + serializedName: "reservationId", + type: { + name: "String" + } + }, + quantity: { + serializedName: "quantity", + type: { + name: "Number" + } + } + } + } +}; + +export const CalculateExchangeOperationResultResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CalculateExchangeOperationResultResponse", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "CalculateExchangeResponseProperties" + } + }, + error: { + serializedName: "error", + type: { + name: "Composite", + className: "OperationResultError" + } + } + } + } +}; + +export const CalculateExchangeResponseProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CalculateExchangeResponseProperties", + modelProperties: { + sessionId: { + serializedName: "sessionId", + type: { + name: "String" + } + }, + netPayable: { + serializedName: "netPayable", + type: { + name: "Composite", + className: "Price" + } + }, + refundsTotal: { + serializedName: "refundsTotal", + type: { + name: "Composite", + className: "Price" + } + }, + purchasesTotal: { + serializedName: "purchasesTotal", + type: { + name: "Composite", + className: "Price" + } + }, + reservationsToPurchase: { + serializedName: "reservationsToPurchase", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ReservationToPurchaseCalculateExchange" + } + } + } + }, + reservationsToExchange: { + serializedName: "reservationsToExchange", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ReservationToExchange" + } + } + } + }, + policyResult: { + serializedName: "policyResult", + type: { + name: "Composite", + className: "ExchangePolicyErrors" + } + } + } + } +}; + +export const ReservationToPurchaseCalculateExchange: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationToPurchaseCalculateExchange", modelProperties: { properties: { serializedName: "properties", type: { name: "Composite", - className: "SubscriptionScopeProperties" + className: "PurchaseRequest" + } + }, + billingCurrencyTotal: { + serializedName: "billingCurrencyTotal", + type: { + name: "Composite", + className: "Price" } } } } }; -export const ResourceName: msRest.CompositeMapper = { - serializedName: "ResourceName", +export const ReservationToExchange: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ResourceName", + className: "ReservationToExchange", modelProperties: { - value: { - serializedName: "value", + reservationId: { + serializedName: "reservationId", type: { name: "String" } }, - localizedValue: { - readOnly: true, - serializedName: "localizedValue", + quantity: { + serializedName: "quantity", + type: { + name: "Number" + } + }, + billingRefundAmount: { + serializedName: "billingRefundAmount", + type: { + name: "Composite", + className: "Price" + } + }, + billingInformation: { + serializedName: "billingInformation", + type: { + name: "Composite", + className: "BillingInformation" + } + } + } + } +}; + +export const BillingInformation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BillingInformation", + modelProperties: { + billingCurrencyTotalPaidAmount: { + serializedName: "billingCurrencyTotalPaidAmount", + type: { + name: "Composite", + className: "Price" + } + }, + billingCurrencyProratedAmount: { + serializedName: "billingCurrencyProratedAmount", + type: { + name: "Composite", + className: "Price" + } + }, + billingCurrencyRemainingCommitmentAmount: { + serializedName: "billingCurrencyRemainingCommitmentAmount", + type: { + name: "Composite", + className: "Price" + } + } + } + } +}; + +export const ExchangePolicyErrors: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExchangePolicyErrors", + modelProperties: { + policyErrors: { + serializedName: "policyErrors", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ExchangePolicyError" + } + } + } + } + } + } +}; + +export const ExchangePolicyError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExchangePolicyError", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", type: { name: "String" } @@ -1949,8 +1995,474 @@ export const ResourceName: msRest.CompositeMapper = { } }; -export const QuotaProperties: msRest.CompositeMapper = { - serializedName: "QuotaProperties", +export const OperationResultError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationResultError", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const ExchangeRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExchangeRequest", + modelProperties: { + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ExchangeRequestProperties" + } + } + } + } +}; + +export const ExchangeRequestProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExchangeRequestProperties", + modelProperties: { + sessionId: { + serializedName: "sessionId", + type: { + name: "String" + } + } + } + } +}; + +export const ExchangeOperationResultResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExchangeOperationResultResponse", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ExchangeResponseProperties" + } + }, + error: { + serializedName: "error", + type: { + name: "Composite", + className: "OperationResultError" + } + } + } + } +}; + +export const ExchangeResponseProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExchangeResponseProperties", + modelProperties: { + sessionId: { + serializedName: "sessionId", + type: { + name: "String" + } + }, + netPayable: { + serializedName: "netPayable", + type: { + name: "Composite", + className: "Price" + } + }, + refundsTotal: { + serializedName: "refundsTotal", + type: { + name: "Composite", + className: "Price" + } + }, + purchasesTotal: { + serializedName: "purchasesTotal", + type: { + name: "Composite", + className: "Price" + } + }, + reservationsToPurchase: { + serializedName: "reservationsToPurchase", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ReservationToPurchaseExchange" + } + } + } + }, + reservationsToExchange: { + serializedName: "reservationsToExchange", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ReservationToReturnForExchange" + } + } + } + }, + policyResult: { + serializedName: "policyResult", + type: { + name: "Composite", + className: "ExchangePolicyErrors" + } + } + } + } +}; + +export const ReservationToPurchaseExchange: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationToPurchaseExchange", + modelProperties: { + reservationOrderId: { + serializedName: "reservationOrderId", + type: { + name: "String" + } + }, + reservationId: { + serializedName: "reservationId", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "PurchaseRequest" + } + }, + billingCurrencyTotal: { + serializedName: "billingCurrencyTotal", + type: { + name: "Composite", + className: "Price" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + } + } + } +}; + +export const ReservationToReturnForExchange: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationToReturnForExchange", + modelProperties: { + reservationId: { + serializedName: "reservationId", + type: { + name: "String" + } + }, + quantity: { + serializedName: "quantity", + type: { + name: "Number" + } + }, + billingRefundAmount: { + serializedName: "billingRefundAmount", + type: { + name: "Composite", + className: "Price" + } + }, + billingInformation: { + serializedName: "billingInformation", + type: { + name: "Composite", + className: "BillingInformation" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + } + } + } +}; + +export const ReservationsListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationsListResult", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ReservationResponse" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + }, + summary: { + serializedName: "summary", + type: { + name: "Composite", + className: "ReservationSummary" + } + } + } + } +}; + +export const ReservationSummary: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ReservationSummary", + modelProperties: { + succeededCount: { + serializedName: "succeededCount", + readOnly: true, + type: { + name: "Number" + } + }, + failedCount: { + serializedName: "failedCount", + readOnly: true, + type: { + name: "Number" + } + }, + expiringCount: { + serializedName: "expiringCount", + readOnly: true, + type: { + name: "Number" + } + }, + expiredCount: { + serializedName: "expiredCount", + readOnly: true, + type: { + name: "Number" + } + }, + pendingCount: { + serializedName: "pendingCount", + readOnly: true, + type: { + name: "Number" + } + }, + cancelledCount: { + serializedName: "cancelledCount", + readOnly: true, + type: { + name: "Number" + } + } + } + } +}; + +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetails" + } + } + } + } +}; + +export const ErrorDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetails", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ChangeDirectoryRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ChangeDirectoryRequest", + modelProperties: { + destinationTenantId: { + serializedName: "destinationTenantId", + type: { + name: "String" + } + } + } + } +}; + +export const ChangeDirectoryResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ChangeDirectoryResponse", + modelProperties: { + reservationOrder: { + serializedName: "reservationOrder", + type: { + name: "Composite", + className: "ChangeDirectoryResult" + } + }, + reservations: { + serializedName: "reservations", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ChangeDirectoryResult" + } + } + } + } + } + } +}; + +export const ChangeDirectoryResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ChangeDirectoryResult", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + isSucceeded: { + serializedName: "isSucceeded", + type: { + name: "Boolean" + } + }, + error: { + serializedName: "error", + type: { + name: "String" + } + } + } + } +}; + +export const CurrentQuotaLimitBase: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CurrentQuotaLimitBase", + modelProperties: { + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "QuotaProperties" + } + } + } + } +}; + +export const QuotaProperties: coreClient.CompositeMapper = { type: { name: "Composite", className: "QuotaProperties", @@ -1962,8 +2474,8 @@ export const QuotaProperties: msRest.CompositeMapper = { } }, currentValue: { - readOnly: true, serializedName: "currentValue", + readOnly: true, type: { name: "Number" } @@ -1984,12 +2496,12 @@ export const QuotaProperties: msRest.CompositeMapper = { resourceType: { serializedName: "resourceType", type: { - name: "Object" + name: "String" } }, quotaPeriod: { - readOnly: true, serializedName: "quotaPeriod", + readOnly: true, type: { name: "String" } @@ -1997,21 +2509,158 @@ export const QuotaProperties: msRest.CompositeMapper = { properties: { serializedName: "properties", type: { - name: "Object" + name: "Dictionary", + value: { type: { name: "any" } } } } } } }; -export const CurrentQuotaLimitBase: msRest.CompositeMapper = { - serializedName: "CurrentQuotaLimitBase", +export const ResourceName: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CurrentQuotaLimitBase", + className: "ResourceName", modelProperties: { + value: { + serializedName: "value", + type: { + name: "String" + } + }, + localizedValue: { + serializedName: "localizedValue", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ExceptionResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ExceptionResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ServiceError" + } + } + } + } +}; + +export const ServiceError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ServiceError", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ServiceErrorDetail" + } + } + } + } + } + } +}; + +export const ServiceErrorDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ServiceErrorDetail", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const QuotaRequestOneResourceSubmitResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "QuotaRequestOneResourceSubmitResponse", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "properties.message", + readOnly: true, + type: { + name: "String" + } + }, + requestSubmitTime: { + serializedName: "properties.requestSubmitTime", + readOnly: true, + type: { + name: "DateTime" + } + }, properties: { - serializedName: "properties", + serializedName: "properties.properties.properties", type: { name: "Composite", className: "QuotaProperties" @@ -2021,39 +2670,294 @@ export const CurrentQuotaLimitBase: msRest.CompositeMapper = { } }; -export const CurrentQuotaLimit: msRest.CompositeMapper = { - serializedName: "CurrentQuotaLimit", +export const QuotaRequestSubmitResponse201: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "QuotaRequestSubmitResponse201", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "properties.message", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const QuotaLimits: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "QuotaLimits", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CurrentQuotaLimitBase" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const QuotaRequestDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "QuotaRequestDetails", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + type: { + name: "String" + } + }, + message: { + serializedName: "properties.message", + readOnly: true, + type: { + name: "String" + } + }, + requestSubmitTime: { + serializedName: "properties.requestSubmitTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + value: { + serializedName: "properties.value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SubRequest" + } + } + } + } + } + } +}; + +export const QuotaRequestProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "QuotaRequestProperties", + modelProperties: { + provisioningState: { + serializedName: "provisioningState", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + requestSubmitTime: { + serializedName: "requestSubmitTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SubRequest" + } + } + } + } + } + } +}; + +export const SubRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SubRequest", + modelProperties: { + limit: { + serializedName: "limit", + readOnly: true, + type: { + name: "Number" + } + }, + name: { + serializedName: "name", + type: { + name: "Composite", + className: "ResourceName" + } + }, + resourceType: { + serializedName: "resourceType", + readOnly: true, + type: { + name: "String" + } + }, + unit: { + serializedName: "unit", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "provisioningState", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + subRequestId: { + serializedName: "subRequestId", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const QuotaRequestDetailsList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "QuotaRequestDetailsList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "QuotaRequestDetails" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const CurrentQuotaLimit: coreClient.CompositeMapper = { type: { name: "Composite", className: "CurrentQuotaLimit", modelProperties: { + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "properties.message", + readOnly: true, + type: { + name: "String" + } + }, properties: { serializedName: "quotaInformation.properties", type: { name: "Composite", className: "QuotaProperties" } - }, - provisioningState: { - readOnly: true, - serializedName: "properties.provisioningState", - type: { - name: "Object" - } - }, - message: { - readOnly: true, - serializedName: "properties.message", - type: { - name: "String" - } } } } }; -export const QuotaLimitsResponse: msRest.CompositeMapper = { - serializedName: "QuotaLimitsResponse", +export const QuotaLimitsResponse: coreClient.CompositeMapper = { type: { name: "Composite", className: "QuotaLimitsResponse", @@ -2080,8 +2984,7 @@ export const QuotaLimitsResponse: msRest.CompositeMapper = { } }; -export const CreateGenericQuotaRequestParameters: msRest.CompositeMapper = { - serializedName: "CreateGenericQuotaRequestParameters", +export const CreateGenericQuotaRequestParameters: coreClient.CompositeMapper = { type: { name: "Composite", className: "CreateGenericQuotaRequestParameters", @@ -2102,180 +3005,21 @@ export const CreateGenericQuotaRequestParameters: msRest.CompositeMapper = { } }; -export const SubRequest: msRest.CompositeMapper = { - serializedName: "SubRequest", - type: { - name: "Composite", - className: "SubRequest", - modelProperties: { - limit: { - readOnly: true, - serializedName: "limit", - type: { - name: "Number" - } - }, - name: { - serializedName: "name", - type: { - name: "Composite", - className: "ResourceName" - } - }, - resourceType: { - readOnly: true, - serializedName: "resourceType", - type: { - name: "String" - } - }, - unit: { - serializedName: "unit", - type: { - name: "String" - } - }, - provisioningState: { - serializedName: "provisioningState", - type: { - name: "Object" - } - }, - message: { - readOnly: true, - serializedName: "message", - type: { - name: "String" - } - }, - subRequestId: { - readOnly: true, - serializedName: "subRequestId", - type: { - name: "String" - } - } - } - } -}; - -export const QuotaRequestOneResourceSubmitResponse: msRest.CompositeMapper = { - serializedName: "QuotaRequestOneResourceSubmitResponse", - type: { - name: "Composite", - className: "QuotaRequestOneResourceSubmitResponse", - modelProperties: { - id: { - readOnly: true, - serializedName: "id", - type: { - name: "String" - } - }, - name: { - readOnly: true, - serializedName: "name", - type: { - name: "String" - } - }, - type: { - readOnly: true, - serializedName: "type", - type: { - name: "String" - } - }, - provisioningState: { - readOnly: true, - serializedName: "properties.provisioningState", - type: { - name: "Object" - } - }, - message: { - readOnly: true, - serializedName: "properties.message", - type: { - name: "String" - } - }, - requestSubmitTime: { - readOnly: true, - serializedName: "properties.requestSubmitTime", - type: { - name: "DateTime" - } - }, - properties: { - serializedName: "properties.properties.properties", - type: { - name: "Composite", - className: "QuotaProperties" - } - } - } - } -}; - -export const QuotaRequestProperties: msRest.CompositeMapper = { - serializedName: "QuotaRequestProperties", - type: { - name: "Composite", - className: "QuotaRequestProperties", - modelProperties: { - provisioningState: { - serializedName: "provisioningState", - type: { - name: "Object" - } - }, - message: { - readOnly: true, - serializedName: "message", - type: { - name: "String" - } - }, - requestSubmitTime: { - readOnly: true, - serializedName: "requestSubmitTime", - type: { - name: "DateTime" - } - }, - value: { - serializedName: "value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "SubRequest" - } - } - } - } - } - } -}; - -export const QuotaRequestSubmitResponse: msRest.CompositeMapper = { - serializedName: "QuotaRequestSubmitResponse", +export const QuotaRequestSubmitResponse: coreClient.CompositeMapper = { type: { name: "Composite", className: "QuotaRequestSubmitResponse", modelProperties: { id: { - readOnly: true, serializedName: "id", + readOnly: true, type: { name: "String" } }, name: { - readOnly: true, serializedName: "name", + readOnly: true, type: { name: "String" } @@ -2288,8 +3032,8 @@ export const QuotaRequestSubmitResponse: msRest.CompositeMapper = { } }, type: { - readOnly: true, serializedName: "type", + readOnly: true, type: { name: "String" } @@ -2298,192 +3042,7 @@ export const QuotaRequestSubmitResponse: msRest.CompositeMapper = { } }; -export const QuotaRequestSubmitResponse201: msRest.CompositeMapper = { - serializedName: "QuotaRequestSubmitResponse201", - type: { - name: "Composite", - className: "QuotaRequestSubmitResponse201", - modelProperties: { - id: { - readOnly: true, - serializedName: "id", - type: { - name: "String" - } - }, - name: { - readOnly: true, - serializedName: "name", - type: { - name: "String" - } - }, - type: { - readOnly: true, - serializedName: "type", - type: { - name: "String" - } - }, - provisioningState: { - readOnly: true, - serializedName: "properties.provisioningState", - type: { - name: "Object" - } - }, - message: { - readOnly: true, - serializedName: "properties.message", - type: { - name: "String" - } - } - } - } -}; - -export const QuotaRequestDetails: msRest.CompositeMapper = { - serializedName: "QuotaRequestDetails", - type: { - name: "Composite", - className: "QuotaRequestDetails", - modelProperties: { - id: { - readOnly: true, - serializedName: "id", - type: { - name: "String" - } - }, - name: { - readOnly: true, - serializedName: "name", - type: { - name: "String" - } - }, - provisioningState: { - serializedName: "properties.provisioningState", - type: { - name: "Object" - } - }, - message: { - readOnly: true, - serializedName: "properties.message", - type: { - name: "String" - } - }, - requestSubmitTime: { - readOnly: true, - serializedName: "properties.requestSubmitTime", - type: { - name: "DateTime" - } - }, - value: { - serializedName: "properties.value", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "SubRequest" - } - } - } - }, - type: { - readOnly: true, - serializedName: "type", - type: { - name: "String" - } - } - } - } -}; - -export const ServiceErrorDetail: msRest.CompositeMapper = { - serializedName: "ServiceErrorDetail", - type: { - name: "Composite", - className: "ServiceErrorDetail", - modelProperties: { - code: { - readOnly: true, - serializedName: "code", - type: { - name: "String" - } - }, - message: { - readOnly: true, - serializedName: "message", - type: { - name: "String" - } - } - } - } -}; - -export const ServiceError: msRest.CompositeMapper = { - serializedName: "ServiceError", - type: { - name: "Composite", - className: "ServiceError", - modelProperties: { - code: { - serializedName: "code", - type: { - name: "String" - } - }, - message: { - serializedName: "message", - type: { - name: "String" - } - }, - details: { - readOnly: true, - serializedName: "details", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ServiceErrorDetail" - } - } - } - } - } - } -}; - -export const ExceptionResponse: msRest.CompositeMapper = { - serializedName: "ExceptionResponse", - type: { - name: "Composite", - className: "ExceptionResponse", - modelProperties: { - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ServiceError" - } - } - } - } -}; - -export const CalculateExchangePostHeaders: msRest.CompositeMapper = { - serializedName: "calculateexchange-post-headers", +export const CalculateExchangePostHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "CalculateExchangePostHeaders", @@ -2510,8 +3069,7 @@ export const CalculateExchangePostHeaders: msRest.CompositeMapper = { } }; -export const ExchangePostHeaders: msRest.CompositeMapper = { - serializedName: "exchange-post-headers", +export const ExchangePostHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "ExchangePostHeaders", @@ -2538,8 +3096,7 @@ export const ExchangePostHeaders: msRest.CompositeMapper = { } }; -export const QuotaGetHeaders: msRest.CompositeMapper = { - serializedName: "quota-get-headers", +export const QuotaGetHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "QuotaGetHeaders", @@ -2554,8 +3111,7 @@ export const QuotaGetHeaders: msRest.CompositeMapper = { } }; -export const QuotaListHeaders: msRest.CompositeMapper = { - serializedName: "quota-list-headers", +export const QuotaListHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "QuotaListHeaders", @@ -2570,138 +3126,13 @@ export const QuotaListHeaders: msRest.CompositeMapper = { } }; -export const ReservationList: msRest.CompositeMapper = { - serializedName: "ReservationList", +export const QuotaListNextHeaders: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ReservationList", + className: "QuotaListNextHeaders", modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ReservationResponse" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const ReservationOrderList: msRest.CompositeMapper = { - serializedName: "ReservationOrderList", - type: { - name: "Composite", - className: "ReservationOrderList", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ReservationOrderResponse" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const OperationList: msRest.CompositeMapper = { - serializedName: "OperationList", - type: { - name: "Composite", - className: "OperationList", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "OperationResponse" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const QuotaLimits: msRest.CompositeMapper = { - serializedName: "QuotaLimits", - type: { - name: "Composite", - className: "QuotaLimits", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "CurrentQuotaLimitBase" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const QuotaRequestDetailsList: msRest.CompositeMapper = { - serializedName: "QuotaRequestDetailsList", - type: { - name: "Composite", - className: "QuotaRequestDetailsList", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "QuotaRequestDetails" - } - } - } - }, - nextLink: { - serializedName: "nextLink", + eTag: { + serializedName: "etag", type: { name: "String" } diff --git a/sdk/reservations/arm-reservations/src/models/parameters.ts b/sdk/reservations/arm-reservations/src/models/parameters.ts index c95aea884f0..011b341129a 100644 --- a/sdk/reservations/arm-reservations/src/models/parameters.ts +++ b/sdk/reservations/arm-reservations/src/models/parameters.ts @@ -3,51 +3,113 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + AvailableScopeRequest as AvailableScopeRequestMapper, + SplitRequest as SplitRequestMapper, + MergeRequest as MergeRequestMapper, + Patch as PatchMapper, + PurchaseRequest as PurchaseRequestMapper, + ChangeDirectoryRequest as ChangeDirectoryRequestMapper, + CalculateExchangeRequest as CalculateExchangeRequestMapper, + ExchangeRequest as ExchangeRequestMapper, + CurrentQuotaLimitBase as CurrentQuotaLimitBaseMapper +} from "../models/mappers"; -export const acceptLanguage: msRest.OperationParameter = { - parameterPath: "acceptLanguage", +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], mapper: { - serializedName: "accept-language", - defaultValue: 'en-US', + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", type: { name: "String" } } }; -export const apiVersion0: msRest.OperationQueryParameter = { + +export const body: OperationParameter = { + parameterPath: "body", + mapper: AvailableScopeRequestMapper +}; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String" + } + } +}; + +export const $host: OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const reservationOrderId: OperationURLParameter = { + parameterPath: "reservationOrderId", + mapper: { + serializedName: "reservationOrderId", + required: true, + type: { + name: "String" + } + } +}; + +export const reservationId: OperationURLParameter = { + parameterPath: "reservationId", + mapper: { + serializedName: "reservationId", + required: true, + type: { + name: "String" + } + } +}; + +export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - required: true, + defaultValue: "2021-07-01", isConstant: true, serializedName: "api-version", - defaultValue: '2020-10-01-preview', type: { name: "String" } } }; -export const apiVersion1: msRest.OperationQueryParameter = { - parameterPath: "apiVersion", - mapper: { - required: true, - isConstant: true, - serializedName: "api-version", - defaultValue: '2020-10-25', - type: { - name: "String" - } - } + +export const body1: OperationParameter = { + parameterPath: "body", + mapper: SplitRequestMapper }; -export const expand0: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "expand" - ], + +export const body2: OperationParameter = { + parameterPath: "body", + mapper: MergeRequestMapper +}; + +export const expand: OperationQueryParameter = { + parameterPath: ["options", "expand"], mapper: { serializedName: "expand", type: { @@ -55,23 +117,14 @@ export const expand0: msRest.OperationQueryParameter = { } } }; -export const expand1: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "expand" - ], - mapper: { - serializedName: "$expand", - type: { - name: "String" - } - } + +export const parameters: OperationParameter = { + parameterPath: "parameters", + mapper: PatchMapper }; -export const filter: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "filter" - ], + +export const filter: OperationQueryParameter = { + parameterPath: ["options", "filter"], mapper: { serializedName: "$filter", type: { @@ -79,104 +132,206 @@ export const filter: msRest.OperationQueryParameter = { } } }; -export const id: msRest.OperationURLParameter = { - parameterPath: "id", + +export const orderby: OperationQueryParameter = { + parameterPath: ["options", "orderby"], mapper: { - required: true, - serializedName: "id", + serializedName: "$orderby", type: { name: "String" } } }; -export const location0: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "location" - ], + +export const refreshSummary: OperationQueryParameter = { + parameterPath: ["options", "refreshSummary"], mapper: { - serializedName: "location", + serializedName: "refreshSummary", type: { name: "String" } } }; -export const location1: msRest.OperationURLParameter = { - parameterPath: "location", + +export const skiptoken: OperationQueryParameter = { + parameterPath: ["options", "skiptoken"], mapper: { - required: true, - serializedName: "location", + serializedName: "$skiptoken", + type: { + name: "Number" + } + } +}; + +export const selectedState: OperationQueryParameter = { + parameterPath: ["options", "selectedState"], + mapper: { + serializedName: "selectedState", type: { name: "String" } } }; -export const nextPageLink: msRest.OperationURLParameter = { - parameterPath: "nextPageLink", + +export const take: OperationQueryParameter = { + parameterPath: ["options", "take"], + mapper: { + serializedName: "take", + type: { + name: "Number" + } + } +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", mapper: { - required: true, serializedName: "nextLink", + required: true, type: { name: "String" } }, skipEncoding: true }; -export const providerId: msRest.OperationURLParameter = { - parameterPath: "providerId", + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", mapper: { + serializedName: "subscriptionId", required: true, - serializedName: "providerId", type: { name: "String" } } }; -export const reservationId: msRest.OperationURLParameter = { - parameterPath: "reservationId", + +export const reservedResourceType: OperationQueryParameter = { + parameterPath: ["options", "reservedResourceType"], mapper: { - required: true, - serializedName: "reservationId", - type: { - name: "String" - } - } -}; -export const reservationOrderId: msRest.OperationURLParameter = { - parameterPath: "reservationOrderId", - mapper: { - required: true, - serializedName: "reservationOrderId", - type: { - name: "String" - } - } -}; -export const reservedResourceType: msRest.OperationQueryParameter = { - parameterPath: "reservedResourceType", - mapper: { - required: true, serializedName: "reservedResourceType", type: { name: "String" } } }; -export const resourceName: msRest.OperationURLParameter = { - parameterPath: "resourceName", + +export const location: OperationQueryParameter = { + parameterPath: ["options", "location"], mapper: { - required: true, - serializedName: "resourceName", + serializedName: "location", type: { name: "String" } } }; -export const skiptoken: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "skiptoken" - ], + +export const body3: OperationParameter = { + parameterPath: "body", + mapper: PurchaseRequestMapper +}; + +export const expand1: OperationQueryParameter = { + parameterPath: ["options", "expand"], + mapper: { + serializedName: "$expand", + type: { + name: "String" + } + } +}; + +export const body4: OperationParameter = { + parameterPath: "body", + mapper: ChangeDirectoryRequestMapper +}; + +export const body5: OperationParameter = { + parameterPath: "body", + mapper: CalculateExchangeRequestMapper +}; + +export const body6: OperationParameter = { + parameterPath: "body", + mapper: ExchangeRequestMapper +}; + +export const providerId: OperationURLParameter = { + parameterPath: "providerId", + mapper: { + serializedName: "providerId", + required: true, + type: { + name: "String" + } + } +}; + +export const location1: OperationURLParameter = { + parameterPath: "location", + mapper: { + serializedName: "location", + required: true, + type: { + name: "String" + } + } +}; + +export const apiVersion1: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2020-10-25", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const resourceName: OperationURLParameter = { + parameterPath: "resourceName", + mapper: { + serializedName: "resourceName", + required: true, + type: { + name: "String" + } + } +}; + +export const createQuotaRequest: OperationParameter = { + parameterPath: "createQuotaRequest", + mapper: CurrentQuotaLimitBaseMapper +}; + +export const id: OperationURLParameter = { + parameterPath: "id", + mapper: { + serializedName: "id", + required: true, + type: { + name: "String" + } + } +}; + +export const top: OperationQueryParameter = { + parameterPath: ["options", "top"], + mapper: { + constraints: { + InclusiveMinimum: 1 + }, + serializedName: "$top", + type: { + name: "Number" + } + } +}; + +export const skiptoken1: OperationQueryParameter = { + parameterPath: ["options", "skiptoken"], mapper: { serializedName: "$skiptoken", type: { @@ -184,28 +339,3 @@ export const skiptoken: msRest.OperationQueryParameter = { } } }; -export const subscriptionId: msRest.OperationURLParameter = { - parameterPath: "subscriptionId", - mapper: { - required: true, - serializedName: "subscriptionId", - type: { - name: "String" - } - } -}; -export const top: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "top" - ], - mapper: { - serializedName: "$top", - constraints: { - InclusiveMinimum: 1 - }, - type: { - name: "Number" - } - } -}; diff --git a/sdk/reservations/arm-reservations/src/models/quotaMappers.ts b/sdk/reservations/arm-reservations/src/models/quotaMappers.ts deleted file mode 100644 index af2331a16f9..00000000000 --- a/sdk/reservations/arm-reservations/src/models/quotaMappers.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - BaseResource, - CurrentQuotaLimit, - CurrentQuotaLimitBase, - ExceptionResponse, - ExtendedStatusInfo, - PaymentDetail, - Price, - PurchaseRequest, - PurchaseRequestPropertiesReservedResourceProperties, - QuotaGetHeaders, - QuotaLimits, - QuotaListHeaders, - QuotaProperties, - QuotaRequestDetails, - QuotaRequestOneResourceSubmitResponse, - QuotaRequestProperties, - QuotaRequestSubmitResponse, - QuotaRequestSubmitResponse201, - RenewPropertiesResponse, - RenewPropertiesResponseBillingCurrencyTotal, - RenewPropertiesResponsePricingCurrencyTotal, - ReservationMergeProperties, - ReservationOrderBillingPlanInformation, - ReservationOrderResponse, - ReservationProperties, - ReservationResponse, - ReservationSplitProperties, - ResourceName, - ServiceError, - ServiceErrorDetail, - SkuName, - SubRequest -} from "../models/mappers"; diff --git a/sdk/reservations/arm-reservations/src/models/quotaRequestStatusMappers.ts b/sdk/reservations/arm-reservations/src/models/quotaRequestStatusMappers.ts deleted file mode 100644 index 4f39a128af2..00000000000 --- a/sdk/reservations/arm-reservations/src/models/quotaRequestStatusMappers.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - BaseResource, - CurrentQuotaLimit, - CurrentQuotaLimitBase, - ExceptionResponse, - ExtendedStatusInfo, - PaymentDetail, - Price, - PurchaseRequest, - PurchaseRequestPropertiesReservedResourceProperties, - QuotaProperties, - QuotaRequestDetails, - QuotaRequestDetailsList, - QuotaRequestOneResourceSubmitResponse, - QuotaRequestProperties, - QuotaRequestSubmitResponse, - RenewPropertiesResponse, - RenewPropertiesResponseBillingCurrencyTotal, - RenewPropertiesResponsePricingCurrencyTotal, - ReservationMergeProperties, - ReservationOrderBillingPlanInformation, - ReservationOrderResponse, - ReservationProperties, - ReservationResponse, - ReservationSplitProperties, - ResourceName, - ServiceError, - ServiceErrorDetail, - SkuName, - SubRequest -} from "../models/mappers"; diff --git a/sdk/reservations/arm-reservations/src/models/reservationMappers.ts b/sdk/reservations/arm-reservations/src/models/reservationMappers.ts deleted file mode 100644 index 03dde736357..00000000000 --- a/sdk/reservations/arm-reservations/src/models/reservationMappers.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - AvailableScopeProperties, - AvailableScopeRequest, - AvailableScopeRequestProperties, - BaseResource, - CurrentQuotaLimit, - CurrentQuotaLimitBase, - ErrorModel, - ExtendedErrorInfo, - ExtendedStatusInfo, - MergeRequest, - Patch, - PatchPropertiesRenewProperties, - PaymentDetail, - Price, - PurchaseRequest, - PurchaseRequestPropertiesReservedResourceProperties, - QuotaProperties, - QuotaRequestDetails, - QuotaRequestOneResourceSubmitResponse, - QuotaRequestProperties, - QuotaRequestSubmitResponse, - RenewPropertiesResponse, - RenewPropertiesResponseBillingCurrencyTotal, - RenewPropertiesResponsePricingCurrencyTotal, - ReservationList, - ReservationMergeProperties, - ReservationOrderBillingPlanInformation, - ReservationOrderResponse, - ReservationProperties, - ReservationResponse, - ReservationSplitProperties, - ResourceName, - ScopeProperties, - SkuName, - SplitRequest, - SubRequest, - SubscriptionScopeProperties -} from "../models/mappers"; diff --git a/sdk/reservations/arm-reservations/src/models/reservationOrderMappers.ts b/sdk/reservations/arm-reservations/src/models/reservationOrderMappers.ts deleted file mode 100644 index d5c6d9edc8a..00000000000 --- a/sdk/reservations/arm-reservations/src/models/reservationOrderMappers.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - BaseResource, - CalculatePriceResponse, - CalculatePriceResponseProperties, - CalculatePriceResponsePropertiesBillingCurrencyTotal, - CalculatePriceResponsePropertiesPricingCurrencyTotal, - CurrentQuotaLimit, - CurrentQuotaLimitBase, - ErrorModel, - ExtendedErrorInfo, - ExtendedStatusInfo, - PaymentDetail, - Price, - PurchaseRequest, - PurchaseRequestPropertiesReservedResourceProperties, - QuotaProperties, - QuotaRequestDetails, - QuotaRequestOneResourceSubmitResponse, - QuotaRequestProperties, - QuotaRequestSubmitResponse, - RenewPropertiesResponse, - RenewPropertiesResponseBillingCurrencyTotal, - RenewPropertiesResponsePricingCurrencyTotal, - ReservationMergeProperties, - ReservationOrderBillingPlanInformation, - ReservationOrderList, - ReservationOrderResponse, - ReservationProperties, - ReservationResponse, - ReservationSplitProperties, - ResourceName, - SkuName, - SubRequest -} from "../models/mappers"; diff --git a/sdk/reservations/arm-reservations/src/operations/calculateExchange.ts b/sdk/reservations/arm-reservations/src/operations/calculateExchange.ts index 9a69d319795..2a7e94952e5 100644 --- a/sdk/reservations/arm-reservations/src/operations/calculateExchange.ts +++ b/sdk/reservations/arm-reservations/src/operations/calculateExchange.ts @@ -3,89 +3,141 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/calculateExchangeMappers"; +import { CalculateExchange } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AzureReservationAPIContext } from "../azureReservationAPIContext"; +import { AzureReservationAPI } from "../azureReservationAPI"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + CalculateExchangeRequest, + CalculateExchangePostOptionalParams, + CalculateExchangePostResponse +} from "../models"; -/** Class representing a CalculateExchange. */ -export class CalculateExchange { - private readonly client: AzureReservationAPIContext; +/** Class containing CalculateExchange operations. */ +export class CalculateExchangeImpl implements CalculateExchange { + private readonly client: AzureReservationAPI; /** - * Create a CalculateExchange. - * @param {AzureReservationAPIContext} client Reference to the service client. + * Initialize a new instance of the class CalculateExchange class. + * @param client Reference to the service client */ - constructor(client: AzureReservationAPIContext) { + constructor(client: AzureReservationAPI) { this.client = client; } /** * Calculates price for exchanging `Reservations` if there are no policy errors. - * @summary Calculates the refund amounts and price of the new purchases. + * * @param body Request containing purchases and refunds that need to be executed. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - post(body: Models.CalculateExchangeRequest, options?: msRest.RequestOptionsBase): Promise { - return this.beginPost(body,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginPost( + body: CalculateExchangeRequest, + options?: CalculateExchangePostOptionalParams + ): Promise< + PollerLike< + PollOperationState, + CalculateExchangePostResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { body, options }, + postOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); } /** * Calculates price for exchanging `Reservations` if there are no policy errors. - * @summary Calculates the refund amounts and price of the new purchases. + * * @param body Request containing purchases and refunds that need to be executed. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginPost(body: Models.CalculateExchangeRequest, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - body, - options - }, - beginPostOperationSpec, - options); + async beginPostAndWait( + body: CalculateExchangeRequest, + options?: CalculateExchangePostOptionalParams + ): Promise { + const poller = await this.beginPost(body, options); + return poller.pollUntilDone(); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const beginPostOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const postOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Capacity/calculateExchange", httpMethod: "POST", - path: "providers/Microsoft.Capacity/calculateExchange", - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "body", - mapper: { - ...Mappers.CalculateExchangeRequest, - required: true - } - }, responses: { 200: { - bodyMapper: Mappers.CalculateExchangeOperationResultResponse, - headersMapper: Mappers.CalculateExchangePostHeaders + bodyMapper: Mappers.CalculateExchangeOperationResultResponse + }, + 201: { + bodyMapper: Mappers.CalculateExchangeOperationResultResponse }, 202: { - headersMapper: Mappers.CalculateExchangePostHeaders + bodyMapper: Mappers.CalculateExchangeOperationResultResponse + }, + 204: { + bodyMapper: Mappers.CalculateExchangeOperationResultResponse }, default: { - bodyMapper: Mappers.ErrorModel, - headersMapper: Mappers.CalculateExchangePostHeaders + bodyMapper: Mappers.ErrorModel } }, + requestBody: Parameters.body5, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; diff --git a/sdk/reservations/arm-reservations/src/operations/exchange.ts b/sdk/reservations/arm-reservations/src/operations/exchange.ts index b19ce8e5f86..1ce3fcbb93d 100644 --- a/sdk/reservations/arm-reservations/src/operations/exchange.ts +++ b/sdk/reservations/arm-reservations/src/operations/exchange.ts @@ -3,89 +3,138 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/exchangeMappers"; +import { Exchange } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AzureReservationAPIContext } from "../azureReservationAPIContext"; +import { AzureReservationAPI } from "../azureReservationAPI"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + ExchangeRequest, + ExchangePostOptionalParams, + ExchangePostResponse +} from "../models"; -/** Class representing a Exchange. */ -export class Exchange { - private readonly client: AzureReservationAPIContext; +/** Class containing Exchange operations. */ +export class ExchangeImpl implements Exchange { + private readonly client: AzureReservationAPI; /** - * Create a Exchange. - * @param {AzureReservationAPIContext} client Reference to the service client. + * Initialize a new instance of the class Exchange class. + * @param client Reference to the service client */ - constructor(client: AzureReservationAPIContext) { + constructor(client: AzureReservationAPI) { this.client = client; } /** * Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. - * @summary Exchange Reservation(s) + * * @param body Request containing the refunds and purchases that need to be executed. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - post(body: Models.ExchangeRequest, options?: msRest.RequestOptionsBase): Promise { - return this.beginPost(body,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginPost( + body: ExchangeRequest, + options?: ExchangePostOptionalParams + ): Promise< + PollerLike, ExchangePostResponse> + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { body, options }, + postOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); } /** * Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. - * @summary Exchange Reservation(s) + * * @param body Request containing the refunds and purchases that need to be executed. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginPost(body: Models.ExchangeRequest, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - body, - options - }, - beginPostOperationSpec, - options); + async beginPostAndWait( + body: ExchangeRequest, + options?: ExchangePostOptionalParams + ): Promise { + const poller = await this.beginPost(body, options); + return poller.pollUntilDone(); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const beginPostOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const postOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Capacity/exchange", httpMethod: "POST", - path: "providers/Microsoft.Capacity/exchange", - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "body", - mapper: { - ...Mappers.ExchangeRequest, - required: true - } - }, responses: { 200: { - bodyMapper: Mappers.ExchangeOperationResultResponse, - headersMapper: Mappers.ExchangePostHeaders + bodyMapper: Mappers.ExchangeOperationResultResponse + }, + 201: { + bodyMapper: Mappers.ExchangeOperationResultResponse }, 202: { - headersMapper: Mappers.ExchangePostHeaders + bodyMapper: Mappers.ExchangeOperationResultResponse + }, + 204: { + bodyMapper: Mappers.ExchangeOperationResultResponse }, default: { - bodyMapper: Mappers.ErrorModel, - headersMapper: Mappers.ExchangePostHeaders + bodyMapper: Mappers.ErrorModel } }, + requestBody: Parameters.body6, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; diff --git a/sdk/reservations/arm-reservations/src/operations/index.ts b/sdk/reservations/arm-reservations/src/operations/index.ts index a04a56e654d..425138628c9 100644 --- a/sdk/reservations/arm-reservations/src/operations/index.ts +++ b/sdk/reservations/arm-reservations/src/operations/index.ts @@ -3,8 +3,7 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ export * from "./reservation"; diff --git a/sdk/reservations/arm-reservations/src/operations/operation.ts b/sdk/reservations/arm-reservations/src/operations/operation.ts index 492c3c69e2a..ddf54ac4cd9 100644 --- a/sdk/reservations/arm-reservations/src/operations/operation.ts +++ b/sdk/reservations/arm-reservations/src/operations/operation.ts @@ -3,118 +3,109 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/operationMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operation } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AzureReservationAPIContext } from "../azureReservationAPIContext"; +import { AzureReservationAPI } from "../azureReservationAPI"; +import { + OperationResponse, + OperationListNextOptionalParams, + OperationListOptionalParams, + OperationListResponse, + OperationListNextResponse +} from "../models"; -/** Class representing a Operation. */ -export class Operation { - private readonly client: AzureReservationAPIContext; +/// +/** Class containing Operation operations. */ +export class OperationImpl implements Operation { + private readonly client: AzureReservationAPI; /** - * Create a Operation. - * @param {AzureReservationAPIContext} client Reference to the service client. + * Initialize a new instance of the class Operation class. + * @param client Reference to the service client */ - constructor(client: AzureReservationAPIContext) { + constructor(client: AzureReservationAPI) { this.client = client; } /** * List all the operations. - * @summary Get operations. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options + public list( + options?: OperationListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); }, - listOperationSpec, - callback) as Promise; + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: OperationListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: OperationListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } } /** * List all the operations. - * @summary Get operations. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + private _list( + options?: OperationListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + nextLink: string, + options?: OperationListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.Capacity/operations", - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.OperationList - }, - default: { - bodyMapper: Mappers.ErrorModel - } - }, - serializer -}; +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); -const listNextOperationSpec: msRest.OperationSpec = { +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Capacity/operations", httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.OperationList @@ -123,5 +114,24 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationList + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/reservations/arm-reservations/src/operations/quota.ts b/sdk/reservations/arm-reservations/src/operations/quota.ts index 9dd20c907d9..fd7cf412c2f 100644 --- a/sdk/reservations/arm-reservations/src/operations/quota.ts +++ b/sdk/reservations/arm-reservations/src/operations/quota.ts @@ -3,181 +3,221 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/quotaMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Quota } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AzureReservationAPIContext } from "../azureReservationAPIContext"; +import { AzureReservationAPI } from "../azureReservationAPI"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + CurrentQuotaLimitBase, + QuotaListNextOptionalParams, + QuotaListOptionalParams, + QuotaGetOptionalParams, + QuotaGetResponse, + QuotaCreateOrUpdateOptionalParams, + QuotaCreateOrUpdateResponse, + QuotaUpdateOptionalParams, + QuotaUpdateResponse, + QuotaListResponse, + QuotaListNextResponse +} from "../models"; -/** Class representing a Quota. */ -export class Quota { - private readonly client: AzureReservationAPIContext; +/// +/** Class containing Quota operations. */ +export class QuotaImpl implements Quota { + private readonly client: AzureReservationAPI; /** - * Create a Quota. - * @param {AzureReservationAPIContext} client Reference to the service client. + * Initialize a new instance of the class Quota class. + * @param client Reference to the service client */ - constructor(client: AzureReservationAPIContext) { + constructor(client: AzureReservationAPI) { this.client = client; } /** - * Get the current quota (service limit) and usage of a resource. You can use the response from the - * GET operation to submit quota update request. + * Gets a list of current quotas (service limits) and usage for all resources. The response from the + * list quota operation can be leveraged to request quota updates. * @param subscriptionId Azure subscription ID. * @param providerId Azure resource provider ID. * @param location Azure region. - * @param resourceName The resource name for a resource provider, such as SKU name for - * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(subscriptionId: string, providerId: string, location: string, resourceName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param subscriptionId Azure subscription ID. - * @param providerId Azure resource provider ID. - * @param location Azure region. - * @param resourceName The resource name for a resource provider, such as SKU name for - * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices - * @param callback The callback - */ - get(subscriptionId: string, providerId: string, location: string, resourceName: string, callback: msRest.ServiceCallback): void; - /** - * @param subscriptionId Azure subscription ID. - * @param providerId Azure resource provider ID. - * @param location Azure region. - * @param resourceName The resource name for a resource provider, such as SKU name for - * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices - * @param options The optional parameters - * @param callback The callback - */ - get(subscriptionId: string, providerId: string, location: string, resourceName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(subscriptionId: string, providerId: string, location: string, resourceName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { + public list( + subscriptionId: string, + providerId: string, + location: string, + options?: QuotaListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + subscriptionId, + providerId, + location, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage( + subscriptionId, + providerId, + location, + options + ); + } + }; + } + + private async *listPagingPage( + subscriptionId: string, + providerId: string, + location: string, + options?: QuotaListOptionalParams + ): AsyncIterableIterator { + let result = await this._list( + subscriptionId, + providerId, + location, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext( subscriptionId, providerId, location, - resourceName, + continuationToken, options - }, - getOperationSpec, - callback) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + subscriptionId: string, + providerId: string, + location: string, + options?: QuotaListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + subscriptionId, + providerId, + location, + options + )) { + yield* page; + } + } + + /** + * Get the current quota (service limit) and usage of a resource. You can use the response from the GET + * operation to submit quota update request. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for + * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param options The options parameters. + */ + get( + subscriptionId: string, + providerId: string, + location: string, + resourceName: string, + options?: QuotaGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { subscriptionId, providerId, location, resourceName, options }, + getOperationSpec + ); } /** * Create or update the quota (service limits) of a resource to the requested value. - * Steps: - * - * 1. Make the Get request to get the quota information for specific resource. - * - * 2. To increase the quota, update the limit field in the response from Get request to new value. - * - * 3. Submit the JSON to the quota request API to update the quota. - * The Create quota request may be constructed as follows. The PUT operation can be used to update + * Steps: + * + 1. Make the Get request to get the quota information for specific resource. + * + 2. To increase the quota, update the limit field in the response from Get request to new value. + * + 3. Submit the JSON to the quota request API to update the quota. + * The Create quota request may be constructed as follows. The PUT operation can be used to update * the quota. * @param subscriptionId Azure subscription ID. * @param providerId Azure resource provider ID. * @param location Azure region. * @param resourceName The resource name for a resource provider, such as SKU name for - * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices * @param createQuotaRequest Quota requests payload. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - createOrUpdate(subscriptionId: string, providerId: string, location: string, resourceName: string, createQuotaRequest: Models.CurrentQuotaLimitBase, options?: msRest.RequestOptionsBase): Promise { - return this.beginCreateOrUpdate(subscriptionId, providerId, location, resourceName, createQuotaRequest, options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; - } + async beginCreateOrUpdate( + subscriptionId: string, + providerId: string, + location: string, + resourceName: string, + createQuotaRequest: CurrentQuotaLimitBase, + options?: QuotaCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + QuotaCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; - /** - * Update the quota (service limits) of this resource to the requested value. - * - * • To get the quota information for specific resource, send a GET request. - * - * • To increase the quota, update the limit field from the GET response to a new value. - * - * • To update the quota value, submit the JSON response to the quota request API to update the - * quota. - * • To update the quota. use the PATCH operation. - * @param subscriptionId Azure subscription ID. - * @param providerId Azure resource provider ID. - * @param location Azure region. - * @param resourceName The resource name for a resource provider, such as SKU name for - * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices - * @param createQuotaRequest Payload for the quota request. - * @param [options] The optional parameters - * @returns Promise - */ - update(subscriptionId: string, providerId: string, location: string, resourceName: string, createQuotaRequest: Models.CurrentQuotaLimitBase, options?: msRest.RequestOptionsBase): Promise { - return this.beginUpdate(subscriptionId, providerId, location, resourceName, createQuotaRequest, options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; - } - - /** - * Gets a list of current quotas (service limits) and usage for all resources. The response from - * the list quota operation can be leveraged to request quota updates. - * @param subscriptionId Azure subscription ID. - * @param providerId Azure resource provider ID. - * @param location Azure region. - * @param [options] The optional parameters - * @returns Promise - */ - list(subscriptionId: string, providerId: string, location: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param subscriptionId Azure subscription ID. - * @param providerId Azure resource provider ID. - * @param location Azure region. - * @param callback The callback - */ - list(subscriptionId: string, providerId: string, location: string, callback: msRest.ServiceCallback): void; - /** - * @param subscriptionId Azure subscription ID. - * @param providerId Azure resource provider ID. - * @param location Azure region. - * @param options The optional parameters - * @param callback The callback - */ - list(subscriptionId: string, providerId: string, location: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(subscriptionId: string, providerId: string, location: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - subscriptionId, - providerId, - location, - options - }, - listOperationSpec, - callback) as Promise; - } - - /** - * Create or update the quota (service limits) of a resource to the requested value. - * Steps: - * - * 1. Make the Get request to get the quota information for specific resource. - * - * 2. To increase the quota, update the limit field in the response from Get request to new value. - * - * 3. Submit the JSON to the quota request API to update the quota. - * The Create quota request may be constructed as follows. The PUT operation can be used to update - * the quota. - * @param subscriptionId Azure subscription ID. - * @param providerId Azure resource provider ID. - * @param location Azure region. - * @param resourceName The resource name for a resource provider, such as SKU name for - * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices - * @param createQuotaRequest Quota requests payload. - * @param [options] The optional parameters - * @returns Promise - */ - beginCreateOrUpdate(subscriptionId: string, providerId: string, location: string, resourceName: string, createQuotaRequest: Models.CurrentQuotaLimitBase, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( + const lro = new LroImpl( + sendOperation, { subscriptionId, providerId, @@ -186,31 +226,122 @@ export class Quota { createQuotaRequest, options }, - beginCreateOrUpdateOperationSpec, - options); + createOrUpdateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); } /** - * Update the quota (service limits) of this resource to the requested value. - * - * • To get the quota information for specific resource, send a GET request. - * - * • To increase the quota, update the limit field from the GET response to a new value. - * - * • To update the quota value, submit the JSON response to the quota request API to update the - * quota. - * • To update the quota. use the PATCH operation. + * Create or update the quota (service limits) of a resource to the requested value. + * Steps: + * + 1. Make the Get request to get the quota information for specific resource. + * + 2. To increase the quota, update the limit field in the response from Get request to new value. + * + 3. Submit the JSON to the quota request API to update the quota. + * The Create quota request may be constructed as follows. The PUT operation can be used to update + * the quota. * @param subscriptionId Azure subscription ID. * @param providerId Azure resource provider ID. * @param location Azure region. * @param resourceName The resource name for a resource provider, such as SKU name for - * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices - * @param createQuotaRequest Payload for the quota request. - * @param [options] The optional parameters - * @returns Promise + * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param createQuotaRequest Quota requests payload. + * @param options The options parameters. */ - beginUpdate(subscriptionId: string, providerId: string, location: string, resourceName: string, createQuotaRequest: Models.CurrentQuotaLimitBase, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( + async beginCreateOrUpdateAndWait( + subscriptionId: string, + providerId: string, + location: string, + resourceName: string, + createQuotaRequest: CurrentQuotaLimitBase, + options?: QuotaCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + subscriptionId, + providerId, + location, + resourceName, + createQuotaRequest, + options + ); + return poller.pollUntilDone(); + } + + /** + * Update the quota (service limits) of this resource to the requested value. + * + • To get the quota information for specific resource, send a GET request. + * + • To increase the quota, update the limit field from the GET response to a new value. + * + • To update the quota value, submit the JSON response to the quota request API to update the + * quota. + * • To update the quota. use the PATCH operation. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for + * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param createQuotaRequest Payload for the quota request. + * @param options The options parameters. + */ + async beginUpdate( + subscriptionId: string, + providerId: string, + location: string, + resourceName: string, + createQuotaRequest: CurrentQuotaLimitBase, + options?: QuotaUpdateOptionalParams + ): Promise< + PollerLike, QuotaUpdateResponse> + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, { subscriptionId, providerId, @@ -219,191 +350,231 @@ export class Quota { createQuotaRequest, options }, - beginUpdateOperationSpec, - options); + updateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); } /** - * Gets a list of current quotas (service limits) and usage for all resources. The response from - * the list quota operation can be leveraged to request quota updates. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * Update the quota (service limits) of this resource to the requested value. + * + • To get the quota information for specific resource, send a GET request. + * + • To increase the quota, update the limit field from the GET response to a new value. + * + • To update the quota value, submit the JSON response to the quota request API to update the + * quota. + * • To update the quota. use the PATCH operation. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for + * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param createQuotaRequest Payload for the quota request. + * @param options The options parameters. */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + async beginUpdateAndWait( + subscriptionId: string, + providerId: string, + location: string, + resourceName: string, + createQuotaRequest: CurrentQuotaLimitBase, + options?: QuotaUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate( + subscriptionId, + providerId, + location, + resourceName, + createQuotaRequest, + options + ); + return poller.pollUntilDone(); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * Gets a list of current quotas (service limits) and usage for all resources. The response from the + * list quota operation can be leveraged to request quota updates. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param options The options parameters. */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _list( + subscriptionId: string, + providerId: string, + location: string, + options?: QuotaListOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { subscriptionId, providerId, location, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + subscriptionId: string, + providerId: string, + location: string, + nextLink: string, + options?: QuotaListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { subscriptionId, providerId, location, nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.providerId, - Parameters.location1, - Parameters.resourceName - ], - queryParameters: [ - Parameters.apiVersion1 - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.CurrentQuotaLimitBase, headersMapper: Mappers.QuotaGetHeaders }, default: { - bodyMapper: Mappers.ExceptionResponse, - headersMapper: Mappers.QuotaGetHeaders + bodyMapper: Mappers.ExceptionResponse } }, + queryParameters: [Parameters.apiVersion1], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.providerId, + Parameters.location1, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], serializer }; - -const listOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits", +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse + }, + 201: { + bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse + }, + 202: { + bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse + }, + 204: { + bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse + }, + default: { + bodyMapper: Mappers.ExceptionResponse + } + }, + requestBody: Parameters.createQuotaRequest, + queryParameters: [Parameters.apiVersion1], urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.providerId, + Parameters.location1, + Parameters.resourceName + ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse + }, + 201: { + bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse + }, + 202: { + bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse + }, + 204: { + bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse + }, + default: { + bodyMapper: Mappers.ExceptionResponse + } + }, + requestBody: Parameters.createQuotaRequest, + queryParameters: [Parameters.apiVersion1], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.providerId, + Parameters.location1, + Parameters.resourceName + ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.QuotaLimits, + headersMapper: Mappers.QuotaListHeaders + }, + default: { + bodyMapper: Mappers.ExceptionResponse + } + }, + queryParameters: [Parameters.apiVersion1], + urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.providerId, Parameters.location1 ], - queryParameters: [ - Parameters.apiVersion1 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.QuotaLimits, - headersMapper: Mappers.QuotaListHeaders - }, - default: { - bodyMapper: Mappers.ExceptionResponse, - headersMapper: Mappers.QuotaListHeaders - } - }, + headerParameters: [Parameters.accept], serializer }; - -const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.providerId, - Parameters.location1, - Parameters.resourceName - ], - queryParameters: [ - Parameters.apiVersion1 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "createQuotaRequest", - mapper: { - ...Mappers.CurrentQuotaLimitBase, - required: true - } - }, - responses: { - 200: { - bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse - }, - 201: { - bodyMapper: Mappers.QuotaRequestSubmitResponse201 - }, - default: { - bodyMapper: Mappers.ExceptionResponse - } - }, - serializer -}; - -const beginUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PATCH", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimits/{resourceName}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.providerId, - Parameters.location1, - Parameters.resourceName - ], - queryParameters: [ - Parameters.apiVersion1 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "createQuotaRequest", - mapper: { - ...Mappers.CurrentQuotaLimitBase, - required: true - } - }, - responses: { - 200: { - bodyMapper: Mappers.QuotaRequestOneResourceSubmitResponse - }, - 201: { - bodyMapper: Mappers.QuotaRequestSubmitResponse201 - }, - default: { - bodyMapper: Mappers.ExceptionResponse - } - }, - serializer -}; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion1 - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.QuotaLimits, - headersMapper: Mappers.QuotaListHeaders + headersMapper: Mappers.QuotaListNextHeaders }, default: { - bodyMapper: Mappers.ExceptionResponse, - headersMapper: Mappers.QuotaListHeaders + bodyMapper: Mappers.ExceptionResponse } }, + queryParameters: [Parameters.apiVersion1], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.providerId, + Parameters.location1 + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/reservations/arm-reservations/src/operations/quotaRequestStatus.ts b/sdk/reservations/arm-reservations/src/operations/quotaRequestStatus.ts index e16dee92ad3..24ed7688d73 100644 --- a/sdk/reservations/arm-reservations/src/operations/quotaRequestStatus.ts +++ b/sdk/reservations/arm-reservations/src/operations/quotaRequestStatus.ts @@ -3,156 +3,190 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/quotaRequestStatusMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { QuotaRequestStatus } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AzureReservationAPIContext } from "../azureReservationAPIContext"; +import { AzureReservationAPI } from "../azureReservationAPI"; +import { + QuotaRequestDetails, + QuotaRequestStatusListNextOptionalParams, + QuotaRequestStatusListOptionalParams, + QuotaRequestStatusGetOptionalParams, + QuotaRequestStatusGetResponse, + QuotaRequestStatusListResponse, + QuotaRequestStatusListNextResponse +} from "../models"; -/** Class representing a QuotaRequestStatus. */ -export class QuotaRequestStatus { - private readonly client: AzureReservationAPIContext; +/// +/** Class containing QuotaRequestStatus operations. */ +export class QuotaRequestStatusImpl implements QuotaRequestStatus { + private readonly client: AzureReservationAPI; /** - * Create a QuotaRequestStatus. - * @param {AzureReservationAPIContext} client Reference to the service client. + * Initialize a new instance of the class QuotaRequestStatus class. + * @param client Reference to the service client */ - constructor(client: AzureReservationAPIContext) { + constructor(client: AzureReservationAPI) { this.client = client; } /** - * For the specified Azure region (location), get the details and status of the quota request by - * the quota request ID for the resources of the resource provider. The PUT request for the quota - * (service limit) returns a response with the requestId parameter. + * For the specified Azure region (location), subscription, and resource provider, get the history of + * the quota requests for the past year. To select specific quota requests, use the oData filter. * @param subscriptionId Azure subscription ID. * @param providerId Azure resource provider ID. * @param location Azure region. - * @param id Quota Request ID. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(subscriptionId: string, providerId: string, location: string, id: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param subscriptionId Azure subscription ID. - * @param providerId Azure resource provider ID. - * @param location Azure region. - * @param id Quota Request ID. - * @param callback The callback - */ - get(subscriptionId: string, providerId: string, location: string, id: string, callback: msRest.ServiceCallback): void; - /** - * @param subscriptionId Azure subscription ID. - * @param providerId Azure resource provider ID. - * @param location Azure region. - * @param id Quota Request ID. - * @param options The optional parameters - * @param callback The callback - */ - get(subscriptionId: string, providerId: string, location: string, id: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(subscriptionId: string, providerId: string, location: string, id: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { + public list( + subscriptionId: string, + providerId: string, + location: string, + options?: QuotaRequestStatusListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + subscriptionId, + providerId, + location, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage( + subscriptionId, + providerId, + location, + options + ); + } + }; + } + + private async *listPagingPage( + subscriptionId: string, + providerId: string, + location: string, + options?: QuotaRequestStatusListOptionalParams + ): AsyncIterableIterator { + let result = await this._list( + subscriptionId, + providerId, + location, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext( subscriptionId, providerId, location, - id, + continuationToken, options - }, - getOperationSpec, - callback) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + subscriptionId: string, + providerId: string, + location: string, + options?: QuotaRequestStatusListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + subscriptionId, + providerId, + location, + options + )) { + yield* page; + } } /** - * For the specified Azure region (location), subscription, and resource provider, get the history - * of the quota requests for the past year. To select specific quota requests, use the oData - * filter. + * For the specified Azure region (location), get the details and status of the quota request by the + * quota request ID for the resources of the resource provider. The PUT request for the quota (service + * limit) returns a response with the requestId parameter. * @param subscriptionId Azure subscription ID. * @param providerId Azure resource provider ID. * @param location Azure region. - * @param [options] The optional parameters - * @returns Promise + * @param id Quota Request ID. + * @param options The options parameters. */ - list(subscriptionId: string, providerId: string, location: string, options?: Models.QuotaRequestStatusListOptionalParams): Promise; - /** - * @param subscriptionId Azure subscription ID. - * @param providerId Azure resource provider ID. - * @param location Azure region. - * @param callback The callback - */ - list(subscriptionId: string, providerId: string, location: string, callback: msRest.ServiceCallback): void; - /** - * @param subscriptionId Azure subscription ID. - * @param providerId Azure resource provider ID. - * @param location Azure region. - * @param options The optional parameters - * @param callback The callback - */ - list(subscriptionId: string, providerId: string, location: string, options: Models.QuotaRequestStatusListOptionalParams, callback: msRest.ServiceCallback): void; - list(subscriptionId: string, providerId: string, location: string, options?: Models.QuotaRequestStatusListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + subscriptionId: string, + providerId: string, + location: string, + id: string, + options?: QuotaRequestStatusGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - subscriptionId, - providerId, - location, - options - }, - listOperationSpec, - callback) as Promise; + { subscriptionId, providerId, location, id, options }, + getOperationSpec + ); } /** - * For the specified Azure region (location), subscription, and resource provider, get the history - * of the quota requests for the past year. To select specific quota requests, use the oData - * filter. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * For the specified Azure region (location), subscription, and resource provider, get the history of + * the quota requests for the past year. To select specific quota requests, use the oData filter. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param options The options parameters. */ - listNext(nextPageLink: string, options?: Models.QuotaRequestStatusListNextOptionalParams): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listNext(nextPageLink: string, options: Models.QuotaRequestStatusListNextOptionalParams, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: Models.QuotaRequestStatusListNextOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _list( + subscriptionId: string, + providerId: string, + location: string, + options?: QuotaRequestStatusListOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { subscriptionId, providerId, location, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + subscriptionId: string, + providerId: string, + location: string, + nextLink: string, + options?: QuotaRequestStatusListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { subscriptionId, providerId, location, nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimitsRequests/{id}", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimitsRequests/{id}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.providerId, - Parameters.location1, - Parameters.id - ], - queryParameters: [ - Parameters.apiVersion1 - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.QuotaRequestDetails @@ -161,53 +195,47 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ExceptionResponse } }, + queryParameters: [Parameters.apiVersion1], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.providerId, + Parameters.location1, + Parameters.id + ], + headerParameters: [Parameters.accept], serializer }; - -const listOperationSpec: msRest.OperationSpec = { +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimitsRequests", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Capacity/resourceProviders/{providerId}/locations/{location}/serviceLimitsRequests", + responses: { + 200: { + bodyMapper: Mappers.QuotaRequestDetailsList + }, + default: { + bodyMapper: Mappers.ExceptionResponse + } + }, + queryParameters: [ + Parameters.filter, + Parameters.apiVersion1, + Parameters.top, + Parameters.skiptoken1 + ], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.providerId, Parameters.location1 ], - queryParameters: [ - Parameters.apiVersion1, - Parameters.filter, - Parameters.top, - Parameters.skiptoken - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.QuotaRequestDetailsList - }, - default: { - bodyMapper: Mappers.ExceptionResponse - } - }, + headerParameters: [Parameters.accept], serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion1, - Parameters.filter, - Parameters.top, - Parameters.skiptoken - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.QuotaRequestDetailsList @@ -216,5 +244,19 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ExceptionResponse } }, + queryParameters: [ + Parameters.filter, + Parameters.apiVersion1, + Parameters.top, + Parameters.skiptoken1 + ], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.providerId, + Parameters.location1 + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/reservations/arm-reservations/src/operations/reservation.ts b/sdk/reservations/arm-reservations/src/operations/reservation.ts index 6dde501a186..431cc065169 100644 --- a/sdk/reservations/arm-reservations/src/operations/reservation.ts +++ b/sdk/reservations/arm-reservations/src/operations/reservation.ts @@ -3,553 +3,904 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/reservationMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Reservation } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AzureReservationAPIContext } from "../azureReservationAPIContext"; +import { AzureReservationAPI } from "../azureReservationAPI"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + ReservationResponse, + ReservationListNextOptionalParams, + ReservationListOptionalParams, + ReservationListRevisionsNextOptionalParams, + ReservationListRevisionsOptionalParams, + ReservationListAllNextOptionalParams, + ReservationListAllOptionalParams, + AvailableScopeRequest, + ReservationAvailableScopesOptionalParams, + ReservationAvailableScopesResponse, + SplitRequest, + ReservationSplitOptionalParams, + ReservationSplitResponse, + MergeRequest, + ReservationMergeOptionalParams, + ReservationMergeResponse, + ReservationListResponse, + ReservationGetOptionalParams, + ReservationGetResponse, + Patch, + ReservationUpdateOptionalParams, + ReservationUpdateResponse, + ReservationListRevisionsResponse, + ReservationListAllResponse, + ReservationListNextResponse, + ReservationListRevisionsNextResponse, + ReservationListAllNextResponse +} from "../models"; -/** Class representing a Reservation. */ -export class Reservation { - private readonly client: AzureReservationAPIContext; +/// +/** Class containing Reservation operations. */ +export class ReservationImpl implements Reservation { + private readonly client: AzureReservationAPI; /** - * Create a Reservation. - * @param {AzureReservationAPIContext} client Reference to the service client. + * Initialize a new instance of the class Reservation class. + * @param client Reference to the service client */ - constructor(client: AzureReservationAPIContext) { + constructor(client: AzureReservationAPI) { this.client = client; } + /** + * List `Reservation`s within a single `ReservationOrder`. + * @param reservationOrderId Order Id of the reservation + * @param options The options parameters. + */ + public list( + reservationOrderId: string, + options?: ReservationListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(reservationOrderId, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(reservationOrderId, options); + } + }; + } + + private async *listPagingPage( + reservationOrderId: string, + options?: ReservationListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(reservationOrderId, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext( + reservationOrderId, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + reservationOrderId: string, + options?: ReservationListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(reservationOrderId, options)) { + yield* page; + } + } + + /** + * List of all the revisions for the `Reservation`. + * @param reservationId Id of the Reservation Item + * @param reservationOrderId Order Id of the reservation + * @param options The options parameters. + */ + public listRevisions( + reservationId: string, + reservationOrderId: string, + options?: ReservationListRevisionsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listRevisionsPagingAll( + reservationId, + reservationOrderId, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listRevisionsPagingPage( + reservationId, + reservationOrderId, + options + ); + } + }; + } + + private async *listRevisionsPagingPage( + reservationId: string, + reservationOrderId: string, + options?: ReservationListRevisionsOptionalParams + ): AsyncIterableIterator { + let result = await this._listRevisions( + reservationId, + reservationOrderId, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listRevisionsNext( + reservationId, + reservationOrderId, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listRevisionsPagingAll( + reservationId: string, + reservationOrderId: string, + options?: ReservationListRevisionsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listRevisionsPagingPage( + reservationId, + reservationOrderId, + options + )) { + yield* page; + } + } + + /** + * List the reservations and the roll up counts of reservations group by provisioning states that the + * user has access to in the current tenant. + * @param options The options parameters. + */ + public listAll( + options?: ReservationListAllOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listAllPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listAllPagingPage(options); + } + }; + } + + private async *listAllPagingPage( + options?: ReservationListAllOptionalParams + ): AsyncIterableIterator { + let result = await this._listAll(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listAllNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listAllPagingAll( + options?: ReservationListAllOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listAllPagingPage(options)) { + yield* page; + } + } + /** * Get Available Scopes for `Reservation`. - * @summary Get Available Scopes for `Reservation`. + * * @param reservationOrderId Order Id of the reservation * @param reservationId Id of the Reservation Item - * @param body - * @param [options] The optional parameters - * @returns Promise + * @param body Available scope + * @param options The options parameters. */ - availableScopes(reservationOrderId: string, reservationId: string, body: Models.AvailableScopeRequest, options?: msRest.RequestOptionsBase): Promise { - return this.beginAvailableScopes(reservationOrderId, reservationId, body, options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginAvailableScopes( + reservationOrderId: string, + reservationId: string, + body: AvailableScopeRequest, + options?: ReservationAvailableScopesOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationAvailableScopesResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { reservationOrderId, reservationId, body, options }, + availableScopesOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Get Available Scopes for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the Reservation Item + * @param body Available scope + * @param options The options parameters. + */ + async beginAvailableScopesAndWait( + reservationOrderId: string, + reservationId: string, + body: AvailableScopeRequest, + options?: ReservationAvailableScopesOptionalParams + ): Promise { + const poller = await this.beginAvailableScopes( + reservationOrderId, + reservationId, + body, + options + ); + return poller.pollUntilDone(); } /** * Split a `Reservation` into two `Reservation`s with specified quantity distribution. - * @summary Split the `Reservation`. * @param reservationOrderId Order Id of the reservation * @param body Information needed to Split a reservation item - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - split(reservationOrderId: string, body: Models.SplitRequest, options?: msRest.RequestOptionsBase): Promise { - return this.beginSplit(reservationOrderId, body, options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginSplit( + reservationOrderId: string, + body: SplitRequest, + options?: ReservationSplitOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationSplitResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { reservationOrderId, body, options }, + splitOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); + } + + /** + * Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * @param reservationOrderId Order Id of the reservation + * @param body Information needed to Split a reservation item + * @param options The options parameters. + */ + async beginSplitAndWait( + reservationOrderId: string, + body: SplitRequest, + options?: ReservationSplitOptionalParams + ): Promise { + const poller = await this.beginSplit(reservationOrderId, body, options); + return poller.pollUntilDone(); } /** * Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged * must have same properties. - * @summary Merges two `Reservation`s. * @param reservationOrderId Order Id of the reservation * @param body Information needed for commercial request for a reservation - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - merge(reservationOrderId: string, body: Models.MergeRequest, options?: msRest.RequestOptionsBase): Promise { - return this.beginMerge(reservationOrderId, body, options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginMerge( + reservationOrderId: string, + body: MergeRequest, + options?: ReservationMergeOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationMergeResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { reservationOrderId, body, options }, + mergeOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); + } + + /** + * Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged + * must have same properties. + * @param reservationOrderId Order Id of the reservation + * @param body Information needed for commercial request for a reservation + * @param options The options parameters. + */ + async beginMergeAndWait( + reservationOrderId: string, + body: MergeRequest, + options?: ReservationMergeOptionalParams + ): Promise { + const poller = await this.beginMerge(reservationOrderId, body, options); + return poller.pollUntilDone(); } /** * List `Reservation`s within a single `ReservationOrder`. - * @summary Get `Reservation`s in a given reservation Order * @param reservationOrderId Order Id of the reservation - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(reservationOrderId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param reservationOrderId Order Id of the reservation - * @param callback The callback - */ - list(reservationOrderId: string, callback: msRest.ServiceCallback): void; - /** - * @param reservationOrderId Order Id of the reservation - * @param options The optional parameters - * @param callback The callback - */ - list(reservationOrderId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(reservationOrderId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _list( + reservationOrderId: string, + options?: ReservationListOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - reservationOrderId, - options - }, - listOperationSpec, - callback) as Promise; + { reservationOrderId, options }, + listOperationSpec + ); } /** * Get specific `Reservation` details. - * @summary Get `Reservation` details. * @param reservationId Id of the Reservation Item * @param reservationOrderId Order Id of the reservation - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(reservationId: string, reservationOrderId: string, options?: Models.ReservationGetOptionalParams): Promise; - /** - * @param reservationId Id of the Reservation Item - * @param reservationOrderId Order Id of the reservation - * @param callback The callback - */ - get(reservationId: string, reservationOrderId: string, callback: msRest.ServiceCallback): void; - /** - * @param reservationId Id of the Reservation Item - * @param reservationOrderId Order Id of the reservation - * @param options The optional parameters - * @param callback The callback - */ - get(reservationId: string, reservationOrderId: string, options: Models.ReservationGetOptionalParams, callback: msRest.ServiceCallback): void; - get(reservationId: string, reservationOrderId: string, options?: Models.ReservationGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + reservationId: string, + reservationOrderId: string, + options?: ReservationGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - reservationId, - reservationOrderId, - options - }, - getOperationSpec, - callback) as Promise; + { reservationId, reservationOrderId, options }, + getOperationSpec + ); } /** * Updates the applied scopes of the `Reservation`. - * @summary Updates a `Reservation`. * @param reservationOrderId Order Id of the reservation * @param reservationId Id of the Reservation Item * @param parameters Information needed to patch a reservation item - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - update(reservationOrderId: string, reservationId: string, parameters: Models.Patch, options?: msRest.RequestOptionsBase): Promise { - return this.beginUpdate(reservationOrderId, reservationId, parameters, options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; - } + async beginUpdate( + reservationOrderId: string, + reservationId: string, + parameters: Patch, + options?: ReservationUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; - /** - * List of all the revisions for the `Reservation`. - * @summary Get `Reservation` revisions. - * @param reservationId Id of the Reservation Item - * @param reservationOrderId Order Id of the reservation - * @param [options] The optional parameters - * @returns Promise - */ - listRevisions(reservationId: string, reservationOrderId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param reservationId Id of the Reservation Item - * @param reservationOrderId Order Id of the reservation - * @param callback The callback - */ - listRevisions(reservationId: string, reservationOrderId: string, callback: msRest.ServiceCallback): void; - /** - * @param reservationId Id of the Reservation Item - * @param reservationOrderId Order Id of the reservation - * @param options The optional parameters - * @param callback The callback - */ - listRevisions(reservationId: string, reservationOrderId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listRevisions(reservationId: string, reservationOrderId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - reservationId, - reservationOrderId, - options - }, - listRevisionsOperationSpec, - callback) as Promise; - } - - /** - * Get Available Scopes for `Reservation`. - * @summary Get Available Scopes for `Reservation`. - * @param reservationOrderId Order Id of the reservation - * @param reservationId Id of the Reservation Item - * @param body - * @param [options] The optional parameters - * @returns Promise - */ - beginAvailableScopes(reservationOrderId: string, reservationId: string, body: Models.AvailableScopeRequest, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - reservationOrderId, - reservationId, - body, - options - }, - beginAvailableScopesOperationSpec, - options); - } - - /** - * Split a `Reservation` into two `Reservation`s with specified quantity distribution. - * @summary Split the `Reservation`. - * @param reservationOrderId Order Id of the reservation - * @param body Information needed to Split a reservation item - * @param [options] The optional parameters - * @returns Promise - */ - beginSplit(reservationOrderId: string, body: Models.SplitRequest, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - reservationOrderId, - body, - options - }, - beginSplitOperationSpec, - options); - } - - /** - * Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged - * must have same properties. - * @summary Merges two `Reservation`s. - * @param reservationOrderId Order Id of the reservation - * @param body Information needed for commercial request for a reservation - * @param [options] The optional parameters - * @returns Promise - */ - beginMerge(reservationOrderId: string, body: Models.MergeRequest, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - reservationOrderId, - body, - options - }, - beginMergeOperationSpec, - options); + const lro = new LroImpl( + sendOperation, + { reservationOrderId, reservationId, parameters, options }, + updateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** * Updates the applied scopes of the `Reservation`. - * @summary Updates a `Reservation`. * @param reservationOrderId Order Id of the reservation * @param reservationId Id of the Reservation Item * @param parameters Information needed to patch a reservation item - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginUpdate(reservationOrderId: string, reservationId: string, parameters: Models.Patch, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - reservationOrderId, - reservationId, - parameters, - options - }, - beginUpdateOperationSpec, - options); - } - - /** - * List `Reservation`s within a single `ReservationOrder`. - * @summary Get `Reservation`s in a given reservation Order - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + async beginUpdateAndWait( + reservationOrderId: string, + reservationId: string, + parameters: Patch, + options?: ReservationUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate( + reservationOrderId, + reservationId, + parameters, + options + ); + return poller.pollUntilDone(); } /** * List of all the revisions for the `Reservation`. - * @summary Get `Reservation` revisions. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * @param reservationId Id of the Reservation Item + * @param reservationOrderId Order Id of the reservation + * @param options The options parameters. */ - listRevisionsNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listRevisionsNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listRevisionsNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listRevisionsNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listRevisions( + reservationId: string, + reservationOrderId: string, + options?: ReservationListRevisionsOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listRevisionsNextOperationSpec, - callback) as Promise; + { reservationId, reservationOrderId, options }, + listRevisionsOperationSpec + ); + } + + /** + * List the reservations and the roll up counts of reservations group by provisioning states that the + * user has access to in the current tenant. + * @param options The options parameters. + */ + private _listAll( + options?: ReservationListAllOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listAllOperationSpec); + } + + /** + * ListNext + * @param reservationOrderId Order Id of the reservation + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + reservationOrderId: string, + nextLink: string, + options?: ReservationListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { reservationOrderId, nextLink, options }, + listNextOperationSpec + ); + } + + /** + * ListRevisionsNext + * @param reservationId Id of the Reservation Item + * @param reservationOrderId Order Id of the reservation + * @param nextLink The nextLink from the previous successful call to the ListRevisions method. + * @param options The options parameters. + */ + private _listRevisionsNext( + reservationId: string, + reservationOrderId: string, + nextLink: string, + options?: ReservationListRevisionsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { reservationId, reservationOrderId, nextLink, options }, + listRevisionsNextOperationSpec + ); + } + + /** + * ListAllNext + * @param nextLink The nextLink from the previous successful call to the ListAll method. + * @param options The options parameters. + */ + private _listAllNext( + nextLink: string, + options?: ReservationListAllNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { nextLink, options }, + listAllNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations", - urlParameters: [ - Parameters.reservationOrderId - ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.ReservationList - }, - default: { - bodyMapper: Mappers.ErrorModel - } - }, - serializer -}; +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}", - urlParameters: [ - Parameters.reservationId, - Parameters.reservationOrderId - ], - queryParameters: [ - Parameters.apiVersion0, - Parameters.expand0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.ReservationResponse - }, - default: { - bodyMapper: Mappers.ErrorModel - } - }, - serializer -}; - -const listRevisionsOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/revisions", - urlParameters: [ - Parameters.reservationId, - Parameters.reservationOrderId - ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.ReservationList - }, - default: { - bodyMapper: Mappers.ErrorModel - } - }, - serializer -}; - -const beginAvailableScopesOperationSpec: msRest.OperationSpec = { +const availableScopesOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/availableScopes", httpMethod: "POST", - path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/availableScopes", - urlParameters: [ - Parameters.reservationOrderId, - Parameters.reservationId - ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "body", - mapper: { - ...Mappers.AvailableScopeRequest, - required: true - } - }, responses: { 200: { bodyMapper: Mappers.AvailableScopeProperties }, + 201: { + bodyMapper: Mappers.AvailableScopeProperties + }, + 202: { + bodyMapper: Mappers.AvailableScopeProperties + }, + 204: { + bodyMapper: Mappers.AvailableScopeProperties + }, default: { bodyMapper: Mappers.ErrorModel } }, - serializer -}; - -const beginSplitOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/split", - urlParameters: [ - Parameters.reservationOrderId - ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "body", - mapper: { - ...Mappers.SplitRequest, - required: true - } - }, - responses: { - 200: { - bodyMapper: { - serializedName: "parsedResponse", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ReservationResponse" - } - } - } - } - }, - 202: {}, - default: { - bodyMapper: Mappers.ErrorModel - } - }, - serializer -}; - -const beginMergeOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/merge", - urlParameters: [ - Parameters.reservationOrderId - ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "body", - mapper: { - ...Mappers.MergeRequest, - required: true - } - }, - responses: { - 200: { - bodyMapper: { - serializedName: "parsedResponse", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ReservationResponse" - } - } - } - } - }, - 202: {}, - default: { - bodyMapper: Mappers.ErrorModel - } - }, - serializer -}; - -const beginUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PATCH", - path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}", + requestBody: Parameters.body, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.reservationOrderId, Parameters.reservationId ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.Patch, - required: true + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const splitOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/split", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: { + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "ReservationResponse" } + } + } + } + }, + 201: { + bodyMapper: { + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "ReservationResponse" } + } + } + } + }, + 202: { + bodyMapper: { + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "ReservationResponse" } + } + } + } + }, + 204: { + bodyMapper: { + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "ReservationResponse" } + } + } + } + }, + default: { + bodyMapper: Mappers.ErrorModel } }, + requestBody: Parameters.body1, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.reservationOrderId], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const mergeOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/merge", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: { + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "ReservationResponse" } + } + } + } + }, + 201: { + bodyMapper: { + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "ReservationResponse" } + } + } + } + }, + 202: { + bodyMapper: { + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "ReservationResponse" } + } + } + } + }, + 204: { + bodyMapper: { + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "ReservationResponse" } + } + } + } + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + requestBody: Parameters.body2, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.reservationOrderId], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const listOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ReservationList + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.reservationOrderId], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ReservationResponse }, - 202: {}, default: { bodyMapper: Mappers.ErrorModel } }, + queryParameters: [Parameters.apiVersion, Parameters.expand], + urlParameters: [ + Parameters.$host, + Parameters.reservationOrderId, + Parameters.reservationId + ], + headerParameters: [Parameters.accept], serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.ReservationResponse + }, + 201: { + bodyMapper: Mappers.ReservationResponse + }, + 202: { + bodyMapper: Mappers.ReservationResponse + }, + 204: { + bodyMapper: Mappers.ReservationResponse + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.$host, + Parameters.reservationOrderId, + Parameters.reservationId ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const listRevisionsOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/reservations/{reservationId}/revisions", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ReservationList @@ -558,22 +909,42 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.reservationOrderId, + Parameters.reservationId + ], + headerParameters: [Parameters.accept], serializer }; - -const listRevisionsNextOperationSpec: msRest.OperationSpec = { +const listAllOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Capacity/reservations", httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], + responses: { + 200: { + bodyMapper: Mappers.ReservationsListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.apiVersion, + Parameters.filter, + Parameters.orderby, + Parameters.refreshSummary, + Parameters.skiptoken, + Parameters.selectedState, + Parameters.take ], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ReservationList @@ -582,5 +953,57 @@ const listRevisionsNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.reservationOrderId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const listRevisionsNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ReservationList + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.reservationOrderId, + Parameters.reservationId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], + serializer +}; +const listAllNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ReservationsListResult + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.orderby, + Parameters.refreshSummary, + Parameters.skiptoken, + Parameters.selectedState, + Parameters.take + ], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/reservations/arm-reservations/src/operations/reservationOrder.ts b/sdk/reservations/arm-reservations/src/operations/reservationOrder.ts index 78d274728c6..81ab9fa30ca 100644 --- a/sdk/reservations/arm-reservations/src/operations/reservationOrder.ts +++ b/sdk/reservations/arm-reservations/src/operations/reservationOrder.ts @@ -3,192 +3,251 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/reservationOrderMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { ReservationOrder } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { AzureReservationAPIContext } from "../azureReservationAPIContext"; +import { AzureReservationAPI } from "../azureReservationAPI"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + ReservationOrderResponse, + ReservationOrderListNextOptionalParams, + ReservationOrderListOptionalParams, + PurchaseRequest, + ReservationOrderCalculateOptionalParams, + ReservationOrderCalculateResponse, + ReservationOrderListResponse, + ReservationOrderPurchaseOptionalParams, + ReservationOrderPurchaseResponse, + ReservationOrderGetOptionalParams, + ReservationOrderGetResponse, + ChangeDirectoryRequest, + ReservationOrderChangeDirectoryOptionalParams, + ReservationOrderChangeDirectoryResponse, + ReservationOrderListNextResponse +} from "../models"; -/** Class representing a ReservationOrder. */ -export class ReservationOrder { - private readonly client: AzureReservationAPIContext; +/// +/** Class containing ReservationOrder operations. */ +export class ReservationOrderImpl implements ReservationOrder { + private readonly client: AzureReservationAPI; /** - * Create a ReservationOrder. - * @param {AzureReservationAPIContext} client Reference to the service client. + * Initialize a new instance of the class ReservationOrder class. + * @param client Reference to the service client */ - constructor(client: AzureReservationAPIContext) { + constructor(client: AzureReservationAPI) { this.client = client; } /** - * Calculate price for placing a `ReservationOrder`. - * @summary Calculate price for a `ReservationOrder`. - * @param body Information needed for calculate or purchase reservation - * @param [options] The optional parameters - * @returns Promise + * List of all the `ReservationOrder`s that the user has access to in the current tenant. + * @param options The options parameters. */ - calculate(body: Models.PurchaseRequest, options?: msRest.RequestOptionsBase): Promise; - /** - * @param body Information needed for calculate or purchase reservation - * @param callback The callback - */ - calculate(body: Models.PurchaseRequest, callback: msRest.ServiceCallback): void; - /** - * @param body Information needed for calculate or purchase reservation - * @param options The optional parameters - * @param callback The callback - */ - calculate(body: Models.PurchaseRequest, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - calculate(body: Models.PurchaseRequest, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - body, - options + public list( + options?: ReservationOrderListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); }, - calculateOperationSpec, - callback) as Promise; + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: ReservationOrderListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: ReservationOrderListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * Calculate price for placing a `ReservationOrder`. + * @param body Information needed for calculate or purchase reservation + * @param options The options parameters. + */ + calculate( + body: PurchaseRequest, + options?: ReservationOrderCalculateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { body, options }, + calculateOperationSpec + ); } /** * List of all the `ReservationOrder`s that the user has access to in the current tenant. - * @summary Get all `ReservationOrder`s. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - listOperationSpec, - callback) as Promise; + private _list( + options?: ReservationOrderListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); } /** * Purchase `ReservationOrder` and create resource under the specified URI. - * @summary Purchase `ReservationOrder` * @param reservationOrderId Order Id of the reservation * @param body Information needed for calculate or purchase reservation - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - purchase(reservationOrderId: string, body: Models.PurchaseRequest, options?: msRest.RequestOptionsBase): Promise { - return this.beginPurchase(reservationOrderId, body, options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginPurchase( + reservationOrderId: string, + body: PurchaseRequest, + options?: ReservationOrderPurchaseOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationOrderPurchaseResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { reservationOrderId, body, options }, + purchaseOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "location" + }); + } + + /** + * Purchase `ReservationOrder` and create resource under the specified URI. + * @param reservationOrderId Order Id of the reservation + * @param body Information needed for calculate or purchase reservation + * @param options The options parameters. + */ + async beginPurchaseAndWait( + reservationOrderId: string, + body: PurchaseRequest, + options?: ReservationOrderPurchaseOptionalParams + ): Promise { + const poller = await this.beginPurchase(reservationOrderId, body, options); + return poller.pollUntilDone(); } /** * Get the details of the `ReservationOrder`. - * @summary Get a specific `ReservationOrder`. * @param reservationOrderId Order Id of the reservation - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(reservationOrderId: string, options?: Models.ReservationOrderGetOptionalParams): Promise; - /** - * @param reservationOrderId Order Id of the reservation - * @param callback The callback - */ - get(reservationOrderId: string, callback: msRest.ServiceCallback): void; - /** - * @param reservationOrderId Order Id of the reservation - * @param options The optional parameters - * @param callback The callback - */ - get(reservationOrderId: string, options: Models.ReservationOrderGetOptionalParams, callback: msRest.ServiceCallback): void; - get(reservationOrderId: string, options?: Models.ReservationOrderGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + reservationOrderId: string, + options?: ReservationOrderGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - reservationOrderId, - options - }, - getOperationSpec, - callback) as Promise; + { reservationOrderId, options }, + getOperationSpec + ); } /** - * Purchase `ReservationOrder` and create resource under the specified URI. - * @summary Purchase `ReservationOrder` + * Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant + * id * @param reservationOrderId Order Id of the reservation - * @param body Information needed for calculate or purchase reservation - * @param [options] The optional parameters - * @returns Promise + * @param body Information needed to change directory of reservation order + * @param options The options parameters. */ - beginPurchase(reservationOrderId: string, body: Models.PurchaseRequest, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - reservationOrderId, - body, - options - }, - beginPurchaseOperationSpec, - options); + changeDirectory( + reservationOrderId: string, + body: ChangeDirectoryRequest, + options?: ReservationOrderChangeDirectoryOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { reservationOrderId, body, options }, + changeDirectoryOperationSpec + ); } /** - * List of all the `ReservationOrder`s that the user has access to in the current tenant. - * @summary Get all `ReservationOrder`s. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + nextLink: string, + options?: ReservationOrderListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const calculateOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const calculateOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Capacity/calculatePrice", httpMethod: "POST", - path: "providers/Microsoft.Capacity/calculatePrice", - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "body", - mapper: { - ...Mappers.PurchaseRequest, - required: true - } - }, responses: { 200: { bodyMapper: Mappers.CalculatePriceResponse @@ -197,18 +256,16 @@ const calculateOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, + requestBody: Parameters.body3, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const listOperationSpec: msRest.OperationSpec = { +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Capacity/reservationOrders", httpMethod: "GET", - path: "providers/Microsoft.Capacity/reservationOrders", - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.ReservationOrderList @@ -217,79 +274,76 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], serializer }; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}", - urlParameters: [ - Parameters.reservationOrderId - ], - queryParameters: [ - Parameters.apiVersion0, - Parameters.expand1 - ], - headerParameters: [ - Parameters.acceptLanguage - ], +const purchaseOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}", + httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.ReservationOrderResponse }, - default: { - bodyMapper: Mappers.ErrorModel - } - }, - serializer -}; - -const beginPurchaseOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}", - urlParameters: [ - Parameters.reservationOrderId - ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "body", - mapper: { - ...Mappers.PurchaseRequest, - required: true - } - }, - responses: { - 200: { + 201: { bodyMapper: Mappers.ReservationOrderResponse }, 202: { bodyMapper: Mappers.ReservationOrderResponse }, + 204: { + bodyMapper: Mappers.ReservationOrderResponse + }, default: { bodyMapper: Mappers.ErrorModel } }, + requestBody: Parameters.body3, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.reservationOrderId], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { +const getOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}", httpMethod: "GET", - baseUrl: "https://management.azure.com", + responses: { + 200: { + bodyMapper: Mappers.ReservationOrderResponse + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + queryParameters: [Parameters.apiVersion, Parameters.expand1], + urlParameters: [Parameters.$host, Parameters.reservationOrderId], + headerParameters: [Parameters.accept], + serializer +}; +const changeDirectoryOperationSpec: coreClient.OperationSpec = { + path: + "/providers/Microsoft.Capacity/reservationOrders/{reservationOrderId}/changeDirectory", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.ChangeDirectoryResponse + }, + default: { + bodyMapper: Mappers.ErrorModel + } + }, + requestBody: Parameters.body4, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.reservationOrderId], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion0 - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ReservationOrderList @@ -298,5 +352,8 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorModel } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/reservations/arm-reservations/src/operationsInterfaces/calculateExchange.ts b/sdk/reservations/arm-reservations/src/operationsInterfaces/calculateExchange.ts new file mode 100644 index 00000000000..444dbafe32d --- /dev/null +++ b/sdk/reservations/arm-reservations/src/operationsInterfaces/calculateExchange.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + CalculateExchangeRequest, + CalculateExchangePostOptionalParams, + CalculateExchangePostResponse +} from "../models"; + +/** Interface representing a CalculateExchange. */ +export interface CalculateExchange { + /** + * Calculates price for exchanging `Reservations` if there are no policy errors. + * + * @param body Request containing purchases and refunds that need to be executed. + * @param options The options parameters. + */ + beginPost( + body: CalculateExchangeRequest, + options?: CalculateExchangePostOptionalParams + ): Promise< + PollerLike< + PollOperationState, + CalculateExchangePostResponse + > + >; + /** + * Calculates price for exchanging `Reservations` if there are no policy errors. + * + * @param body Request containing purchases and refunds that need to be executed. + * @param options The options parameters. + */ + beginPostAndWait( + body: CalculateExchangeRequest, + options?: CalculateExchangePostOptionalParams + ): Promise; +} diff --git a/sdk/reservations/arm-reservations/src/operationsInterfaces/exchange.ts b/sdk/reservations/arm-reservations/src/operationsInterfaces/exchange.ts new file mode 100644 index 00000000000..28f455d10a8 --- /dev/null +++ b/sdk/reservations/arm-reservations/src/operationsInterfaces/exchange.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + ExchangeRequest, + ExchangePostOptionalParams, + ExchangePostResponse +} from "../models"; + +/** Interface representing a Exchange. */ +export interface Exchange { + /** + * Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + * + * @param body Request containing the refunds and purchases that need to be executed. + * @param options The options parameters. + */ + beginPost( + body: ExchangeRequest, + options?: ExchangePostOptionalParams + ): Promise< + PollerLike, ExchangePostResponse> + >; + /** + * Returns one or more `Reservations` in exchange for one or more `Reservation` purchases. + * + * @param body Request containing the refunds and purchases that need to be executed. + * @param options The options parameters. + */ + beginPostAndWait( + body: ExchangeRequest, + options?: ExchangePostOptionalParams + ): Promise; +} diff --git a/sdk/reservations/arm-reservations/src/operationsInterfaces/index.ts b/sdk/reservations/arm-reservations/src/operationsInterfaces/index.ts new file mode 100644 index 00000000000..425138628c9 --- /dev/null +++ b/sdk/reservations/arm-reservations/src/operationsInterfaces/index.ts @@ -0,0 +1,15 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./reservation"; +export * from "./reservationOrder"; +export * from "./operation"; +export * from "./calculateExchange"; +export * from "./exchange"; +export * from "./quota"; +export * from "./quotaRequestStatus"; diff --git a/sdk/reservations/arm-reservations/src/operationsInterfaces/operation.ts b/sdk/reservations/arm-reservations/src/operationsInterfaces/operation.ts new file mode 100644 index 00000000000..e22ef838b2e --- /dev/null +++ b/sdk/reservations/arm-reservations/src/operationsInterfaces/operation.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { OperationResponse, OperationListOptionalParams } from "../models"; + +/// +/** Interface representing a Operation. */ +export interface Operation { + /** + * List all the operations. + * @param options The options parameters. + */ + list( + options?: OperationListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/reservations/arm-reservations/src/operationsInterfaces/quota.ts b/sdk/reservations/arm-reservations/src/operationsInterfaces/quota.ts new file mode 100644 index 00000000000..350994eb4e3 --- /dev/null +++ b/sdk/reservations/arm-reservations/src/operationsInterfaces/quota.ts @@ -0,0 +1,169 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + CurrentQuotaLimitBase, + QuotaListOptionalParams, + QuotaGetOptionalParams, + QuotaGetResponse, + QuotaCreateOrUpdateOptionalParams, + QuotaCreateOrUpdateResponse, + QuotaUpdateOptionalParams, + QuotaUpdateResponse +} from "../models"; + +/// +/** Interface representing a Quota. */ +export interface Quota { + /** + * Gets a list of current quotas (service limits) and usage for all resources. The response from the + * list quota operation can be leveraged to request quota updates. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param options The options parameters. + */ + list( + subscriptionId: string, + providerId: string, + location: string, + options?: QuotaListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get the current quota (service limit) and usage of a resource. You can use the response from the GET + * operation to submit quota update request. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for + * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param options The options parameters. + */ + get( + subscriptionId: string, + providerId: string, + location: string, + resourceName: string, + options?: QuotaGetOptionalParams + ): Promise; + /** + * Create or update the quota (service limits) of a resource to the requested value. + * Steps: + * + 1. Make the Get request to get the quota information for specific resource. + * + 2. To increase the quota, update the limit field in the response from Get request to new value. + * + 3. Submit the JSON to the quota request API to update the quota. + * The Create quota request may be constructed as follows. The PUT operation can be used to update + * the quota. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for + * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param createQuotaRequest Quota requests payload. + * @param options The options parameters. + */ + beginCreateOrUpdate( + subscriptionId: string, + providerId: string, + location: string, + resourceName: string, + createQuotaRequest: CurrentQuotaLimitBase, + options?: QuotaCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + QuotaCreateOrUpdateResponse + > + >; + /** + * Create or update the quota (service limits) of a resource to the requested value. + * Steps: + * + 1. Make the Get request to get the quota information for specific resource. + * + 2. To increase the quota, update the limit field in the response from Get request to new value. + * + 3. Submit the JSON to the quota request API to update the quota. + * The Create quota request may be constructed as follows. The PUT operation can be used to update + * the quota. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for + * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param createQuotaRequest Quota requests payload. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + subscriptionId: string, + providerId: string, + location: string, + resourceName: string, + createQuotaRequest: CurrentQuotaLimitBase, + options?: QuotaCreateOrUpdateOptionalParams + ): Promise; + /** + * Update the quota (service limits) of this resource to the requested value. + * + • To get the quota information for specific resource, send a GET request. + * + • To increase the quota, update the limit field from the GET response to a new value. + * + • To update the quota value, submit the JSON response to the quota request API to update the + * quota. + * • To update the quota. use the PATCH operation. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for + * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param createQuotaRequest Payload for the quota request. + * @param options The options parameters. + */ + beginUpdate( + subscriptionId: string, + providerId: string, + location: string, + resourceName: string, + createQuotaRequest: CurrentQuotaLimitBase, + options?: QuotaUpdateOptionalParams + ): Promise< + PollerLike, QuotaUpdateResponse> + >; + /** + * Update the quota (service limits) of this resource to the requested value. + * + • To get the quota information for specific resource, send a GET request. + * + • To increase the quota, update the limit field from the GET response to a new value. + * + • To update the quota value, submit the JSON response to the quota request API to update the + * quota. + * • To update the quota. use the PATCH operation. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param resourceName The resource name for a resource provider, such as SKU name for + * Microsoft.Compute, Sku or TotalLowPriorityCores for Microsoft.MachineLearningServices + * @param createQuotaRequest Payload for the quota request. + * @param options The options parameters. + */ + beginUpdateAndWait( + subscriptionId: string, + providerId: string, + location: string, + resourceName: string, + createQuotaRequest: CurrentQuotaLimitBase, + options?: QuotaUpdateOptionalParams + ): Promise; +} diff --git a/sdk/reservations/arm-reservations/src/operationsInterfaces/quotaRequestStatus.ts b/sdk/reservations/arm-reservations/src/operationsInterfaces/quotaRequestStatus.ts new file mode 100644 index 00000000000..26590a2a71f --- /dev/null +++ b/sdk/reservations/arm-reservations/src/operationsInterfaces/quotaRequestStatus.ts @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + QuotaRequestDetails, + QuotaRequestStatusListOptionalParams, + QuotaRequestStatusGetOptionalParams, + QuotaRequestStatusGetResponse +} from "../models"; + +/// +/** Interface representing a QuotaRequestStatus. */ +export interface QuotaRequestStatus { + /** + * For the specified Azure region (location), subscription, and resource provider, get the history of + * the quota requests for the past year. To select specific quota requests, use the oData filter. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param options The options parameters. + */ + list( + subscriptionId: string, + providerId: string, + location: string, + options?: QuotaRequestStatusListOptionalParams + ): PagedAsyncIterableIterator; + /** + * For the specified Azure region (location), get the details and status of the quota request by the + * quota request ID for the resources of the resource provider. The PUT request for the quota (service + * limit) returns a response with the requestId parameter. + * @param subscriptionId Azure subscription ID. + * @param providerId Azure resource provider ID. + * @param location Azure region. + * @param id Quota Request ID. + * @param options The options parameters. + */ + get( + subscriptionId: string, + providerId: string, + location: string, + id: string, + options?: QuotaRequestStatusGetOptionalParams + ): Promise; +} diff --git a/sdk/reservations/arm-reservations/src/operationsInterfaces/reservation.ts b/sdk/reservations/arm-reservations/src/operationsInterfaces/reservation.ts new file mode 100644 index 00000000000..a483bc74afa --- /dev/null +++ b/sdk/reservations/arm-reservations/src/operationsInterfaces/reservation.ts @@ -0,0 +1,194 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + ReservationResponse, + ReservationListOptionalParams, + ReservationListRevisionsOptionalParams, + ReservationListAllOptionalParams, + AvailableScopeRequest, + ReservationAvailableScopesOptionalParams, + ReservationAvailableScopesResponse, + SplitRequest, + ReservationSplitOptionalParams, + ReservationSplitResponse, + MergeRequest, + ReservationMergeOptionalParams, + ReservationMergeResponse, + ReservationGetOptionalParams, + ReservationGetResponse, + Patch, + ReservationUpdateOptionalParams, + ReservationUpdateResponse +} from "../models"; + +/// +/** Interface representing a Reservation. */ +export interface Reservation { + /** + * List `Reservation`s within a single `ReservationOrder`. + * @param reservationOrderId Order Id of the reservation + * @param options The options parameters. + */ + list( + reservationOrderId: string, + options?: ReservationListOptionalParams + ): PagedAsyncIterableIterator; + /** + * List of all the revisions for the `Reservation`. + * @param reservationId Id of the Reservation Item + * @param reservationOrderId Order Id of the reservation + * @param options The options parameters. + */ + listRevisions( + reservationId: string, + reservationOrderId: string, + options?: ReservationListRevisionsOptionalParams + ): PagedAsyncIterableIterator; + /** + * List the reservations and the roll up counts of reservations group by provisioning states that the + * user has access to in the current tenant. + * @param options The options parameters. + */ + listAll( + options?: ReservationListAllOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get Available Scopes for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the Reservation Item + * @param body Available scope + * @param options The options parameters. + */ + beginAvailableScopes( + reservationOrderId: string, + reservationId: string, + body: AvailableScopeRequest, + options?: ReservationAvailableScopesOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationAvailableScopesResponse + > + >; + /** + * Get Available Scopes for `Reservation`. + * + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the Reservation Item + * @param body Available scope + * @param options The options parameters. + */ + beginAvailableScopesAndWait( + reservationOrderId: string, + reservationId: string, + body: AvailableScopeRequest, + options?: ReservationAvailableScopesOptionalParams + ): Promise; + /** + * Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * @param reservationOrderId Order Id of the reservation + * @param body Information needed to Split a reservation item + * @param options The options parameters. + */ + beginSplit( + reservationOrderId: string, + body: SplitRequest, + options?: ReservationSplitOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationSplitResponse + > + >; + /** + * Split a `Reservation` into two `Reservation`s with specified quantity distribution. + * @param reservationOrderId Order Id of the reservation + * @param body Information needed to Split a reservation item + * @param options The options parameters. + */ + beginSplitAndWait( + reservationOrderId: string, + body: SplitRequest, + options?: ReservationSplitOptionalParams + ): Promise; + /** + * Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged + * must have same properties. + * @param reservationOrderId Order Id of the reservation + * @param body Information needed for commercial request for a reservation + * @param options The options parameters. + */ + beginMerge( + reservationOrderId: string, + body: MergeRequest, + options?: ReservationMergeOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationMergeResponse + > + >; + /** + * Merge the specified `Reservation`s into a new `Reservation`. The two `Reservation`s being merged + * must have same properties. + * @param reservationOrderId Order Id of the reservation + * @param body Information needed for commercial request for a reservation + * @param options The options parameters. + */ + beginMergeAndWait( + reservationOrderId: string, + body: MergeRequest, + options?: ReservationMergeOptionalParams + ): Promise; + /** + * Get specific `Reservation` details. + * @param reservationId Id of the Reservation Item + * @param reservationOrderId Order Id of the reservation + * @param options The options parameters. + */ + get( + reservationId: string, + reservationOrderId: string, + options?: ReservationGetOptionalParams + ): Promise; + /** + * Updates the applied scopes of the `Reservation`. + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the Reservation Item + * @param parameters Information needed to patch a reservation item + * @param options The options parameters. + */ + beginUpdate( + reservationOrderId: string, + reservationId: string, + parameters: Patch, + options?: ReservationUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationUpdateResponse + > + >; + /** + * Updates the applied scopes of the `Reservation`. + * @param reservationOrderId Order Id of the reservation + * @param reservationId Id of the Reservation Item + * @param parameters Information needed to patch a reservation item + * @param options The options parameters. + */ + beginUpdateAndWait( + reservationOrderId: string, + reservationId: string, + parameters: Patch, + options?: ReservationUpdateOptionalParams + ): Promise; +} diff --git a/sdk/reservations/arm-reservations/src/operationsInterfaces/reservationOrder.ts b/sdk/reservations/arm-reservations/src/operationsInterfaces/reservationOrder.ts new file mode 100644 index 00000000000..bfab0025fe0 --- /dev/null +++ b/sdk/reservations/arm-reservations/src/operationsInterfaces/reservationOrder.ts @@ -0,0 +1,93 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + ReservationOrderResponse, + ReservationOrderListOptionalParams, + PurchaseRequest, + ReservationOrderCalculateOptionalParams, + ReservationOrderCalculateResponse, + ReservationOrderPurchaseOptionalParams, + ReservationOrderPurchaseResponse, + ReservationOrderGetOptionalParams, + ReservationOrderGetResponse, + ChangeDirectoryRequest, + ReservationOrderChangeDirectoryOptionalParams, + ReservationOrderChangeDirectoryResponse +} from "../models"; + +/// +/** Interface representing a ReservationOrder. */ +export interface ReservationOrder { + /** + * List of all the `ReservationOrder`s that the user has access to in the current tenant. + * @param options The options parameters. + */ + list( + options?: ReservationOrderListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Calculate price for placing a `ReservationOrder`. + * @param body Information needed for calculate or purchase reservation + * @param options The options parameters. + */ + calculate( + body: PurchaseRequest, + options?: ReservationOrderCalculateOptionalParams + ): Promise; + /** + * Purchase `ReservationOrder` and create resource under the specified URI. + * @param reservationOrderId Order Id of the reservation + * @param body Information needed for calculate or purchase reservation + * @param options The options parameters. + */ + beginPurchase( + reservationOrderId: string, + body: PurchaseRequest, + options?: ReservationOrderPurchaseOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ReservationOrderPurchaseResponse + > + >; + /** + * Purchase `ReservationOrder` and create resource under the specified URI. + * @param reservationOrderId Order Id of the reservation + * @param body Information needed for calculate or purchase reservation + * @param options The options parameters. + */ + beginPurchaseAndWait( + reservationOrderId: string, + body: PurchaseRequest, + options?: ReservationOrderPurchaseOptionalParams + ): Promise; + /** + * Get the details of the `ReservationOrder`. + * @param reservationOrderId Order Id of the reservation + * @param options The options parameters. + */ + get( + reservationOrderId: string, + options?: ReservationOrderGetOptionalParams + ): Promise; + /** + * Change directory (tenant) of `ReservationOrder` and all `Reservation` under it to specified tenant + * id + * @param reservationOrderId Order Id of the reservation + * @param body Information needed to change directory of reservation order + * @param options The options parameters. + */ + changeDirectory( + reservationOrderId: string, + body: ChangeDirectoryRequest, + options?: ReservationOrderChangeDirectoryOptionalParams + ): Promise; +} diff --git a/sdk/reservations/arm-reservations/test/sampleTest.ts b/sdk/reservations/arm-reservations/test/sampleTest.ts new file mode 100644 index 00000000000..7ed89b043e1 --- /dev/null +++ b/sdk/reservations/arm-reservations/test/sampleTest.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + env, + record, + RecorderEnvironmentSetup, + Recorder +} from "@azure-tools/test-recorder"; +import * as assert from "assert"; + +const recorderEnvSetup: RecorderEnvironmentSetup = { + replaceableVariables: { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" + }, + customizationsOnRecordings: [ + (recording: any): any => + recording.replace( + /"access_token":"[^"]*"/g, + `"access_token":"access_token"` + ) + ], + queryParametersToSkip: [] +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function() { + recorder = record(this, recorderEnvSetup); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/reservations/arm-reservations/tsconfig.json b/sdk/reservations/arm-reservations/tsconfig.json index 422b584abd5..c743e7574f6 100644 --- a/sdk/reservations/arm-reservations/tsconfig.json +++ b/sdk/reservations/arm-reservations/tsconfig.json @@ -3,7 +3,7 @@ "module": "es6", "moduleResolution": "node", "strict": true, - "target": "es5", + "target": "es6", "sourceMap": true, "declarationMap": true, "esModuleInterop": true, @@ -11,9 +11,10 @@ "forceConsistentCasingInFileNames": true, "lib": ["es6", "dom"], "declaration": true, - "outDir": "./esm", - "importHelpers": true + "outDir": "./dist-esm", + "importHelpers": true, + "paths": { "@azure/arm-reservations": ["./src/index"] } }, - "include": ["./src/**/*.ts"], + "include": ["./src/**/*.ts", "./test/**/*.ts", "samples-dev/**/*.ts"], "exclude": ["node_modules"] } diff --git a/sdk/reservations/ci.yml b/sdk/reservations/ci.yml new file mode 100644 index 00000000000..d3b0dcb0a77 --- /dev/null +++ b/sdk/reservations/ci.yml @@ -0,0 +1,30 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/reservations/ + +pr: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/reservations/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: reservations + Artifacts: + - name: azure-arm-reservations + safeName: azurearmreservations + \ No newline at end of file diff --git a/sdk/resourcegraph/arm-resourcegraph/CHANGELOG.md b/sdk/resourcegraph/arm-resourcegraph/CHANGELOG.md new file mode 100644 index 00000000000..444f0a39efa --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 5.0.0-beta.1 (2022-01-21) + +The package of @azure/arm-resourcegraph is using our next generation design principles since version 5.0.0-beta.1, which contains breaking changes. + +To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog). + +To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/resourcegraph/arm-resourcegraph/LICENSE b/sdk/resourcegraph/arm-resourcegraph/LICENSE new file mode 100644 index 00000000000..5d1d36e0af8 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcegraph/arm-resourcegraph/README.md b/sdk/resourcegraph/arm-resourcegraph/README.md index 76978e5e821..0baf63f441a 100644 --- a/sdk/resourcegraph/arm-resourcegraph/README.md +++ b/sdk/resourcegraph/arm-resourcegraph/README.md @@ -1,98 +1,98 @@ -## Azure ResourceGraphClient SDK for JavaScript +# Azure ResourceGraph client library for JavaScript -This package contains an isomorphic SDK for ResourceGraphClient. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure ResourceGraph client. + +Azure Resource Graph API Reference + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcegraph/arm-resourcegraph) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-resourcegraph) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-resourcegraph?view=azure-node-preview) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started ### Currently supported environments - [LTS versions of Node.js](https://nodejs.org/about/releases/) -- Latest versions of Safari, Chrome, Edge, and Firefox. +- Latest versions of Safari, Chrome, Edge and Firefox. -### How to Install +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-resourcegraph` package + +Install the Azure ResourceGraph client library for JavaScript with `npm`: ```bash npm install @azure/arm-resourcegraph ``` -### How to use +### Create and authenticate a `ResourceGraphClient` -#### nodejs - client creation and list operations as an example written in TypeScript. +To create a client object to access the Azure ResourceGraph API, you will need the `endpoint` of your Azure ResourceGraph resource and a `credential`. The Azure ResourceGraph client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure ResourceGraph resource in the [Azure Portal][azure_portal]. -##### Install @azure/ms-rest-nodeauth +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: -- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`. ```bash -npm install @azure/ms-rest-nodeauth@"^3.0.0" +npm install @azure/identity ``` -##### Sample code +You will also need to **register a new AAD application and grant access to Azure ResourceGraph** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. -While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package -```typescript -const msRestNodeAuth = require("@azure/ms-rest-nodeauth"); +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). + +```javascript const { ResourceGraphClient } = require("@azure/arm-resourcegraph"); -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; - -msRestNodeAuth.interactiveLogin().then((creds) => { - const client = new ResourceGraphClient(creds, subscriptionId); - client.operations.list().then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.error(err); -}); +const { DefaultAzureCredential } = require("@azure/identity"); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new ResourceGraphClient(new DefaultAzureCredential(), subscriptionId); ``` -#### browser - Authentication, client creation and list operations as an example written in JavaScript. -##### Install @azure/ms-rest-browserauth +### 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). -```bash -npm install @azure/ms-rest-browserauth +## Key concepts + +### ResourceGraphClient + +`ResourceGraphClient` is the primary interface for developers using the Azure ResourceGraph client library. Explore the methods on this client object to understand the different features of the Azure ResourceGraph 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"); ``` -##### Sample code +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). -See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. +## Next steps -- index.html -```html - - - - @azure/arm-resourcegraph sample - - - - - - - - -``` +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. ## Related projects -- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/resourcegraph/arm-resourcegraph/README.png) +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fresourcegraph%2Farm-resourcegraph%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/resourcegraph/arm-resourcegraph/_meta.json b/sdk/resourcegraph/arm-resourcegraph/_meta.json new file mode 100644 index 00000000000..3caf7b93fbe --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/_meta.json @@ -0,0 +1,7 @@ +{ + "commit": "f9a6cb686bcc0f1b23761db19f2491c5c4df95cb", + "readme": "specification/resourcegraph/resource-manager/readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/resourcegraph/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20220114.1 --generate-sample=true", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "use": "@autorest/typescript@6.0.0-alpha.16.20220114.1" +} \ No newline at end of file diff --git a/sdk/resourcegraph/arm-resourcegraph/api-extractor.json b/sdk/resourcegraph/arm-resourcegraph/api-extractor.json new file mode 100644 index 00000000000..b1a55d788f3 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-resourcegraph.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/resourcegraph/arm-resourcegraph/package.json b/sdk/resourcegraph/arm-resourcegraph/package.json index df62daefb40..37c52623f67 100644 --- a/sdk/resourcegraph/arm-resourcegraph/package.json +++ b/sdk/resourcegraph/arm-resourcegraph/package.json @@ -1,58 +1,101 @@ { "name": "@azure/arm-resourcegraph", + "sdk-type": "mgmt", "author": "Microsoft Corporation", - "description": "ResourceGraphClient Library with typescript type definitions for node.js and browser.", - "version": "4.1.0", + "description": "A generated SDK for ResourceGraphClient.", + "version": "5.0.0-beta.1", + "engines": { "node": ">=12.0.0" }, "dependencies": { - "@azure/ms-rest-azure-js": "^2.0.1", - "@azure/ms-rest-js": "^2.0.4", - "tslib": "^1.10.0" + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.1.0", + "tslib": "^2.2.0" }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], + "keywords": ["node", "azure", "typescript", "browser", "isomorphic"], "license": "MIT", - "main": "./dist/arm-resourcegraph.js", - "module": "./esm/resourceGraphClient.js", - "types": "./esm/resourceGraphClient.d.ts", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-resourcegraph.d.ts", "devDependencies": { - "typescript": "^3.5.3", - "rollup": "^1.18.0", - "rollup-plugin-node-resolve": "^5.2.0", + "@microsoft/api-extractor": "^7.18.11", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "mkdirp": "^1.0.4", + "rollup": "^1.16.3", "rollup-plugin-sourcemaps": "^0.4.2", - "uglify-js": "^3.6.0" + "typescript": "~4.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^1.0.0", + "mocha": "^7.1.1", + "cross-env": "^7.0.2" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcegraph/arm-resourcegraph", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" }, - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, + "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, "files": [ "dist/**/*.js", "dist/**/*.js.map", "dist/**/*.d.ts", "dist/**/*.d.ts.map", - "esm/**/*.js", - "esm/**/*.js.map", - "esm/**/*.d.ts", - "esm/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", "src/**/*.ts", "README.md", + "LICENSE", "rollup.config.js", - "tsconfig.json" + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" ], "scripts": { - "build": "tsc && rollup -c rollup.config.js && npm run minify", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-resourcegraph.js.map'\" -o ./dist/arm-resourcegraph.min.js ./dist/arm-resourcegraph.js", - "prepack": "npm install && npm run build" + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" }, "sideEffects": false, - "autoPublish": true + "//metadata": { + "constantPaths": [ + { "path": "src/ResourceGraphClient.ts", "prefix": "packageDetails" } + ] + }, + "autoPublish": true, + "//sampleConfiguration": { + "productName": "", + "productSlugs": ["azure"], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-resourcegraph?view=azure-node-preview" + } } diff --git a/sdk/resourcegraph/arm-resourcegraph/recordings/node/my_test/recording_sample_test.js b/sdk/resourcegraph/arm-resourcegraph/recordings/node/my_test/recording_sample_test.js new file mode 100644 index 00000000000..0f6ecb857ac --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/recordings/node/my_test/recording_sample_test.js @@ -0,0 +1,5 @@ +let nock = require('nock'); + +module.exports.hash = "7a6be38bb8cb644d64b4094802301751"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} diff --git a/sdk/resourcegraph/arm-resourcegraph/review/arm-resourcegraph.api.md b/sdk/resourcegraph/arm-resourcegraph/review/arm-resourcegraph.api.md new file mode 100644 index 00000000000..4c7e197e4cd --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/review/arm-resourcegraph.api.md @@ -0,0 +1,214 @@ +## API Report File for "@azure/arm-resourcegraph" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; + +// @public +export type AuthorizationScopeFilter = "AtScopeAndBelow" | "AtScopeAndAbove" | "AtScopeExact" | "AtScopeAboveAndBelow"; + +// @public +export interface Column { + name: string; + type: ColumnDataType; +} + +// @public +export type ColumnDataType = "string" | "integer" | "number" | "boolean" | "object" | "datetime"; + +// @public +export interface DateTimeInterval { + end: Date; + start: Date; +} + +// @public +export interface ErrorDetails { + [property: string]: any; + code: string; + message: string; +} + +// @public +export interface ErrorModel { + code: string; + details?: ErrorDetails[]; + message: string; +} + +// @public +export interface ErrorResponse { + error: ErrorModel; +} + +// @public +export interface Facet { + expression: string; + resultType: "FacetResult" | "FacetError"; +} + +// @public +export type FacetError = Facet & { + resultType: "FacetError"; + errors: ErrorDetails[]; +}; + +// @public +export interface FacetRequest { + expression: string; + options?: FacetRequestOptions; +} + +// @public +export interface FacetRequestOptions { + filter?: string; + sortBy?: string; + sortOrder?: FacetSortOrder; + top?: number; +} + +// @public +export type FacetResult = Facet & { + resultType: "FacetResult"; + totalRecords: number; + count: number; + data: Record; +}; + +// @public +export type FacetSortOrder = "asc" | "desc"; + +// @public (undocumented) +export type FacetUnion = Facet | FacetResult | FacetError; + +// @public +export interface Operation { + display?: OperationDisplay; + name?: string; + origin?: string; +} + +// @public +export interface OperationDisplay { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public +export interface OperationListResult { + value?: Operation[]; +} + +// @public +export interface Operations { + list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = OperationListResult; + +// @public +export interface QueryRequest { + facets?: FacetRequest[]; + managementGroups?: string[]; + options?: QueryRequestOptions; + query: string; + subscriptions?: string[]; +} + +// @public +export interface QueryRequestOptions { + allowPartialScopes?: boolean; + authorizationScopeFilter?: AuthorizationScopeFilter; + resultFormat?: ResultFormat; + skip?: number; + skipToken?: string; + top?: number; +} + +// @public +export interface QueryResponse { + count: number; + data: Record; + facets?: FacetUnion[]; + resultTruncated: ResultTruncated; + skipToken?: string; + totalRecords: number; +} + +// @public (undocumented) +export class ResourceGraphClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, options?: ResourceGraphClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + operations: Operations; + resources(query: QueryRequest, options?: ResourcesOptionalParams): Promise; + resourcesHistory(request: ResourcesHistoryRequest, options?: ResourcesHistoryOptionalParams): Promise; +} + +// @public +export interface ResourceGraphClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface ResourcesHistoryOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface ResourcesHistoryRequest { + managementGroups?: string[]; + options?: ResourcesHistoryRequestOptions; + query?: string; + subscriptions?: string[]; +} + +// @public +export interface ResourcesHistoryRequestOptions { + interval?: DateTimeInterval; + resultFormat?: ResultFormat; + skip?: number; + skipToken?: string; + top?: number; +} + +// @public +export type ResourcesHistoryResponse = Record; + +// @public +export interface ResourcesOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ResourcesResponse = QueryResponse; + +// @public +export type ResultFormat = "table" | "objectArray"; + +// @public +export type ResultTruncated = "true" | "false"; + +// @public +export interface Table { + columns: Column[]; + rows: Record[][]; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/resourcegraph/arm-resourcegraph/rollup.config.js b/sdk/resourcegraph/arm-resourcegraph/rollup.config.js index b4a13e4ff3f..9be1955eb7f 100644 --- a/sdk/resourcegraph/arm-resourcegraph/rollup.config.js +++ b/sdk/resourcegraph/arm-resourcegraph/rollup.config.js @@ -1,37 +1,188 @@ -import rollup from "rollup"; -import nodeResolve from "rollup-plugin-node-resolve"; -import sourcemaps from "rollup-plugin-sourcemaps"; - -/** - * @type {rollup.RollupFileOptions} - */ -const config = { - input: "./esm/resourceGraphClient.js", - external: [ - "@azure/ms-rest-js", - "@azure/ms-rest-azure-js" - ], - output: { - file: "./dist/arm-resourcegraph.js", - format: "umd", - name: "Azure.ArmResourcegraph", - sourcemap: true, - globals: { - "@azure/ms-rest-js": "msRest", - "@azure/ms-rest-azure-js": "msRestAzure" - }, - banner: `/* +/* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */` - }, - plugins: [ - nodeResolve({ mainFields: ['module', 'main'] }), - sourcemaps() - ] + */ + +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"; + +/** + * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. + * + * NOTE: this manual configuration is only needed because OpenTelemetry uses an + * __exportStar downleveled helper function to declare its exports which confuses + * rollup's automatic discovery mechanism. + * + * @returns an object reference that can be `...`'d into your cjs() configuration. + */ +export function openTelemetryCommonJs() { + const namedExports = {}; + + for (const key of [ + "@opentelemetry/api", + "@azure/core-tracing/node_modules/@opentelemetry/api" + ]) { + namedExports[key] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "SpanStatusCode", + "getSpanContext", + "setSpanContext" + ]; + } + + const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; + + for (const version of releasedOpenTelemetryVersions) { + namedExports[ + // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. + `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` + ] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "StatusCode", + "CanonicalCode", + "getSpanContext", + "setSpanContext" + ]; + } + + return namedExports; +} + +// #region Warning Handler + +/** + * A function that can determine whether a rollupwarning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEvalWarnings(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependencyWarnings(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ + ignoreChaiCircularDependencyWarnings, + ignoreNiseSinonEvalWarnings +]; + +/** + * 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({ + namedExports: { + // Chai's strange internal architecture makes it impossible to statically + // analyze its exports. + chai: [ + "version", + "use", + "util", + "config", + "expect", + "should", + "assert" + ], + ...openTelemetryCommonJs() + } + }), + 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 default config; +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(), cjs()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/resourcegraph/arm-resourcegraph/sample.env b/sdk/resourcegraph/arm-resourcegraph/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/resourcegraph/arm-resourcegraph/samples-dev/accessAPropertiesField.ts b/sdk/resourcegraph/arm-resourcegraph/samples-dev/accessAPropertiesField.ts new file mode 100644 index 00000000000..b9e59ac18fd --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples-dev/accessAPropertiesField.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesPropertiesQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function accessAPropertiesField() { + const query: QueryRequest = { + query: + "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by tostring(properties.storageProfile.osDisk.osType)", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"] + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +accessAPropertiesField().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples-dev/basicManagementGroupQuery.ts b/sdk/resourcegraph/arm-resourcegraph/samples-dev/basicManagementGroupQuery.ts new file mode 100644 index 00000000000..bdd48db8ddc --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples-dev/basicManagementGroupQuery.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesMgBasicQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function basicManagementGroupQuery() { + const query: QueryRequest = { + managementGroups: ["e927f598-c1d4-4f72-8541-95d83a6a4ac8", "ProductionMG"], + query: "Resources | project id, name, type, location, tags | limit 3" + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +basicManagementGroupQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples-dev/basicQuery.ts b/sdk/resourcegraph/arm-resourcegraph/samples-dev/basicQuery.ts new file mode 100644 index 00000000000..4941da1897a --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples-dev/basicQuery.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesBasicQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function basicQuery() { + const query: QueryRequest = { + query: "Resources | project id, name, type, location, tags | limit 3", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"] + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +basicQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples-dev/basicTenantQuery.ts b/sdk/resourcegraph/arm-resourcegraph/samples-dev/basicTenantQuery.ts new file mode 100644 index 00000000000..6689876b829 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples-dev/basicTenantQuery.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesTenantBasicQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function basicTenantQuery() { + const query: QueryRequest = { + query: "Resources | project id, name, type, location, tags | limit 3" + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +basicTenantQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples-dev/complexQuery.ts b/sdk/resourcegraph/arm-resourcegraph/samples-dev/complexQuery.ts new file mode 100644 index 00000000000..b24eafd7eda --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples-dev/complexQuery.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesComplexQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function complexQuery() { + const query: QueryRequest = { + query: + "Resources | project id, name, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by location | top 3 by count_", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"] + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +complexQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples-dev/filterResources.ts b/sdk/resourcegraph/arm-resourcegraph/samples-dev/filterResources.ts new file mode 100644 index 00000000000..4c5addeafc5 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples-dev/filterResources.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFilterQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function filterResources() { + const query: QueryRequest = { + query: + "Resources | project id, name, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | limit 3", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"] + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +filterResources().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples-dev/firstPageQuery.ts b/sdk/resourcegraph/arm-resourcegraph/samples-dev/firstPageQuery.ts new file mode 100644 index 00000000000..480c9a7a1eb --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples-dev/firstPageQuery.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFirstPageQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function firstPageQuery() { + const query: QueryRequest = { + options: { skip: 0, top: 3 }, + query: + "Resources | where name contains 'test' | project id, name, type, location", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"] + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +firstPageQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples-dev/nextPageQuery.ts b/sdk/resourcegraph/arm-resourcegraph/samples-dev/nextPageQuery.ts new file mode 100644 index 00000000000..7c8e2d6f3d7 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples-dev/nextPageQuery.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesNextPageQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function nextPageQuery() { + const query: QueryRequest = { + options: { + skipToken: "eyAibm8iOiAibHVjayIsICJidXQiOiAibmljZSIsICJ0cnkiOiAiISIgfQ==" + }, + query: + "Resources | where name contains 'test' | project id, name, type, location", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"] + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +nextPageQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples-dev/operationsList.ts b/sdk/resourcegraph/arm-resourcegraph/samples-dev/operationsList.ts new file mode 100644 index 00000000000..c17c27335a2 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples-dev/operationsList.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Lists all of the available REST API operations. + * + * @summary Lists all of the available REST API operations. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/OperationsList.json + */ +import { ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function operationsList() { + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +operationsList().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples-dev/queryWithAFacetRequest.ts b/sdk/resourcegraph/arm-resourcegraph/samples-dev/queryWithAFacetRequest.ts new file mode 100644 index 00000000000..3daf7340c79 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples-dev/queryWithAFacetRequest.ts @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFacetQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function queryWithAFacetRequest() { + const query: QueryRequest = { + facets: [ + { expression: "location", options: { top: 3, sortOrder: "desc" } }, + { + expression: "properties.storageProfile.osDisk.osType", + options: { top: 3, sortOrder: "desc" } + }, + { + expression: "nonExistingColumn", + options: { top: 3, sortOrder: "desc" } + }, + { + expression: "resourceGroup", + options: { top: 3, sortBy: "tolower(resourceGroup)", sortOrder: "asc" } + }, + { + expression: "resourceGroup", + options: { top: 3, filter: "resourceGroup contains 'test'" } + } + ], + query: + "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | project id, name, location, resourceGroup, properties.storageProfile.osDisk.osType | limit 5", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"] + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +queryWithAFacetRequest().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples-dev/randomPageQuery.ts b/sdk/resourcegraph/arm-resourcegraph/samples-dev/randomPageQuery.ts new file mode 100644 index 00000000000..137a7f1e7ee --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples-dev/randomPageQuery.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesRandomPageQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function randomPageQuery() { + const query: QueryRequest = { + options: { skip: 10, top: 2 }, + query: + "Resources | where name contains 'test' | project id, name, type, location", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"] + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +randomPageQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples-dev/resourceHistoryManagementGroupScopeQuery.ts b/sdk/resourcegraph/arm-resourcegraph/samples-dev/resourceHistoryManagementGroupScopeQuery.ts new file mode 100644 index 00000000000..8f3d72804af --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples-dev/resourceHistoryManagementGroupScopeQuery.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List all snapshots of a resource for a given time interval. + * + * @summary List all snapshots of a resource for a given time interval. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryMgsGet.json + */ +import { + ResourcesHistoryRequest, + ResourceGraphClient +} from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function resourceHistoryManagementGroupScopeQuery() { + const request: ResourcesHistoryRequest = { + managementGroups: ["e927f598-c1d4-4f72-8541-95d83a6a4ac8", "ProductionMG"], + options: { + interval: { + end: new Date("2020-11-12T01:25:00.0000000Z"), + start: new Date("2020-11-12T01:00:00.0000000Z") + } + }, + query: "where name =~ 'cpu-utilization' | project id, name, properties" + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resourcesHistory(request); + console.log(result); +} + +resourceHistoryManagementGroupScopeQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples-dev/resourceHistoryQuery.ts b/sdk/resourcegraph/arm-resourcegraph/samples-dev/resourceHistoryQuery.ts new file mode 100644 index 00000000000..117c4e2280f --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples-dev/resourceHistoryQuery.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List all snapshots of a resource for a given time interval. + * + * @summary List all snapshots of a resource for a given time interval. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryGet.json + */ +import { + ResourcesHistoryRequest, + ResourceGraphClient +} from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function resourceHistoryQuery() { + const request: ResourcesHistoryRequest = { + options: { + interval: { + end: new Date("2020-11-12T01:25:00.0000000Z"), + start: new Date("2020-11-12T01:00:00.0000000Z") + } + }, + query: "where name =~ 'cpu-utilization' | project id, name, properties", + subscriptions: ["a7f33fdb-e646-4f15-89aa-3a360210861e"] + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resourcesHistory(request); + console.log(result); +} + +resourceHistoryQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples-dev/summarizeResourcesByLocation.ts b/sdk/resourcegraph/arm-resourcegraph/samples-dev/summarizeResourcesByLocation.ts new file mode 100644 index 00000000000..0e882904643 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples-dev/summarizeResourcesByLocation.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesSummarizeQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function summarizeResourcesByLocation() { + const query: QueryRequest = { + query: + "Resources | project id, name, type, location | summarize by location", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"] + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +summarizeResourcesByLocation().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/README.md b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/README.md new file mode 100644 index 00000000000..ff804230a74 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/README.md @@ -0,0 +1,76 @@ +# client library samples for JavaScript (Beta) + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [accessAPropertiesField.js][accessapropertiesfield] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesPropertiesQuery.json | +| [basicManagementGroupQuery.js][basicmanagementgroupquery] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesMgBasicQuery.json | +| [basicQuery.js][basicquery] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesBasicQuery.json | +| [basicTenantQuery.js][basictenantquery] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesTenantBasicQuery.json | +| [complexQuery.js][complexquery] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesComplexQuery.json | +| [filterResources.js][filterresources] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFilterQuery.json | +| [firstPageQuery.js][firstpagequery] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFirstPageQuery.json | +| [nextPageQuery.js][nextpagequery] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesNextPageQuery.json | +| [operationsList.js][operationslist] | Lists all of the available REST API operations. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/OperationsList.json | +| [queryWithAFacetRequest.js][querywithafacetrequest] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFacetQuery.json | +| [randomPageQuery.js][randompagequery] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesRandomPageQuery.json | +| [resourceHistoryManagementGroupScopeQuery.js][resourcehistorymanagementgroupscopequery] | List all snapshots of a resource for a given time interval. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryMgsGet.json | +| [resourceHistoryQuery.js][resourcehistoryquery] | List all snapshots of a resource for a given time interval. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryGet.json | +| [summarizeResourcesByLocation.js][summarizeresourcesbylocation] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesSummarizeQuery.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node accessAPropertiesField.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node accessAPropertiesField.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[accessapropertiesfield]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/accessAPropertiesField.js +[basicmanagementgroupquery]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/basicManagementGroupQuery.js +[basicquery]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/basicQuery.js +[basictenantquery]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/basicTenantQuery.js +[complexquery]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/complexQuery.js +[filterresources]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/filterResources.js +[firstpagequery]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/firstPageQuery.js +[nextpagequery]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/nextPageQuery.js +[operationslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/operationsList.js +[querywithafacetrequest]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/queryWithAFacetRequest.js +[randompagequery]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/randomPageQuery.js +[resourcehistorymanagementgroupscopequery]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/resourceHistoryManagementGroupScopeQuery.js +[resourcehistoryquery]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/resourceHistoryQuery.js +[summarizeresourcesbylocation]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/summarizeResourcesByLocation.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-resourcegraph?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcegraph/arm-resourcegraph/README.md diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/accessAPropertiesField.js b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/accessAPropertiesField.js new file mode 100644 index 00000000000..c151195ff62 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/accessAPropertiesField.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesPropertiesQuery.json + */ +const { ResourceGraphClient } = require("@azure/arm-resourcegraph"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function accessAPropertiesField() { + const query = { + query: + "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by tostring(properties.storageProfile.osDisk.osType)", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"], + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +accessAPropertiesField().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/basicManagementGroupQuery.js b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/basicManagementGroupQuery.js new file mode 100644 index 00000000000..35c81b45f0c --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/basicManagementGroupQuery.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesMgBasicQuery.json + */ +const { ResourceGraphClient } = require("@azure/arm-resourcegraph"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function basicManagementGroupQuery() { + const query = { + managementGroups: ["e927f598-c1d4-4f72-8541-95d83a6a4ac8", "ProductionMG"], + query: "Resources | project id, name, type, location, tags | limit 3", + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +basicManagementGroupQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/basicQuery.js b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/basicQuery.js new file mode 100644 index 00000000000..18a27c5d6cf --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/basicQuery.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesBasicQuery.json + */ +const { ResourceGraphClient } = require("@azure/arm-resourcegraph"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function basicQuery() { + const query = { + query: "Resources | project id, name, type, location, tags | limit 3", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"], + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +basicQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/basicTenantQuery.js b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/basicTenantQuery.js new file mode 100644 index 00000000000..dcc87244a2d --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/basicTenantQuery.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesTenantBasicQuery.json + */ +const { ResourceGraphClient } = require("@azure/arm-resourcegraph"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function basicTenantQuery() { + const query = { + query: "Resources | project id, name, type, location, tags | limit 3", + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +basicTenantQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/complexQuery.js b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/complexQuery.js new file mode 100644 index 00000000000..efbc8fd0226 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/complexQuery.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesComplexQuery.json + */ +const { ResourceGraphClient } = require("@azure/arm-resourcegraph"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function complexQuery() { + const query = { + query: + "Resources | project id, name, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by location | top 3 by count_", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"], + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +complexQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/filterResources.js b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/filterResources.js new file mode 100644 index 00000000000..36eb6078275 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/filterResources.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFilterQuery.json + */ +const { ResourceGraphClient } = require("@azure/arm-resourcegraph"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function filterResources() { + const query = { + query: + "Resources | project id, name, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | limit 3", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"], + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +filterResources().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/firstPageQuery.js b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/firstPageQuery.js new file mode 100644 index 00000000000..04c15aa4218 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/firstPageQuery.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFirstPageQuery.json + */ +const { ResourceGraphClient } = require("@azure/arm-resourcegraph"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function firstPageQuery() { + const query = { + options: { skip: 0, top: 3 }, + query: "Resources | where name contains 'test' | project id, name, type, location", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"], + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +firstPageQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/nextPageQuery.js b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/nextPageQuery.js new file mode 100644 index 00000000000..c43648411d8 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/nextPageQuery.js @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesNextPageQuery.json + */ +const { ResourceGraphClient } = require("@azure/arm-resourcegraph"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function nextPageQuery() { + const query = { + options: { + skipToken: "eyAibm8iOiAibHVjayIsICJidXQiOiAibmljZSIsICJ0cnkiOiAiISIgfQ==", + }, + query: "Resources | where name contains 'test' | project id, name, type, location", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"], + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +nextPageQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/operationsList.js b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/operationsList.js new file mode 100644 index 00000000000..0b1d4757d62 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/operationsList.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Lists all of the available REST API operations. + * + * @summary Lists all of the available REST API operations. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/OperationsList.json + */ +const { ResourceGraphClient } = require("@azure/arm-resourcegraph"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function operationsList() { + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +operationsList().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/package.json b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/package.json new file mode 100644 index 00000000000..83c04f386b5 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "azure-arm-resourcegraph-samples-js-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript (Beta)", + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/resourcegraph/arm-resourcegraph" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcegraph/arm-resourcegraph", + "dependencies": { + "@azure/arm-resourcegraph": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/queryWithAFacetRequest.js b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/queryWithAFacetRequest.js new file mode 100644 index 00000000000..9014cf809a6 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/queryWithAFacetRequest.js @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFacetQuery.json + */ +const { ResourceGraphClient } = require("@azure/arm-resourcegraph"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function queryWithAFacetRequest() { + const query = { + facets: [ + { expression: "location", options: { top: 3, sortOrder: "desc" } }, + { + expression: "properties.storageProfile.osDisk.osType", + options: { top: 3, sortOrder: "desc" }, + }, + { + expression: "nonExistingColumn", + options: { top: 3, sortOrder: "desc" }, + }, + { + expression: "resourceGroup", + options: { top: 3, sortBy: "tolower(resourceGroup)", sortOrder: "asc" }, + }, + { + expression: "resourceGroup", + options: { top: 3, filter: "resourceGroup contains 'test'" }, + }, + ], + query: + "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | project id, name, location, resourceGroup, properties.storageProfile.osDisk.osType | limit 5", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"], + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +queryWithAFacetRequest().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/randomPageQuery.js b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/randomPageQuery.js new file mode 100644 index 00000000000..1d45eebe631 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/randomPageQuery.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesRandomPageQuery.json + */ +const { ResourceGraphClient } = require("@azure/arm-resourcegraph"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function randomPageQuery() { + const query = { + options: { skip: 10, top: 2 }, + query: "Resources | where name contains 'test' | project id, name, type, location", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"], + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +randomPageQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/resourceHistoryManagementGroupScopeQuery.js b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/resourceHistoryManagementGroupScopeQuery.js new file mode 100644 index 00000000000..2b199b7686a --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/resourceHistoryManagementGroupScopeQuery.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List all snapshots of a resource for a given time interval. + * + * @summary List all snapshots of a resource for a given time interval. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryMgsGet.json + */ +const { ResourceGraphClient } = require("@azure/arm-resourcegraph"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function resourceHistoryManagementGroupScopeQuery() { + const request = { + managementGroups: ["e927f598-c1d4-4f72-8541-95d83a6a4ac8", "ProductionMG"], + options: { + interval: { + end: new Date("2020-11-12T01:25:00.0000000Z"), + start: new Date("2020-11-12T01:00:00.0000000Z"), + }, + }, + query: "where name =~ 'cpu-utilization' | project id, name, properties", + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resourcesHistory(request); + console.log(result); +} + +resourceHistoryManagementGroupScopeQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/resourceHistoryQuery.js b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/resourceHistoryQuery.js new file mode 100644 index 00000000000..b780553a2d4 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/resourceHistoryQuery.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List all snapshots of a resource for a given time interval. + * + * @summary List all snapshots of a resource for a given time interval. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryGet.json + */ +const { ResourceGraphClient } = require("@azure/arm-resourcegraph"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function resourceHistoryQuery() { + const request = { + options: { + interval: { + end: new Date("2020-11-12T01:25:00.0000000Z"), + start: new Date("2020-11-12T01:00:00.0000000Z"), + }, + }, + query: "where name =~ 'cpu-utilization' | project id, name, properties", + subscriptions: ["a7f33fdb-e646-4f15-89aa-3a360210861e"], + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resourcesHistory(request); + console.log(result); +} + +resourceHistoryQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/sample.env b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/summarizeResourcesByLocation.js b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/summarizeResourcesByLocation.js new file mode 100644 index 00000000000..d12de34f8df --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/javascript/summarizeResourcesByLocation.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesSummarizeQuery.json + */ +const { ResourceGraphClient } = require("@azure/arm-resourcegraph"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function summarizeResourcesByLocation() { + const query = { + query: "Resources | project id, name, type, location | summarize by location", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"], + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +summarizeResourcesByLocation().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/README.md b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/README.md new file mode 100644 index 00000000000..12db1f13568 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/README.md @@ -0,0 +1,89 @@ +# client library samples for TypeScript (Beta) + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [accessAPropertiesField.ts][accessapropertiesfield] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesPropertiesQuery.json | +| [basicManagementGroupQuery.ts][basicmanagementgroupquery] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesMgBasicQuery.json | +| [basicQuery.ts][basicquery] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesBasicQuery.json | +| [basicTenantQuery.ts][basictenantquery] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesTenantBasicQuery.json | +| [complexQuery.ts][complexquery] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesComplexQuery.json | +| [filterResources.ts][filterresources] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFilterQuery.json | +| [firstPageQuery.ts][firstpagequery] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFirstPageQuery.json | +| [nextPageQuery.ts][nextpagequery] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesNextPageQuery.json | +| [operationsList.ts][operationslist] | Lists all of the available REST API operations. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/OperationsList.json | +| [queryWithAFacetRequest.ts][querywithafacetrequest] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFacetQuery.json | +| [randomPageQuery.ts][randompagequery] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesRandomPageQuery.json | +| [resourceHistoryManagementGroupScopeQuery.ts][resourcehistorymanagementgroupscopequery] | List all snapshots of a resource for a given time interval. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryMgsGet.json | +| [resourceHistoryQuery.ts][resourcehistoryquery] | List all snapshots of a resource for a given time interval. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryGet.json | +| [summarizeResourcesByLocation.ts][summarizeresourcesbylocation] | Queries the resources managed by Azure Resource Manager for scopes specified in the request. x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesSummarizeQuery.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/accessAPropertiesField.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node dist/accessAPropertiesField.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[accessapropertiesfield]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/accessAPropertiesField.ts +[basicmanagementgroupquery]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/basicManagementGroupQuery.ts +[basicquery]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/basicQuery.ts +[basictenantquery]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/basicTenantQuery.ts +[complexquery]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/complexQuery.ts +[filterresources]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/filterResources.ts +[firstpagequery]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/firstPageQuery.ts +[nextpagequery]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/nextPageQuery.ts +[operationslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/operationsList.ts +[querywithafacetrequest]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/queryWithAFacetRequest.ts +[randompagequery]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/randomPageQuery.ts +[resourcehistorymanagementgroupscopequery]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/resourceHistoryManagementGroupScopeQuery.ts +[resourcehistoryquery]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/resourceHistoryQuery.ts +[summarizeresourcesbylocation]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/summarizeResourcesByLocation.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-resourcegraph?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcegraph/arm-resourcegraph/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/package.json b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/package.json new file mode 100644 index 00000000000..67b372fe7db --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "azure-arm-resourcegraph-samples-ts-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript (Beta)", + "engines": { + "node": ">=12.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/resourcegraph/arm-resourcegraph" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcegraph/arm-resourcegraph", + "dependencies": { + "@azure/arm-resourcegraph": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^12.0.0", + "typescript": "~4.4.0", + "rimraf": "latest" + } +} diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/sample.env b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/accessAPropertiesField.ts b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/accessAPropertiesField.ts new file mode 100644 index 00000000000..b9e59ac18fd --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/accessAPropertiesField.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesPropertiesQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function accessAPropertiesField() { + const query: QueryRequest = { + query: + "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by tostring(properties.storageProfile.osDisk.osType)", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"] + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +accessAPropertiesField().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/basicManagementGroupQuery.ts b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/basicManagementGroupQuery.ts new file mode 100644 index 00000000000..bdd48db8ddc --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/basicManagementGroupQuery.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesMgBasicQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function basicManagementGroupQuery() { + const query: QueryRequest = { + managementGroups: ["e927f598-c1d4-4f72-8541-95d83a6a4ac8", "ProductionMG"], + query: "Resources | project id, name, type, location, tags | limit 3" + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +basicManagementGroupQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/basicQuery.ts b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/basicQuery.ts new file mode 100644 index 00000000000..4941da1897a --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/basicQuery.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesBasicQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function basicQuery() { + const query: QueryRequest = { + query: "Resources | project id, name, type, location, tags | limit 3", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"] + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +basicQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/basicTenantQuery.ts b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/basicTenantQuery.ts new file mode 100644 index 00000000000..6689876b829 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/basicTenantQuery.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesTenantBasicQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function basicTenantQuery() { + const query: QueryRequest = { + query: "Resources | project id, name, type, location, tags | limit 3" + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +basicTenantQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/complexQuery.ts b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/complexQuery.ts new file mode 100644 index 00000000000..b24eafd7eda --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/complexQuery.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesComplexQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function complexQuery() { + const query: QueryRequest = { + query: + "Resources | project id, name, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | summarize count() by location | top 3 by count_", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"] + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +complexQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/filterResources.ts b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/filterResources.ts new file mode 100644 index 00000000000..4c5addeafc5 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/filterResources.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFilterQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function filterResources() { + const query: QueryRequest = { + query: + "Resources | project id, name, type, location | where type =~ 'Microsoft.Compute/virtualMachines' | limit 3", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"] + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +filterResources().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/firstPageQuery.ts b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/firstPageQuery.ts new file mode 100644 index 00000000000..480c9a7a1eb --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/firstPageQuery.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFirstPageQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function firstPageQuery() { + const query: QueryRequest = { + options: { skip: 0, top: 3 }, + query: + "Resources | where name contains 'test' | project id, name, type, location", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"] + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +firstPageQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/nextPageQuery.ts b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/nextPageQuery.ts new file mode 100644 index 00000000000..7c8e2d6f3d7 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/nextPageQuery.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesNextPageQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function nextPageQuery() { + const query: QueryRequest = { + options: { + skipToken: "eyAibm8iOiAibHVjayIsICJidXQiOiAibmljZSIsICJ0cnkiOiAiISIgfQ==" + }, + query: + "Resources | where name contains 'test' | project id, name, type, location", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"] + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +nextPageQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/operationsList.ts b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/operationsList.ts new file mode 100644 index 00000000000..c17c27335a2 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/operationsList.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Lists all of the available REST API operations. + * + * @summary Lists all of the available REST API operations. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/OperationsList.json + */ +import { ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function operationsList() { + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +operationsList().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/queryWithAFacetRequest.ts b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/queryWithAFacetRequest.ts new file mode 100644 index 00000000000..3daf7340c79 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/queryWithAFacetRequest.ts @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesFacetQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function queryWithAFacetRequest() { + const query: QueryRequest = { + facets: [ + { expression: "location", options: { top: 3, sortOrder: "desc" } }, + { + expression: "properties.storageProfile.osDisk.osType", + options: { top: 3, sortOrder: "desc" } + }, + { + expression: "nonExistingColumn", + options: { top: 3, sortOrder: "desc" } + }, + { + expression: "resourceGroup", + options: { top: 3, sortBy: "tolower(resourceGroup)", sortOrder: "asc" } + }, + { + expression: "resourceGroup", + options: { top: 3, filter: "resourceGroup contains 'test'" } + } + ], + query: + "Resources | where type =~ 'Microsoft.Compute/virtualMachines' | project id, name, location, resourceGroup, properties.storageProfile.osDisk.osType | limit 5", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"] + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +queryWithAFacetRequest().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/randomPageQuery.ts b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/randomPageQuery.ts new file mode 100644 index 00000000000..137a7f1e7ee --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/randomPageQuery.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesRandomPageQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function randomPageQuery() { + const query: QueryRequest = { + options: { skip: 10, top: 2 }, + query: + "Resources | where name contains 'test' | project id, name, type, location", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"] + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +randomPageQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/resourceHistoryManagementGroupScopeQuery.ts b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/resourceHistoryManagementGroupScopeQuery.ts new file mode 100644 index 00000000000..8f3d72804af --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/resourceHistoryManagementGroupScopeQuery.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List all snapshots of a resource for a given time interval. + * + * @summary List all snapshots of a resource for a given time interval. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryMgsGet.json + */ +import { + ResourcesHistoryRequest, + ResourceGraphClient +} from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function resourceHistoryManagementGroupScopeQuery() { + const request: ResourcesHistoryRequest = { + managementGroups: ["e927f598-c1d4-4f72-8541-95d83a6a4ac8", "ProductionMG"], + options: { + interval: { + end: new Date("2020-11-12T01:25:00.0000000Z"), + start: new Date("2020-11-12T01:00:00.0000000Z") + } + }, + query: "where name =~ 'cpu-utilization' | project id, name, properties" + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resourcesHistory(request); + console.log(result); +} + +resourceHistoryManagementGroupScopeQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/resourceHistoryQuery.ts b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/resourceHistoryQuery.ts new file mode 100644 index 00000000000..117c4e2280f --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/resourceHistoryQuery.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List all snapshots of a resource for a given time interval. + * + * @summary List all snapshots of a resource for a given time interval. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesHistoryGet.json + */ +import { + ResourcesHistoryRequest, + ResourceGraphClient +} from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function resourceHistoryQuery() { + const request: ResourcesHistoryRequest = { + options: { + interval: { + end: new Date("2020-11-12T01:25:00.0000000Z"), + start: new Date("2020-11-12T01:00:00.0000000Z") + } + }, + query: "where name =~ 'cpu-utilization' | project id, name, properties", + subscriptions: ["a7f33fdb-e646-4f15-89aa-3a360210861e"] + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resourcesHistory(request); + console.log(result); +} + +resourceHistoryQuery().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/summarizeResourcesByLocation.ts b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/summarizeResourcesByLocation.ts new file mode 100644 index 00000000000..0e882904643 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/src/summarizeResourcesByLocation.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * + * @summary Queries the resources managed by Azure Resource Manager for scopes specified in the request. + * x-ms-original-file: specification/resourcegraph/resource-manager/Microsoft.ResourceGraph/preview/2021-06-01-preview/examples/ResourcesSummarizeQuery.json + */ +import { QueryRequest, ResourceGraphClient } from "@azure/arm-resourcegraph"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function summarizeResourcesByLocation() { + const query: QueryRequest = { + query: + "Resources | project id, name, type, location | summarize by location", + subscriptions: ["cfbbd179-59d2-4052-aa06-9270a38aa9d6"] + }; + const credential = new DefaultAzureCredential(); + const client = new ResourceGraphClient(credential); + const result = await client.resources(query); + console.log(result); +} + +summarizeResourcesByLocation().catch(console.error); diff --git a/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/tsconfig.json b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/tsconfig.json new file mode 100644 index 00000000000..416c2dd82e0 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/samples/v5-beta/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2018", + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "alwaysStrict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src/**.ts" + ] +} diff --git a/sdk/reservations/arm-reservations/src/models/operationMappers.ts b/sdk/resourcegraph/arm-resourcegraph/src/index.ts similarity index 57% rename from sdk/reservations/arm-reservations/src/models/operationMappers.ts rename to sdk/resourcegraph/arm-resourcegraph/src/index.ts index e8357d65a5d..45f329cbd46 100644 --- a/sdk/reservations/arm-reservations/src/models/operationMappers.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/index.ts @@ -6,10 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -export { - ErrorModel, - ExtendedErrorInfo, - OperationDisplay, - OperationList, - OperationResponse -} from "../models/mappers"; +/// +export * from "./models"; +export { ResourceGraphClient } from "./resourceGraphClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/resourcegraph/arm-resourcegraph/src/models/index.ts b/sdk/resourcegraph/arm-resourcegraph/src/models/index.ts index 8d1bec98886..a1a27f63a86 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/models/index.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/models/index.ts @@ -6,707 +6,255 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export { BaseResource, CloudError }; +export type FacetUnion = Facet | FacetResult | FacetError; -/** - * An interval in time specifying the date and time for the inclusive start and exclusive end, i.e. - * `[start, end)`. - */ -export interface DateTimeInterval { - /** - * A datetime indicating the inclusive/closed start of the time interval, i.e. `[`**`start`**`, - * end)`. Specifying a `start` that occurs chronologically after `end` will result in an error. - */ - start: Date; - /** - * A datetime indicating the exclusive/open end of the time interval, i.e. `[start, - * `**`end`**`)`. Specifying an `end` that occurs chronologically before `start` will result in - * an error. - */ - end: Date; -} - -/** - * Specifies the date and time interval for a changes request. - */ -export interface ResourceChangesRequestParametersInterval extends DateTimeInterval {} - -/** - * The parameters for a specific changes request. - */ -export interface ResourceChangesRequestParameters { - /** - * Specifies the list of resources for a changes request. - */ - resourceIds?: string[]; - /** - * The subscription id of resources to query the changes from. - */ - subscriptionId?: string; - /** - * Specifies the date and time interval for a changes request. - */ - interval: ResourceChangesRequestParametersInterval; - /** - * Acts as the continuation token for paged responses. - */ - skipToken?: string; - /** - * The maximum number of changes the client can accept in a paged response. - */ - top?: number; - /** - * The table name to query resources from. - */ - table?: string; - /** - * The flag if set to true will fetch property changes - */ - fetchPropertyChanges?: boolean; - /** - * The flag if set to true will fetch change snapshots - */ - fetchSnapshots?: boolean; -} - -/** - * Data on a specific resource snapshot. - */ -export interface ResourceSnapshotData { - /** - * The ID of the snapshot. - */ - snapshotId?: string; - /** - * The time when the snapshot was created. - * The snapshot timestamp provides an approximation as to when a modification to a resource was - * detected. There can be a difference between the actual modification time and the detection - * time. This is due to differences in how operations that modify a resource are processed, - * versus how operation that record resource snapshots are processed. - */ - timestamp: Date; - /** - * The resource snapshot content (in resourceChangeDetails response only). - */ - content?: any; -} - -/** - * The snapshot before the change. - */ -export interface ResourceChangeDataBeforeSnapshot extends ResourceSnapshotData {} - -/** - * The snapshot after the change. - */ -export interface ResourceChangeDataAfterSnapshot extends ResourceSnapshotData {} - -/** - * The resource property change - */ -export interface ResourcePropertyChange { - /** - * The property name - */ - propertyName: string; - /** - * The property value in before snapshot - */ - beforeValue?: string; - /** - * The property value in after snapshot - */ - afterValue?: string; - /** - * The change category. Possible values include: 'User', 'System' - */ - changeCategory: ChangeCategory; - /** - * The property change Type. Possible values include: 'Insert', 'Update', 'Remove' - */ - propertyChangeType: PropertyChangeType; -} - -/** - * Data on a specific change, represented by a pair of before and after resource snapshots. - */ -export interface ResourceChangeData { - /** - * The resource for a change. - */ - resourceId?: string; - /** - * The change ID. Valid and unique within the specified resource only. - */ - changeId: string; - /** - * The snapshot before the change. - */ - beforeSnapshot: ResourceChangeDataBeforeSnapshot; - /** - * The snapshot after the change. - */ - afterSnapshot: ResourceChangeDataAfterSnapshot; - /** - * The change type for snapshot. PropertyChanges will be provided in case of Update change type. - * Possible values include: 'Create', 'Update', 'Delete' - */ - changeType?: ChangeType; - /** - * An array of resource property change - */ - propertyChanges?: ResourcePropertyChange[]; -} - -/** - * A list of changes associated with a resource over a specific time interval. - */ -export interface ResourceChangeList { - /** - * The pageable value returned by the operation, i.e. a list of changes to the resource. - * - * - The list is ordered from the most recent changes to the least recent changes. - * - This list will be empty if there were no changes during the requested interval. - * - The `Before` snapshot timestamp value of the oldest change can be outside of the specified - * time interval. - */ - changes?: ResourceChangeData[]; - /** - * Skip token that encodes the skip information while executing the current request - */ - skipToken?: any; -} - -/** - * The parameters for a specific change details request. - */ -export interface ResourceChangeDetailsRequestParameters { - /** - * Specifies the list of resources for a change details request. - */ - resourceIds: string[]; - /** - * Specifies the list of change IDs for a change details request. - */ - changeIds: string[]; -} - -/** - * An interface representing ErrorDetails. - * @summary Error details. - */ -export interface ErrorDetails { - /** - * Error code identifying the specific error. - */ - code: string; - /** - * A human readable error message. - */ - message: string; - /** - * Describes unknown properties. The value of an unknown property can be of "any" type. - */ - [property: string]: any; -} - -/** - * Error details. - * @summary Error info. - */ -export interface ErrorModel { - /** - * Error code identifying the specific error. - */ - code: string; - /** - * A human readable error message. - */ - message: string; - /** - * Error details - */ - details?: ErrorDetails[]; -} - -/** - * An error response from the API. - * @summary Error response. - */ -export interface ErrorResponse { - /** - * Error information. - */ - error: ErrorModel; -} - -/** - * The options for query evaluation - */ -export interface QueryRequestOptions { - /** - * Continuation token for pagination, capturing the next page size and offset, as well as the - * context of the query. - */ - skipToken?: string; - /** - * The maximum number of rows that the query should return. Overrides the page size when - * ```$skipToken``` property is present. - */ - top?: number; - /** - * The number of rows to skip from the beginning of the results. Overrides the next page offset - * when ```$skipToken``` property is present. - */ - skip?: number; - /** - * Defines in which format query result returned. Possible values include: 'table', - * 'objectArray'. Default value: 'objectArray'. - */ - resultFormat?: ResultFormat; - /** - * Only applicable for tenant and management group level queries to decide whether to allow - * partial scopes for result in case the number of subscriptions exceed allowed limits. Default - * value: false. - */ - allowPartialScopes?: boolean; -} - -/** - * The options for facet evaluation - */ -export interface FacetRequestOptions { - /** - * The column name or query expression to sort on. Defaults to count if not present. - */ - sortBy?: string; - /** - * The sorting order by the selected column (count by default). Possible values include: 'asc', - * 'desc'. Default value: 'desc'. - */ - sortOrder?: FacetSortOrder; - /** - * Specifies the filter condition for the 'where' clause which will be run on main query's - * result, just before the actual faceting. - */ - filter?: string; - /** - * The maximum number of facet rows that should be returned. - */ - top?: number; -} - -/** - * A request to compute additional statistics (facets) over the query results. - */ -export interface FacetRequest { - /** - * The column or list of columns to summarize by - */ - expression: string; - /** - * The options for facet evaluation - */ - options?: FacetRequestOptions; -} - -/** - * Describes a query to be executed. - */ +/** Describes a query to be executed. */ export interface QueryRequest { - /** - * Azure subscriptions against which to execute the query. - */ + /** Azure subscriptions against which to execute the query. */ subscriptions?: string[]; - /** - * Azure management groups against which to execute the query. Example: [ 'mg1', 'mg2' ] - */ + /** Azure management groups against which to execute the query. Example: [ 'mg1', 'mg2' ] */ managementGroups?: string[]; - /** - * The resources query. - */ + /** The resources query. */ query: string; - /** - * The query evaluation options - */ + /** The query evaluation options */ options?: QueryRequestOptions; - /** - * An array of facet requests to be computed against the query result. - */ + /** An array of facet requests to be computed against the query result. */ facets?: FacetRequest[]; } -/** - * Contains the possible cases for Facet. - */ -export type FacetUnion = Facet | FacetResult | FacetError; - -/** - * A facet containing additional statistics on the response of a query. Can be either FacetResult - * or FacetError. - */ -export interface Facet { - /** - * Polymorphic Discriminator - */ - resultType: "Facet"; - /** - * Facet expression, same as in the corresponding facet request. - */ - expression: string; +/** The options for query evaluation */ +export interface QueryRequestOptions { + /** Continuation token for pagination, capturing the next page size and offset, as well as the context of the query. */ + skipToken?: string; + /** The maximum number of rows that the query should return. Overrides the page size when ```$skipToken``` property is present. */ + top?: number; + /** The number of rows to skip from the beginning of the results. Overrides the next page offset when ```$skipToken``` property is present. */ + skip?: number; + /** Defines in which format query result returned. */ + resultFormat?: ResultFormat; + /** Only applicable for tenant and management group level queries to decide whether to allow partial scopes for result in case the number of subscriptions exceed allowed limits. */ + allowPartialScopes?: boolean; + /** Defines what level of authorization resources should be returned based on the which subscriptions and management groups are passed as scopes. */ + authorizationScopeFilter?: AuthorizationScopeFilter; } -/** - * Query result. - */ +/** A request to compute additional statistics (facets) over the query results. */ +export interface FacetRequest { + /** The column or list of columns to summarize by */ + expression: string; + /** The options for facet evaluation */ + options?: FacetRequestOptions; +} + +/** The options for facet evaluation */ +export interface FacetRequestOptions { + /** The column name or query expression to sort on. Defaults to count if not present. */ + sortBy?: string; + /** The sorting order by the selected column (count by default). */ + sortOrder?: FacetSortOrder; + /** Specifies the filter condition for the 'where' clause which will be run on main query's result, just before the actual faceting. */ + filter?: string; + /** The maximum number of facet rows that should be returned. */ + top?: number; +} + +/** Query result. */ export interface QueryResponse { - /** - * Number of total records matching the query. - */ + /** Number of total records matching the query. */ totalRecords: number; - /** - * Number of records returned in the current response. In the case of paging, this is the number - * of records in the current page. - */ + /** Number of records returned in the current response. In the case of paging, this is the number of records in the current page. */ count: number; - /** - * Indicates whether the query results are truncated. Possible values include: 'true', 'false' - */ + /** Indicates whether the query results are truncated. */ resultTruncated: ResultTruncated; - /** - * When present, the value can be passed to a subsequent query call (together with the same query - * and scopes used in the current request) to retrieve the next page of data. - */ + /** When present, the value can be passed to a subsequent query call (together with the same query and scopes used in the current request) to retrieve the next page of data. */ skipToken?: string; - /** - * Query output in JObject array or Table format. - */ - data: any; - /** - * Query facets. - */ + /** Query output in JObject array or Table format. */ + data: Record; + /** Query facets. */ facets?: FacetUnion[]; } -/** - * Query result column descriptor. - */ -export interface Column { - /** - * Column name. - */ - name: string; - /** - * Column data type. Possible values include: 'string', 'integer', 'number', 'boolean', 'object' - */ - type: ColumnDataType; -} - -/** - * Query output in tabular format. - */ -export interface Table { - /** - * Query result column descriptors. - */ - columns: Column[]; - /** - * Query result rows. - */ - rows: any[][]; -} - -/** - * Successfully executed facet containing additional statistics on the response of a query. - */ -export interface FacetResult { - /** - * Polymorphic Discriminator - */ - resultType: "FacetResult"; - /** - * Facet expression, same as in the corresponding facet request. - */ +/** A facet containing additional statistics on the response of a query. Can be either FacetResult or FacetError. */ +export interface Facet { + /** Polymorphic discriminator, which specifies the different types this object can be */ + resultType: "FacetResult" | "FacetError"; + /** Facet expression, same as in the corresponding facet request. */ expression: string; - /** - * Number of total records in the facet results. - */ - totalRecords: number; - /** - * Number of records returned in the facet response. - */ - count: number; - /** - * A JObject array or Table containing the desired facets. Only present if the facet is valid. - */ - data: any; } -/** - * A facet whose execution resulted in an error. - */ -export interface FacetError { - /** - * Polymorphic Discriminator - */ - resultType: "FacetError"; - /** - * Facet expression, same as in the corresponding facet request. - */ - expression: string; - /** - * An array containing detected facet errors with details. - */ - errors: ErrorDetails[]; +/** An error response from the API. */ +export interface ErrorResponse { + /** Error information. */ + error: ErrorModel; } -/** - * Display metadata associated with the operation. - */ -export interface OperationDisplay { - /** - * Service provider: Microsoft Resource Graph. - */ - provider?: string; - /** - * Resource on which the operation is performed etc. - */ - resource?: string; - /** - * Type of operation: get, read, delete, etc. - */ - operation?: string; - /** - * Description for the operation. - */ - description?: string; +/** Error details. */ +export interface ErrorModel { + /** Error code identifying the specific error. */ + code: string; + /** A human readable error message. */ + message: string; + /** Error details */ + details?: ErrorDetails[]; } -/** - * Resource Graph REST API operation definition. - */ +/** Error details. */ +export interface ErrorDetails { + /** Describes unknown properties. The value of an unknown property can be of "any" type. */ + [property: string]: any; + /** Error code identifying the specific error. */ + code: string; + /** A human readable error message. */ + message: string; +} + +/** Result of the request to list Resource Graph operations. It contains a list of operations and a URL link to get the next set of results. */ +export interface OperationListResult { + /** List of Resource Graph operations supported by the Resource Graph resource provider. */ + value?: Operation[]; +} + +/** Resource Graph REST API operation definition. */ export interface Operation { - /** - * Operation name: {provider}/{resource}/{operation} - */ + /** Operation name: {provider}/{resource}/{operation} */ name?: string; - /** - * Display metadata associated with the operation. - */ + /** Display metadata associated with the operation. */ display?: OperationDisplay; - /** - * The origin of operations. - */ + /** The origin of operations. */ origin?: string; } -/** - * An interface representing ResourcesHistoryRequestOptions. - */ -export interface ResourcesHistoryRequestOptions { - interval?: DateTimeInterval; - top?: number; - skip?: number; - skipToken?: string; - /** - * Possible values include: 'table', 'objectArray' - */ - resultFormat?: ResultFormat1; +/** Display metadata associated with the operation. */ +export interface OperationDisplay { + /** Service provider: Microsoft Resource Graph. */ + provider?: string; + /** Resource on which the operation is performed etc. */ + resource?: string; + /** Type of operation: get, read, delete, etc. */ + operation?: string; + /** Description for the operation. */ + description?: string; } -/** - * An interface representing ResourcesHistoryRequest. - */ +/** Describes a history request to be executed. */ export interface ResourcesHistoryRequest { + /** Azure subscriptions against which to execute the query. */ subscriptions?: string[]; + /** The resources query. */ query?: string; + /** The history request evaluation options */ options?: ResourcesHistoryRequestOptions; - managementGroupId?: string; + /** Azure management groups against which to execute the query. Example: [ 'mg1', 'mg2' ] */ + managementGroups?: string[]; } -/** - * An interface representing ResourceGraphClientOptions. - */ -export interface ResourceGraphClientOptions extends AzureServiceClientOptions { - baseUri?: string; +/** The options for history request evaluation */ +export interface ResourcesHistoryRequestOptions { + /** The time interval used to fetch history. */ + interval?: DateTimeInterval; + /** The maximum number of rows that the query should return. Overrides the page size when ```$skipToken``` property is present. */ + top?: number; + /** The number of rows to skip from the beginning of the results. Overrides the next page offset when ```$skipToken``` property is present. */ + skip?: number; + /** Continuation token for pagination, capturing the next page size and offset, as well as the context of the query. */ + skipToken?: string; + /** Defines in which format query result returned. */ + resultFormat?: ResultFormat; } -/** - * @interface - * Result of the request to list Resource Graph operations. It contains a list of operations and a - * URL link to get the next set of results. - * @extends Array - */ -export interface OperationListResult extends Array {} +/** An interval in time specifying the date and time for the inclusive start and exclusive end, i.e. `[start, end)`. */ +export interface DateTimeInterval { + /** A datetime indicating the inclusive/closed start of the time interval, i.e. `[`**`start`**`, end)`. Specifying a `start` that occurs chronologically after `end` will result in an error. */ + start: Date; + /** A datetime indicating the exclusive/open end of the time interval, i.e. `[start, `**`end`**`)`. Specifying an `end` that occurs chronologically before `start` will result in an error. */ + end: Date; +} -/** - * Defines values for ChangeType. - * Possible values include: 'Create', 'Update', 'Delete' - * @readonly - * @enum {string} - */ -export type ChangeType = "Create" | "Update" | "Delete"; +/** Query output in tabular format. */ +export interface Table { + /** Query result column descriptors. */ + columns: Column[]; + /** Query result rows. */ + rows: Record[][]; +} -/** - * Defines values for ChangeCategory. - * Possible values include: 'User', 'System' - * @readonly - * @enum {string} - */ -export type ChangeCategory = "User" | "System"; +/** Query result column descriptor. */ +export interface Column { + /** Column name. */ + name: string; + /** Column data type. */ + type: ColumnDataType; +} -/** - * Defines values for PropertyChangeType. - * Possible values include: 'Insert', 'Update', 'Remove' - * @readonly - * @enum {string} - */ -export type PropertyChangeType = "Insert" | "Update" | "Remove"; +/** Successfully executed facet containing additional statistics on the response of a query. */ +export type FacetResult = Facet & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + resultType: "FacetResult"; + /** Number of total records in the facet results. */ + totalRecords: number; + /** Number of records returned in the facet response. */ + count: number; + /** A JObject array or Table containing the desired facets. Only present if the facet is valid. */ + data: Record; +}; -/** - * Defines values for ResultFormat. - * Possible values include: 'table', 'objectArray' - * @readonly - * @enum {string} - */ +/** A facet whose execution resulted in an error. */ +export type FacetError = Facet & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + resultType: "FacetError"; + /** An array containing detected facet errors with details. */ + errors: ErrorDetails[]; +}; +/** Defines values for ResultFormat. */ export type ResultFormat = "table" | "objectArray"; - -/** - * Defines values for FacetSortOrder. - * Possible values include: 'asc', 'desc' - * @readonly - * @enum {string} - */ +/** Defines values for AuthorizationScopeFilter. */ +export type AuthorizationScopeFilter = + | "AtScopeAndBelow" + | "AtScopeAndAbove" + | "AtScopeExact" + | "AtScopeAboveAndBelow"; +/** Defines values for FacetSortOrder. */ export type FacetSortOrder = "asc" | "desc"; - -/** - * Defines values for ResultTruncated. - * Possible values include: 'true', 'false' - * @readonly - * @enum {string} - */ +/** Defines values for ResultTruncated. */ export type ResultTruncated = "true" | "false"; +/** Defines values for ColumnDataType. */ +export type ColumnDataType = + | "string" + | "integer" + | "number" + | "boolean" + | "object" + | "datetime"; -/** - * Defines values for ColumnDataType. - * Possible values include: 'string', 'integer', 'number', 'boolean', 'object' - * @readonly - * @enum {string} - */ -export type ColumnDataType = "string" | "integer" | "number" | "boolean" | "object"; +/** Optional parameters. */ +export interface ResourcesOptionalParams extends coreClient.OperationOptions {} -/** - * Defines values for ResultFormat1. - * Possible values include: 'table', 'objectArray' - * @readonly - * @enum {string} - */ -export type ResultFormat1 = "table" | "objectArray"; +/** Contains response data for the resources operation. */ +export type ResourcesResponse = QueryResponse; -/** - * Contains response data for the resourceChanges operation. - */ -export type ResourceChangesResponse = ResourceChangeList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; +/** Optional parameters. */ +export interface ResourcesHistoryOptionalParams + extends coreClient.OperationOptions {} - /** - * The response body as parsed JSON or XML - */ - parsedBody: ResourceChangeList; - }; -}; +/** Contains response data for the resourcesHistory operation. */ +export type ResourcesHistoryResponse = Record; -/** - * Contains response data for the resourceChangeDetails operation. - */ -export type ResourceChangeDetailsResponse = Array & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} - /** - * The response body as parsed JSON or XML - */ - parsedBody: ResourceChangeData[]; - }; -}; +/** Contains response data for the list operation. */ +export type OperationsListResponse = OperationListResult; -/** - * Contains response data for the resources operation. - */ -export type ResourcesResponse = QueryResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: QueryResponse; - }; -}; - -/** - * Contains response data for the resourcesHistory operation. - */ -export type ResourcesHistoryResponse = { - /** - * The parsed response body. - */ - body: any; - - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: any; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type OperationsListResponse = OperationListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationListResult; - }; -}; +/** Optional parameters. */ +export interface ResourceGraphClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/resourcegraph/arm-resourcegraph/src/models/mappers.ts b/sdk/resourcegraph/arm-resourcegraph/src/models/mappers.ts index 55be1b49bb9..1d45b2a7e03 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/models/mappers.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/models/mappers.ts @@ -6,536 +6,9 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export const CloudError = CloudErrorMapper; -export const BaseResource = BaseResourceMapper; - -export const DateTimeInterval: msRest.CompositeMapper = { - serializedName: "DateTimeInterval", - type: { - name: "Composite", - className: "DateTimeInterval", - modelProperties: { - start: { - required: true, - serializedName: "start", - type: { - name: "DateTime" - } - }, - end: { - required: true, - serializedName: "end", - type: { - name: "DateTime" - } - } - } - } -}; - -export const ResourceChangesRequestParametersInterval: msRest.CompositeMapper = { - serializedName: "ResourceChangesRequestParameters_interval", - type: { - name: "Composite", - className: "ResourceChangesRequestParametersInterval", - modelProperties: { - ...DateTimeInterval.type.modelProperties - } - } -}; - -export const ResourceChangesRequestParameters: msRest.CompositeMapper = { - serializedName: "ResourceChangesRequestParameters", - type: { - name: "Composite", - className: "ResourceChangesRequestParameters", - modelProperties: { - resourceIds: { - serializedName: "resourceIds", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - subscriptionId: { - serializedName: "subscriptionId", - type: { - name: "String" - } - }, - interval: { - required: true, - serializedName: "interval", - type: { - name: "Composite", - className: "ResourceChangesRequestParametersInterval" - } - }, - skipToken: { - serializedName: "$skipToken", - type: { - name: "String" - } - }, - top: { - serializedName: "$top", - constraints: { - InclusiveMaximum: 1000, - InclusiveMinimum: 1 - }, - type: { - name: "Number" - } - }, - table: { - serializedName: "table", - type: { - name: "String" - } - }, - fetchPropertyChanges: { - serializedName: "fetchPropertyChanges", - type: { - name: "Boolean" - } - }, - fetchSnapshots: { - serializedName: "fetchSnapshots", - type: { - name: "Boolean" - } - } - } - } -}; - -export const ResourceSnapshotData: msRest.CompositeMapper = { - serializedName: "ResourceSnapshotData", - type: { - name: "Composite", - className: "ResourceSnapshotData", - modelProperties: { - snapshotId: { - serializedName: "snapshotId", - type: { - name: "String" - } - }, - timestamp: { - required: true, - serializedName: "timestamp", - type: { - name: "DateTime" - } - }, - content: { - serializedName: "content", - type: { - name: "Object" - } - } - } - } -}; - -export const ResourceChangeDataBeforeSnapshot: msRest.CompositeMapper = { - serializedName: "ResourceChangeData_beforeSnapshot", - type: { - name: "Composite", - className: "ResourceChangeDataBeforeSnapshot", - modelProperties: { - ...ResourceSnapshotData.type.modelProperties - } - } -}; - -export const ResourceChangeDataAfterSnapshot: msRest.CompositeMapper = { - serializedName: "ResourceChangeData_afterSnapshot", - type: { - name: "Composite", - className: "ResourceChangeDataAfterSnapshot", - modelProperties: { - ...ResourceSnapshotData.type.modelProperties - } - } -}; - -export const ResourcePropertyChange: msRest.CompositeMapper = { - serializedName: "ResourcePropertyChange", - type: { - name: "Composite", - className: "ResourcePropertyChange", - modelProperties: { - propertyName: { - required: true, - serializedName: "propertyName", - type: { - name: "String" - } - }, - beforeValue: { - serializedName: "beforeValue", - type: { - name: "String" - } - }, - afterValue: { - serializedName: "afterValue", - type: { - name: "String" - } - }, - changeCategory: { - required: true, - serializedName: "changeCategory", - type: { - name: "Enum", - allowedValues: ["User", "System"] - } - }, - propertyChangeType: { - required: true, - serializedName: "propertyChangeType", - type: { - name: "Enum", - allowedValues: ["Insert", "Update", "Remove"] - } - } - } - } -}; - -export const ResourceChangeData: msRest.CompositeMapper = { - serializedName: "ResourceChangeData", - type: { - name: "Composite", - className: "ResourceChangeData", - modelProperties: { - resourceId: { - serializedName: "resourceId", - type: { - name: "String" - } - }, - changeId: { - required: true, - serializedName: "changeId", - type: { - name: "String" - } - }, - beforeSnapshot: { - required: true, - serializedName: "beforeSnapshot", - type: { - name: "Composite", - className: "ResourceChangeDataBeforeSnapshot" - } - }, - afterSnapshot: { - required: true, - serializedName: "afterSnapshot", - type: { - name: "Composite", - className: "ResourceChangeDataAfterSnapshot" - } - }, - changeType: { - serializedName: "changeType", - type: { - name: "Enum", - allowedValues: ["Create", "Update", "Delete"] - } - }, - propertyChanges: { - serializedName: "propertyChanges", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ResourcePropertyChange" - } - } - } - } - } - } -}; - -export const ResourceChangeList: msRest.CompositeMapper = { - serializedName: "ResourceChangeList", - type: { - name: "Composite", - className: "ResourceChangeList", - modelProperties: { - changes: { - serializedName: "changes", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ResourceChangeData" - } - } - } - }, - skipToken: { - serializedName: "$skipToken", - type: { - name: "Object" - } - } - } - } -}; - -export const ResourceChangeDetailsRequestParameters: msRest.CompositeMapper = { - serializedName: "ResourceChangeDetailsRequestParameters", - type: { - name: "Composite", - className: "ResourceChangeDetailsRequestParameters", - modelProperties: { - resourceIds: { - required: true, - serializedName: "resourceIds", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - changeIds: { - required: true, - serializedName: "changeIds", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - } - } - } -}; - -export const ErrorDetails: msRest.CompositeMapper = { - serializedName: "ErrorDetails", - type: { - name: "Composite", - className: "ErrorDetails", - modelProperties: { - code: { - required: true, - serializedName: "code", - type: { - name: "String" - } - }, - message: { - required: true, - serializedName: "message", - type: { - name: "String" - } - } - }, - additionalProperties: { - type: { - name: "Object" - } - } - } -}; - -export const ErrorModel: msRest.CompositeMapper = { - serializedName: "Error", - type: { - name: "Composite", - className: "ErrorModel", - modelProperties: { - code: { - required: true, - serializedName: "code", - type: { - name: "String" - } - }, - message: { - required: true, - serializedName: "message", - type: { - name: "String" - } - }, - details: { - serializedName: "details", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorDetails", - additionalProperties: { - type: { - name: "Object" - } - } - } - } - } - } - } - } -}; - -export const ErrorResponse: msRest.CompositeMapper = { - serializedName: "ErrorResponse", - type: { - name: "Composite", - className: "ErrorResponse", - modelProperties: { - error: { - required: true, - serializedName: "error", - type: { - name: "Composite", - className: "ErrorModel" - } - } - } - } -}; - -export const QueryRequestOptions: msRest.CompositeMapper = { - serializedName: "QueryRequestOptions", - type: { - name: "Composite", - className: "QueryRequestOptions", - modelProperties: { - skipToken: { - serializedName: "$skipToken", - type: { - name: "String" - } - }, - top: { - serializedName: "$top", - constraints: { - InclusiveMaximum: 1000, - InclusiveMinimum: 1 - }, - type: { - name: "Number" - } - }, - skip: { - serializedName: "$skip", - constraints: { - InclusiveMinimum: 0 - }, - type: { - name: "Number" - } - }, - resultFormat: { - serializedName: "resultFormat", - defaultValue: "objectArray", - type: { - name: "Enum", - allowedValues: ["table", "objectArray"] - } - }, - allowPartialScopes: { - serializedName: "allowPartialScopes", - defaultValue: false, - type: { - name: "Boolean" - } - } - } - } -}; - -export const FacetRequestOptions: msRest.CompositeMapper = { - serializedName: "FacetRequestOptions", - type: { - name: "Composite", - className: "FacetRequestOptions", - modelProperties: { - sortBy: { - serializedName: "sortBy", - type: { - name: "String" - } - }, - sortOrder: { - serializedName: "sortOrder", - defaultValue: "desc", - type: { - name: "Enum", - allowedValues: ["asc", "desc"] - } - }, - filter: { - serializedName: "filter", - type: { - name: "String" - } - }, - top: { - serializedName: "$top", - constraints: { - InclusiveMaximum: 1000, - InclusiveMinimum: 1 - }, - type: { - name: "Number" - } - } - } - } -}; - -export const FacetRequest: msRest.CompositeMapper = { - serializedName: "FacetRequest", - type: { - name: "Composite", - className: "FacetRequest", - modelProperties: { - expression: { - required: true, - serializedName: "expression", - type: { - name: "String" - } - }, - options: { - serializedName: "options", - type: { - name: "Composite", - className: "FacetRequestOptions" - } - } - } - } -}; - -export const QueryRequest: msRest.CompositeMapper = { - serializedName: "QueryRequest", +export const QueryRequest: coreClient.CompositeMapper = { type: { name: "Composite", className: "QueryRequest", @@ -563,8 +36,8 @@ export const QueryRequest: msRest.CompositeMapper = { } }, query: { - required: true, serializedName: "query", + required: true, type: { name: "String" } @@ -592,58 +65,151 @@ export const QueryRequest: msRest.CompositeMapper = { } }; -export const Facet: msRest.CompositeMapper = { - serializedName: "Facet", +export const QueryRequestOptions: coreClient.CompositeMapper = { type: { name: "Composite", - polymorphicDiscriminator: { - serializedName: "resultType", - clientName: "resultType" - }, - uberParent: "Facet", - className: "Facet", + className: "QueryRequestOptions", modelProperties: { - expression: { - required: true, - serializedName: "expression", + skipToken: { + serializedName: "$skipToken", type: { name: "String" } }, - resultType: { - required: true, - serializedName: "resultType", + top: { + constraints: { + InclusiveMaximum: 1000, + InclusiveMinimum: 1 + }, + serializedName: "$top", type: { - name: "String" + name: "Number" + } + }, + skip: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "$skip", + type: { + name: "Number" + } + }, + resultFormat: { + serializedName: "resultFormat", + type: { + name: "Enum", + allowedValues: ["table", "objectArray"] + } + }, + allowPartialScopes: { + defaultValue: false, + serializedName: "allowPartialScopes", + type: { + name: "Boolean" + } + }, + authorizationScopeFilter: { + defaultValue: "AtScopeAndBelow", + serializedName: "authorizationScopeFilter", + type: { + name: "Enum", + allowedValues: [ + "AtScopeAndBelow", + "AtScopeAndAbove", + "AtScopeExact", + "AtScopeAboveAndBelow" + ] } } } } }; -export const QueryResponse: msRest.CompositeMapper = { - serializedName: "QueryResponse", +export const FacetRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FacetRequest", + modelProperties: { + expression: { + serializedName: "expression", + required: true, + type: { + name: "String" + } + }, + options: { + serializedName: "options", + type: { + name: "Composite", + className: "FacetRequestOptions" + } + } + } + } +}; + +export const FacetRequestOptions: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FacetRequestOptions", + modelProperties: { + sortBy: { + serializedName: "sortBy", + type: { + name: "String" + } + }, + sortOrder: { + defaultValue: "desc", + serializedName: "sortOrder", + type: { + name: "Enum", + allowedValues: ["asc", "desc"] + } + }, + filter: { + serializedName: "filter", + type: { + name: "String" + } + }, + top: { + constraints: { + InclusiveMaximum: 1000, + InclusiveMinimum: 1 + }, + serializedName: "$top", + type: { + name: "Number" + } + } + } + } +}; + +export const QueryResponse: coreClient.CompositeMapper = { type: { name: "Composite", className: "QueryResponse", modelProperties: { totalRecords: { - required: true, serializedName: "totalRecords", + required: true, type: { name: "Number" } }, count: { - required: true, serializedName: "count", + required: true, type: { name: "Number" } }, resultTruncated: { - required: true, serializedName: "resultTruncated", + required: true, type: { name: "Enum", allowedValues: ["true", "false"] @@ -656,10 +222,11 @@ export const QueryResponse: msRest.CompositeMapper = { } }, data: { - required: true, serializedName: "data", + required: true, type: { - name: "Object" + name: "Dictionary", + value: { type: { name: "any" } } } }, facets: { @@ -678,138 +245,159 @@ export const QueryResponse: msRest.CompositeMapper = { } }; -export const Column: msRest.CompositeMapper = { - serializedName: "Column", +export const Facet: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Column", + className: "Facet", + uberParent: "Facet", + polymorphicDiscriminator: { + serializedName: "resultType", + clientName: "resultType" + }, + modelProperties: { + expression: { + serializedName: "expression", + required: true, + type: { + name: "String" + } + }, + resultType: { + serializedName: "resultType", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorModel" + } + } + } + } +}; + +export const ErrorModel: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorModel", + modelProperties: { + code: { + serializedName: "code", + required: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + required: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetails" + } + } + } + } + } + } +}; + +export const ErrorDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetails", + additionalProperties: { type: { name: "Object" } }, + modelProperties: { + code: { + serializedName: "code", + required: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const OperationListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Operation" + } + } + } + } + } + } +}; + +export const Operation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Operation", modelProperties: { name: { - required: true, serializedName: "name", type: { name: "String" } }, - type: { - required: true, - serializedName: "type", + display: { + serializedName: "display", type: { - name: "Enum", - allowedValues: ["string", "integer", "number", "boolean", "object"] - } - } - } - } -}; - -export const Table: msRest.CompositeMapper = { - serializedName: "Table", - type: { - name: "Composite", - className: "Table", - modelProperties: { - columns: { - required: true, - serializedName: "columns", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Column" - } - } + name: "Composite", + className: "OperationDisplay" } }, - rows: { - required: true, - serializedName: "rows", + origin: { + serializedName: "origin", type: { - name: "Sequence", - element: { - type: { - name: "Sequence", - element: { - type: { - name: "Object" - } - } - } - } + name: "String" } } } } }; -export const FacetResult: msRest.CompositeMapper = { - serializedName: "FacetResult", - type: { - name: "Composite", - polymorphicDiscriminator: Facet.type.polymorphicDiscriminator, - uberParent: "Facet", - className: "FacetResult", - modelProperties: { - ...Facet.type.modelProperties, - totalRecords: { - required: true, - serializedName: "totalRecords", - type: { - name: "Number" - } - }, - count: { - required: true, - serializedName: "count", - type: { - name: "Number" - } - }, - data: { - required: true, - serializedName: "data", - type: { - name: "Object" - } - } - } - } -}; - -export const FacetError: msRest.CompositeMapper = { - serializedName: "FacetError", - type: { - name: "Composite", - polymorphicDiscriminator: Facet.type.polymorphicDiscriminator, - uberParent: "Facet", - className: "FacetError", - modelProperties: { - ...Facet.type.modelProperties, - errors: { - required: true, - serializedName: "errors", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorDetails", - additionalProperties: { - type: { - name: "Object" - } - } - } - } - } - } - } - } -}; - -export const OperationDisplay: msRest.CompositeMapper = { - serializedName: "Operation_display", +export const OperationDisplay: coreClient.CompositeMapper = { type: { name: "Composite", className: "OperationDisplay", @@ -842,78 +430,7 @@ export const OperationDisplay: msRest.CompositeMapper = { } }; -export const Operation: msRest.CompositeMapper = { - serializedName: "Operation", - type: { - name: "Composite", - className: "Operation", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String" - } - }, - display: { - serializedName: "display", - type: { - name: "Composite", - className: "OperationDisplay" - } - }, - origin: { - serializedName: "origin", - type: { - name: "String" - } - } - } - } -}; - -export const ResourcesHistoryRequestOptions: msRest.CompositeMapper = { - serializedName: "ResourcesHistoryRequestOptions", - type: { - name: "Composite", - className: "ResourcesHistoryRequestOptions", - modelProperties: { - interval: { - serializedName: "interval", - type: { - name: "Composite", - className: "DateTimeInterval" - } - }, - top: { - serializedName: "$top", - type: { - name: "Number" - } - }, - skip: { - serializedName: "$skip", - type: { - name: "Number" - } - }, - skipToken: { - serializedName: "$skipToken", - type: { - name: "String" - } - }, - resultFormat: { - serializedName: "resultFormat", - type: { - name: "String" - } - } - } - } -}; - -export const ResourcesHistoryRequest: msRest.CompositeMapper = { - serializedName: "ResourcesHistoryRequest", +export const ResourcesHistoryRequest: coreClient.CompositeMapper = { type: { name: "Composite", className: "ResourcesHistoryRequest", @@ -942,30 +459,13 @@ export const ResourcesHistoryRequest: msRest.CompositeMapper = { className: "ResourcesHistoryRequestOptions" } }, - managementGroupId: { - serializedName: "managementGroupId", - type: { - name: "String" - } - } - } - } -}; - -export const OperationListResult: msRest.CompositeMapper = { - serializedName: "OperationListResult", - type: { - name: "Composite", - className: "OperationListResult", - modelProperties: { - value: { - serializedName: "", + managementGroups: { + serializedName: "managementGroups", type: { name: "Sequence", element: { type: { - name: "Composite", - className: "Operation" + name: "String" } } } @@ -974,7 +474,210 @@ export const OperationListResult: msRest.CompositeMapper = { } }; -export const discriminators = { +export const ResourcesHistoryRequestOptions: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourcesHistoryRequestOptions", + modelProperties: { + interval: { + serializedName: "interval", + type: { + name: "Composite", + className: "DateTimeInterval" + } + }, + top: { + constraints: { + InclusiveMaximum: 1000, + InclusiveMinimum: 1 + }, + serializedName: "$top", + type: { + name: "Number" + } + }, + skip: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "$skip", + type: { + name: "Number" + } + }, + skipToken: { + serializedName: "$skipToken", + type: { + name: "String" + } + }, + resultFormat: { + serializedName: "resultFormat", + type: { + name: "Enum", + allowedValues: ["table", "objectArray"] + } + } + } + } +}; + +export const DateTimeInterval: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DateTimeInterval", + modelProperties: { + start: { + serializedName: "start", + required: true, + type: { + name: "DateTime" + } + }, + end: { + serializedName: "end", + required: true, + type: { + name: "DateTime" + } + } + } + } +}; + +export const Table: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Table", + modelProperties: { + columns: { + serializedName: "columns", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Column" + } + } + } + }, + rows: { + serializedName: "rows", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Sequence", + element: { + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } + } + } + } + } +}; + +export const Column: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Column", + modelProperties: { + name: { + serializedName: "name", + required: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + required: true, + type: { + name: "Enum", + allowedValues: [ + "string", + "integer", + "number", + "boolean", + "object", + "datetime" + ] + } + } + } + } +}; + +export const FacetResult: coreClient.CompositeMapper = { + serializedName: "FacetResult", + type: { + name: "Composite", + className: "FacetResult", + uberParent: "Facet", + polymorphicDiscriminator: Facet.type.polymorphicDiscriminator, + modelProperties: { + ...Facet.type.modelProperties, + totalRecords: { + serializedName: "totalRecords", + required: true, + type: { + name: "Number" + } + }, + count: { + serializedName: "count", + required: true, + type: { + name: "Number" + } + }, + data: { + serializedName: "data", + required: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const FacetError: coreClient.CompositeMapper = { + serializedName: "FacetError", + type: { + name: "Composite", + className: "FacetError", + uberParent: "Facet", + polymorphicDiscriminator: Facet.type.polymorphicDiscriminator, + modelProperties: { + ...Facet.type.modelProperties, + errors: { + serializedName: "errors", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetails" + } + } + } + } + } + } +}; + +export let discriminators = { Facet: Facet, "Facet.FacetResult": FacetResult, "Facet.FacetError": FacetError diff --git a/sdk/resourcegraph/arm-resourcegraph/src/models/parameters.ts b/sdk/resourcegraph/arm-resourcegraph/src/models/parameters.ts index 9d39f7b83eb..1a4e73d15e5 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/models/parameters.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/models/parameters.ts @@ -3,55 +3,73 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + QueryRequest as QueryRequestMapper, + ResourcesHistoryRequest as ResourcesHistoryRequestMapper +} from "../models/mappers"; -export const acceptLanguage: msRest.OperationParameter = { - parameterPath: "acceptLanguage", +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], mapper: { - serializedName: "accept-language", - defaultValue: "en-US", + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", type: { name: "String" } } }; -export const apiVersion0: msRest.OperationQueryParameter = { + +export const query: OperationParameter = { + parameterPath: "query", + mapper: QueryRequestMapper +}; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String" + } + } +}; + +export const $host: OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - required: true, + defaultValue: "2021-06-01-preview", isConstant: true, serializedName: "api-version", - defaultValue: "2020-09-01-preview", type: { name: "String" } } }; -export const apiVersion1: msRest.OperationQueryParameter = { - parameterPath: "apiVersion", - mapper: { - required: true, - isConstant: true, - serializedName: "api-version", - defaultValue: "2021-03-01", - type: { - name: "String" - } - } -}; -export const apiVersion2: msRest.OperationQueryParameter = { - parameterPath: "apiVersion", - mapper: { - required: true, - isConstant: true, - serializedName: "api-version", - defaultValue: "2020-04-01-preview", - type: { - name: "String" - } - } + +export const request: OperationParameter = { + parameterPath: "request", + mapper: ResourcesHistoryRequestMapper }; diff --git a/sdk/resourcegraph/arm-resourcegraph/src/operations/index.ts b/sdk/resourcegraph/arm-resourcegraph/src/operations/index.ts index dfc0b9f0e39..afc67b73542 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/operations/index.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/operations/index.ts @@ -3,8 +3,7 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ export * from "./operations"; diff --git a/sdk/resourcegraph/arm-resourcegraph/src/operations/operations.ts b/sdk/resourcegraph/arm-resourcegraph/src/operations/operations.ts index 475f4ecf68c..9ddac3e5cb6 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/operations/operations.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/operations/operations.ts @@ -3,67 +3,86 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/operationsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { ResourceGraphClientContext } from "../resourceGraphClientContext"; +import { ResourceGraphClient } from "../resourceGraphClient"; +import { + Operation, + OperationsListOptionalParams, + OperationsListResponse +} from "../models"; -/** Class representing a Operations. */ -export class Operations { - private readonly client: ResourceGraphClientContext; +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: ResourceGraphClient; /** - * Create a Operations. - * @param {ResourceGraphClientContext} client Reference to the service client. + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client */ - constructor(client: ResourceGraphClientContext) { + constructor(client: ResourceGraphClient) { this.client = client; } /** * Lists all of the available REST API operations. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list( - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - list( - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { - return this.client.sendOperationRequest( - { - options + public list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); }, - listOperationSpec, - callback - ) as Promise; + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + } + + private async *listPagingAll( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } + } + + /** + * Lists all of the available REST API operations. + * @param options The options parameters. + */ + private _list( + options?: OperationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.ResourceGraph/operations", httpMethod: "GET", - path: "providers/Microsoft.ResourceGraph/operations", - queryParameters: [Parameters.apiVersion1], - headerParameters: [Parameters.acceptLanguage], responses: { 200: { bodyMapper: Mappers.OperationListResult @@ -72,5 +91,8 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/storagecache/arm-storagecache/src/models/ascOperationsMappers.ts b/sdk/resourcegraph/arm-resourcegraph/src/operationsInterfaces/index.ts similarity index 73% rename from sdk/storagecache/arm-storagecache/src/models/ascOperationsMappers.ts rename to sdk/resourcegraph/arm-resourcegraph/src/operationsInterfaces/index.ts index 7f2558513f4..afc67b73542 100644 --- a/sdk/storagecache/arm-storagecache/src/models/ascOperationsMappers.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/operationsInterfaces/index.ts @@ -6,8 +6,4 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -export { - AscOperation, - CloudError, - ErrorResponse -} from "../models/mappers"; +export * from "./operations"; diff --git a/sdk/resourcegraph/arm-resourcegraph/src/operationsInterfaces/operations.ts b/sdk/resourcegraph/arm-resourcegraph/src/operationsInterfaces/operations.ts new file mode 100644 index 00000000000..78f149280ae --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/src/operationsInterfaces/operations.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operation, OperationsListOptionalParams } from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * Lists all of the available REST API operations. + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts b/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts index c10ca6faa96..32b0f5ea2ca 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts +++ b/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClient.ts @@ -3,278 +3,114 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "./models"; -import * as Mappers from "./models/mappers"; +import * as coreClient from "@azure/core-client"; +import * as coreAuth from "@azure/core-auth"; +import { OperationsImpl } from "./operations"; +import { Operations } from "./operationsInterfaces"; import * as Parameters from "./models/parameters"; -import * as operations from "./operations"; -import { ResourceGraphClientContext } from "./resourceGraphClientContext"; +import * as Mappers from "./models/mappers"; +import { + ResourceGraphClientOptionalParams, + QueryRequest, + ResourcesOptionalParams, + ResourcesResponse, + ResourcesHistoryRequest, + ResourcesHistoryOptionalParams, + ResourcesHistoryResponse +} from "./models"; -class ResourceGraphClient extends ResourceGraphClientContext { - // Operation groups - operations: operations.Operations; +export class ResourceGraphClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; /** * Initializes a new instance of the ResourceGraphClient class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param [options] The parameter options + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param options The parameter options */ constructor( - credentials: msRest.ServiceClientCredentials, - options?: Models.ResourceGraphClientOptions + credentials: coreAuth.TokenCredential, + options?: ResourceGraphClientOptionalParams ) { - super(credentials, options); - this.operations = new operations.Operations(this); - } + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } - /** - * List changes to a resource for a given time interval. - * @param parameters the parameters for this request for changes. - * @param [options] The optional parameters - * @returns Promise - */ - resourceChanges( - parameters: Models.ResourceChangesRequestParameters, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param parameters the parameters for this request for changes. - * @param callback The callback - */ - resourceChanges( - parameters: Models.ResourceChangesRequestParameters, - callback: msRest.ServiceCallback - ): void; - /** - * @param parameters the parameters for this request for changes. - * @param options The optional parameters - * @param callback The callback - */ - resourceChanges( - parameters: Models.ResourceChangesRequestParameters, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - resourceChanges( - parameters: Models.ResourceChangesRequestParameters, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { - return this.sendOperationRequest( - { - parameters, - options - }, - resourceChangesOperationSpec, - callback - ) as Promise; - } + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: ResourceGraphClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; - /** - * Get resource change details. - * @param parameters The parameters for this request for resource change details. - * @param [options] The optional parameters - * @returns Promise - */ - resourceChangeDetails( - parameters: Models.ResourceChangeDetailsRequestParameters, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param parameters The parameters for this request for resource change details. - * @param callback The callback - */ - resourceChangeDetails( - parameters: Models.ResourceChangeDetailsRequestParameters, - callback: msRest.ServiceCallback - ): void; - /** - * @param parameters The parameters for this request for resource change details. - * @param options The optional parameters - * @param callback The callback - */ - resourceChangeDetails( - parameters: Models.ResourceChangeDetailsRequestParameters, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - resourceChangeDetails( - parameters: Models.ResourceChangeDetailsRequestParameters, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { - return this.sendOperationRequest( - { - parameters, - options + const packageDetails = `azsdk-js-arm-resourcegraph/5.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + if (!options.credentialScopes) { + options.credentialScopes = ["https://management.azure.com/.default"]; + } + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix }, - resourceChangeDetailsOperationSpec, - callback - ) as Promise; + baseUri: options.endpoint || "https://management.azure.com" + }; + super(optionsWithDefaults); + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2021-06-01-preview"; + this.operations = new OperationsImpl(this); } /** * Queries the resources managed by Azure Resource Manager for scopes specified in the request. * @param query Request specifying query and its options. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ resources( - query: Models.QueryRequest, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param query Request specifying query and its options. - * @param callback The callback - */ - resources( - query: Models.QueryRequest, - callback: msRest.ServiceCallback - ): void; - /** - * @param query Request specifying query and its options. - * @param options The optional parameters - * @param callback The callback - */ - resources( - query: Models.QueryRequest, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - resources( - query: Models.QueryRequest, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + query: QueryRequest, + options?: ResourcesOptionalParams + ): Promise { return this.sendOperationRequest( - { - query, - options - }, - resourcesOperationSpec, - callback - ) as Promise; + { query, options }, + resourcesOperationSpec + ); } /** * List all snapshots of a resource for a given time interval. - * @param request - * @param [options] The optional parameters - * @returns Promise + * @param request Request specifying the query and its options. + * @param options The options parameters. */ resourcesHistory( - request: Models.ResourcesHistoryRequest, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param request - * @param callback The callback - */ - resourcesHistory( - request: Models.ResourcesHistoryRequest, - callback: msRest.ServiceCallback - ): void; - /** - * @param request - * @param options The optional parameters - * @param callback The callback - */ - resourcesHistory( - request: Models.ResourcesHistoryRequest, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - resourcesHistory( - request: Models.ResourcesHistoryRequest, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + request: ResourcesHistoryRequest, + options?: ResourcesHistoryOptionalParams + ): Promise { return this.sendOperationRequest( - { - request, - options - }, - resourcesHistoryOperationSpec, - callback - ) as Promise; + { request, options }, + resourcesHistoryOperationSpec + ); } + + operations: Operations; } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const resourceChangesOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "providers/Microsoft.ResourceGraph/resourceChanges", - queryParameters: [Parameters.apiVersion0], - headerParameters: [Parameters.acceptLanguage], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.ResourceChangesRequestParameters, - required: true - } - }, - responses: { - 200: { - bodyMapper: Mappers.ResourceChangeList - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); -const resourceChangeDetailsOperationSpec: msRest.OperationSpec = { +const resourcesOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.ResourceGraph/resources", httpMethod: "POST", - path: "providers/Microsoft.ResourceGraph/resourceChangeDetails", - queryParameters: [Parameters.apiVersion0], - headerParameters: [Parameters.acceptLanguage], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.ResourceChangeDetailsRequestParameters, - required: true - } - }, - responses: { - 200: { - bodyMapper: { - serializedName: "parsedResponse", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ResourceChangeData" - } - } - } - } - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const resourcesOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "providers/Microsoft.ResourceGraph/resources", - queryParameters: [Parameters.apiVersion1], - headerParameters: [Parameters.acceptLanguage], - requestBody: { - parameterPath: "query", - mapper: { - ...Mappers.QueryRequest, - required: true - } - }, responses: { 200: { bodyMapper: Mappers.QueryResponse @@ -283,41 +119,30 @@ const resourcesOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + requestBody: Parameters.query, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const resourcesHistoryOperationSpec: msRest.OperationSpec = { +const resourcesHistoryOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.ResourceGraph/resourcesHistory", httpMethod: "POST", - path: "providers/Microsoft.ResourceGraph/resourcesHistory", - queryParameters: [Parameters.apiVersion2], - headerParameters: [Parameters.acceptLanguage], - requestBody: { - parameterPath: "request", - mapper: { - ...Mappers.ResourcesHistoryRequest, - required: true - } - }, responses: { 200: { bodyMapper: { - serializedName: "parsedResponse", - type: { - name: "Object" - } + type: { name: "Dictionary", value: { type: { name: "any" } } } } }, default: { bodyMapper: Mappers.ErrorResponse } }, + requestBody: Parameters.request, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -export { - ResourceGraphClient, - ResourceGraphClientContext, - Models as ResourceGraphModels, - Mappers as ResourceGraphMappers -}; -export * from "./operations"; diff --git a/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClientContext.ts b/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClientContext.ts deleted file mode 100644 index 16131061fc4..00000000000 --- a/sdk/resourcegraph/arm-resourcegraph/src/resourceGraphClientContext.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import * as Models from "./models"; -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; - -const packageName = "@azure/arm-resourcegraph"; -const packageVersion = "4.1.0"; - -export class ResourceGraphClientContext extends msRestAzure.AzureServiceClient { - credentials: msRest.ServiceClientCredentials; - - /** - * Initializes a new instance of the ResourceGraphClient class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param [options] The parameter options - */ - constructor( - credentials: msRest.ServiceClientCredentials, - options?: Models.ResourceGraphClientOptions - ) { - if (credentials == undefined) { - throw new Error("'credentials' cannot be null."); - } - - if (!options) { - options = {}; - } - if (!options.userAgent) { - const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); - options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; - } - - super(credentials, options); - - this.acceptLanguage = "en-US"; - this.longRunningOperationRetryTimeout = 30; - this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; - this.requestContentType = "application/json; charset=utf-8"; - this.credentials = credentials; - - if (options.acceptLanguage !== null && options.acceptLanguage !== undefined) { - this.acceptLanguage = options.acceptLanguage; - } - if ( - options.longRunningOperationRetryTimeout !== null && - options.longRunningOperationRetryTimeout !== undefined - ) { - this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; - } - } -} diff --git a/sdk/resourcegraph/arm-resourcegraph/test/sampleTest.ts b/sdk/resourcegraph/arm-resourcegraph/test/sampleTest.ts new file mode 100644 index 00000000000..7ed89b043e1 --- /dev/null +++ b/sdk/resourcegraph/arm-resourcegraph/test/sampleTest.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + env, + record, + RecorderEnvironmentSetup, + Recorder +} from "@azure-tools/test-recorder"; +import * as assert from "assert"; + +const recorderEnvSetup: RecorderEnvironmentSetup = { + replaceableVariables: { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" + }, + customizationsOnRecordings: [ + (recording: any): any => + recording.replace( + /"access_token":"[^"]*"/g, + `"access_token":"access_token"` + ) + ], + queryParametersToSkip: [] +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function() { + recorder = record(this, recorderEnvSetup); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/resourcegraph/arm-resourcegraph/tsconfig.json b/sdk/resourcegraph/arm-resourcegraph/tsconfig.json index 422b584abd5..44b2b2faf79 100644 --- a/sdk/resourcegraph/arm-resourcegraph/tsconfig.json +++ b/sdk/resourcegraph/arm-resourcegraph/tsconfig.json @@ -3,7 +3,7 @@ "module": "es6", "moduleResolution": "node", "strict": true, - "target": "es5", + "target": "es6", "sourceMap": true, "declarationMap": true, "esModuleInterop": true, @@ -11,9 +11,10 @@ "forceConsistentCasingInFileNames": true, "lib": ["es6", "dom"], "declaration": true, - "outDir": "./esm", - "importHelpers": true + "outDir": "./dist-esm", + "importHelpers": true, + "paths": { "@azure/arm-resourcegraph": ["./src/index"] } }, - "include": ["./src/**/*.ts"], + "include": ["./src/**/*.ts", "./test/**/*.ts", "samples-dev/**/*.ts"], "exclude": ["node_modules"] } diff --git a/sdk/resourcegraph/ci.yml b/sdk/resourcegraph/ci.yml new file mode 100644 index 00000000000..6561679a0ad --- /dev/null +++ b/sdk/resourcegraph/ci.yml @@ -0,0 +1,30 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/resourcegraph/ + +pr: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/resourcegraph/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: resourcegraph + Artifacts: + - name: azure-arm-resourcegraph + safeName: azurearmresourcegraph + \ No newline at end of file diff --git a/sdk/resourcemover/arm-resourcemover/CHANGELOG.md b/sdk/resourcemover/arm-resourcemover/CHANGELOG.md new file mode 100644 index 00000000000..65e5715b888 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 2.0.0 (2022-01-21) + +The package of @azure/arm-resourcemover is using our next generation design principles since version 2.0.0, which contains breaking changes. + +To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog). + +To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/resourcemover/arm-resourcemover/LICENSE b/sdk/resourcemover/arm-resourcemover/LICENSE new file mode 100644 index 00000000000..5d1d36e0af8 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemover/arm-resourcemover/README.md b/sdk/resourcemover/arm-resourcemover/README.md index aaf1d8881a4..cf6197d7789 100644 --- a/sdk/resourcemover/arm-resourcemover/README.md +++ b/sdk/resourcemover/arm-resourcemover/README.md @@ -1,102 +1,98 @@ -## Azure ResourceMoverServiceAPI SDK for JavaScript +# Azure Resource Mover client library for JavaScript -This package contains an isomorphic SDK for ResourceMoverServiceAPI. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Resource Mover client. + +A first party Azure service orchestrating the move of Azure resources from one Azure region to another or between zones within a region. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcemover/arm-resourcemover) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-resourcemover) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-resourcemover) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started ### Currently supported environments - [LTS versions of Node.js](https://nodejs.org/about/releases/) -- Latest versions of Safari, Chrome, Edge, and Firefox. +- Latest versions of Safari, Chrome, Edge and Firefox. -### How to Install +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-resourcemover` package + +Install the Azure Resource Mover client library for JavaScript with `npm`: ```bash npm install @azure/arm-resourcemover ``` -### How to use +### Create and authenticate a `ResourceMoverServiceAPI` -#### nodejs - client creation and get moveCollections as an example written in TypeScript. +To create a client object to access the Azure Resource Mover API, you will need the `endpoint` of your Azure Resource Mover resource and a `credential`. The Azure Resource Mover client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure Resource Mover resource in the [Azure Portal][azure_portal]. -##### Install @azure/ms-rest-nodeauth +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: -- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`. ```bash -npm install @azure/ms-rest-nodeauth@"^3.0.0" +npm install @azure/identity ``` -##### Sample code +You will also need to **register a new AAD application and grant access to Azure Resource Mover** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. -While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package -```typescript -const msRestNodeAuth = require("@azure/ms-rest-nodeauth"); +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). + +```javascript const { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover"); -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; - -msRestNodeAuth.interactiveLogin().then((creds) => { - const client = new ResourceMoverServiceAPI(creds, subscriptionId); - const resourceGroupName = "testresourceGroupName"; - const moveCollectionName = "testmoveCollectionName"; - client.moveCollections.get(resourceGroupName, moveCollectionName).then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.error(err); -}); +const { DefaultAzureCredential } = require("@azure/identity"); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new ResourceMoverServiceAPI(new DefaultAzureCredential(), subscriptionId); ``` -#### browser - Authentication, client creation and get moveCollections as an example written in JavaScript. -##### Install @azure/ms-rest-browserauth +### 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). -```bash -npm install @azure/ms-rest-browserauth +## Key concepts + +### ResourceMoverServiceAPI + +`ResourceMoverServiceAPI` is the primary interface for developers using the Azure Resource Mover client library. Explore the methods on this client object to understand the different features of the Azure Resource Mover 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"); ``` -##### Sample code +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). -See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. +## Next steps -- index.html -```html - - - - @azure/arm-resourcemover sample - - - - - - - - -``` +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. ## Related projects -- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/resourcemover/arm-resourcemover/README.png) +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fresourcemover%2Farm-resourcemover%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/resourcemover/arm-resourcemover/_meta.json b/sdk/resourcemover/arm-resourcemover/_meta.json new file mode 100644 index 00000000000..c3f6f1a2fe1 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/_meta.json @@ -0,0 +1,7 @@ +{ + "commit": "f9a6cb686bcc0f1b23761db19f2491c5c4df95cb", + "readme": "specification/resourcemover/resource-manager/readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/resourcemover/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20220114.1 --generate-sample=true", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "use": "@autorest/typescript@6.0.0-alpha.16.20220114.1" +} \ No newline at end of file diff --git a/sdk/resourcemover/arm-resourcemover/api-extractor.json b/sdk/resourcemover/arm-resourcemover/api-extractor.json new file mode 100644 index 00000000000..7022314fabc --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-resourcemover.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/resourcemover/arm-resourcemover/package.json b/sdk/resourcemover/arm-resourcemover/package.json index 08acdd8be90..15b4224ecdd 100644 --- a/sdk/resourcemover/arm-resourcemover/package.json +++ b/sdk/resourcemover/arm-resourcemover/package.json @@ -1,58 +1,103 @@ { "name": "@azure/arm-resourcemover", + "sdk-type": "mgmt", "author": "Microsoft Corporation", - "description": "ResourceMoverServiceAPI Library with typescript type definitions for node.js and browser.", - "version": "1.0.0", + "description": "A generated SDK for ResourceMoverServiceAPI.", + "version": "2.0.0", + "engines": { "node": ">=12.0.0" }, "dependencies": { - "@azure/ms-rest-azure-js": "^2.0.1", - "@azure/ms-rest-js": "^2.0.4", - "tslib": "^1.10.0" + "@azure/core-lro": "^2.2.0", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.1.0", + "tslib": "^2.2.0" }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], + "keywords": ["node", "azure", "typescript", "browser", "isomorphic"], "license": "MIT", - "main": "./dist/arm-resourcemover.js", - "module": "./esm/resourceMoverServiceAPI.js", - "types": "./esm/resourceMoverServiceAPI.d.ts", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-resourcemover.d.ts", "devDependencies": { - "typescript": "^3.5.3", - "rollup": "^1.18.0", - "rollup-plugin-node-resolve": "^5.2.0", + "@microsoft/api-extractor": "^7.18.11", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "mkdirp": "^1.0.4", + "rollup": "^1.16.3", "rollup-plugin-sourcemaps": "^0.4.2", - "uglify-js": "^3.6.0" + "typescript": "~4.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^1.0.0", + "mocha": "^7.1.1", + "cross-env": "^7.0.2" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcemover/arm-resourcemover", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" }, - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, + "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, "files": [ "dist/**/*.js", "dist/**/*.js.map", "dist/**/*.d.ts", "dist/**/*.d.ts.map", - "esm/**/*.js", - "esm/**/*.js.map", - "esm/**/*.d.ts", - "esm/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", "src/**/*.ts", "README.md", + "LICENSE", "rollup.config.js", - "tsconfig.json" + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" ], "scripts": { - "build": "tsc && rollup -c rollup.config.js && npm run minify", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-resourcemover.js.map'\" -o ./dist/arm-resourcemover.min.js ./dist/arm-resourcemover.js", - "prepack": "npm install && npm run build" + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" }, "sideEffects": false, - "autoPublish": true + "//metadata": { + "constantPaths": [ + { "path": "src/ResourceMoverServiceAPI.ts", "prefix": "packageDetails" } + ] + }, + "autoPublish": true, + "//sampleConfiguration": { + "productName": "", + "productSlugs": ["azure"], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-resourcemover?view=azure-node-preview" + } } diff --git a/sdk/resourcemover/arm-resourcemover/recordings/node/my_test/recording_sample_test.js b/sdk/resourcemover/arm-resourcemover/recordings/node/my_test/recording_sample_test.js new file mode 100644 index 00000000000..0f6ecb857ac --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/recordings/node/my_test/recording_sample_test.js @@ -0,0 +1,5 @@ +let nock = require('nock'); + +module.exports.hash = "7a6be38bb8cb644d64b4094802301751"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} diff --git a/sdk/resourcemover/arm-resourcemover/review/arm-resourcemover.api.md b/sdk/resourcemover/arm-resourcemover/review/arm-resourcemover.api.md new file mode 100644 index 00000000000..afe95857079 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/review/arm-resourcemover.api.md @@ -0,0 +1,946 @@ +## API Report File for "@azure/arm-resourcemover" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { PollOperationState } from '@azure/core-lro'; + +// @public +export interface AffectedMoveResource { + readonly id?: string; + readonly moveResources?: AffectedMoveResource[]; + readonly sourceId?: string; +} + +// @public +export interface AutomaticResolutionProperties { + moveResourceId?: string; +} + +// @public +export type AvailabilitySetResourceSettings = ResourceSettings & { + resourceType: "Microsoft.Compute/availabilitySets"; + tags?: { + [propertyName: string]: string; + }; + faultDomain?: number; + updateDomain?: number; +}; + +// @public +export interface AzureResourceReference { + sourceArmResourceId: string; +} + +// @public +export interface BulkRemoveRequest { + moveResourceInputType?: MoveResourceInputType; + moveResources?: string[]; + validateOnly?: boolean; +} + +// @public +export interface CloudError { + error?: CloudErrorBody; +} + +// @public +export interface CloudErrorBody { + code?: string; + details?: CloudErrorBody[]; + message?: string; + target?: string; +} + +// @public +export interface CommitRequest { + moveResourceInputType?: MoveResourceInputType; + moveResources: string[]; + validateOnly?: boolean; +} + +// @public +export type CreatedByType = string; + +// @public +export type DependencyLevel = string; + +// @public +export type DependencyType = string; + +// @public +export interface DiscardRequest { + moveResourceInputType?: MoveResourceInputType; + moveResources: string[]; + validateOnly?: boolean; +} + +// @public +export type DiskEncryptionSetResourceSettings = ResourceSettings & { + resourceType: "Microsoft.Compute/diskEncryptionSets"; +}; + +// @public +export interface Display { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public +export interface Identity { + principalId?: string; + tenantId?: string; + type?: ResourceIdentityType; +} + +// @public +export type JobName = string; + +// @public +export interface JobStatus { + readonly jobName?: JobName; + readonly jobProgress?: string; +} + +// @public +export type KeyVaultResourceSettings = ResourceSettings & { + resourceType: "Microsoft.KeyVault/vaults"; +}; + +// @public +export enum KnownCreatedByType { + // (undocumented) + Application = "Application", + // (undocumented) + Key = "Key", + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + User = "User" +} + +// @public +export enum KnownDependencyLevel { + // (undocumented) + Descendant = "Descendant", + // (undocumented) + Direct = "Direct" +} + +// @public +export enum KnownDependencyType { + // (undocumented) + RequiredForMove = "RequiredForMove", + // (undocumented) + RequiredForPrepare = "RequiredForPrepare" +} + +// @public +export enum KnownJobName { + // (undocumented) + InitialSync = "InitialSync" +} + +// @public +export enum KnownMoveResourceInputType { + // (undocumented) + MoveResourceId = "MoveResourceId", + // (undocumented) + MoveResourceSourceId = "MoveResourceSourceId" +} + +// @public +export enum KnownMoveState { + // (undocumented) + AssignmentPending = "AssignmentPending", + // (undocumented) + CommitFailed = "CommitFailed", + // (undocumented) + CommitInProgress = "CommitInProgress", + // (undocumented) + CommitPending = "CommitPending", + // (undocumented) + Committed = "Committed", + // (undocumented) + DeleteSourcePending = "DeleteSourcePending", + // (undocumented) + DiscardFailed = "DiscardFailed", + // (undocumented) + DiscardInProgress = "DiscardInProgress", + // (undocumented) + MoveFailed = "MoveFailed", + // (undocumented) + MoveInProgress = "MoveInProgress", + // (undocumented) + MovePending = "MovePending", + // (undocumented) + PrepareFailed = "PrepareFailed", + // (undocumented) + PrepareInProgress = "PrepareInProgress", + // (undocumented) + PreparePending = "PreparePending", + // (undocumented) + ResourceMoveCompleted = "ResourceMoveCompleted" +} + +// @public +export enum KnownProvisioningState { + // (undocumented) + Creating = "Creating", + // (undocumented) + Failed = "Failed", + // (undocumented) + Succeeded = "Succeeded", + // (undocumented) + Updating = "Updating" +} + +// @public +export enum KnownResolutionType { + // (undocumented) + Automatic = "Automatic", + // (undocumented) + Manual = "Manual" +} + +// @public +export enum KnownResourceIdentityType { + // (undocumented) + None = "None", + // (undocumented) + SystemAssigned = "SystemAssigned", + // (undocumented) + UserAssigned = "UserAssigned" +} + +// @public +export enum KnownTargetAvailabilityZone { + // (undocumented) + NA = "NA", + // (undocumented) + One = "1", + // (undocumented) + Three = "3", + // (undocumented) + Two = "2" +} + +// @public +export enum KnownZoneRedundant { + // (undocumented) + Disable = "Disable", + // (undocumented) + Enable = "Enable" +} + +// @public +export interface LBBackendAddressPoolResourceSettings { + name?: string; +} + +// @public +export interface LBFrontendIPConfigurationResourceSettings { + name?: string; + privateIpAddress?: string; + privateIpAllocationMethod?: string; + subnet?: SubnetReference; + zones?: string; +} + +// @public +export type LoadBalancerBackendAddressPoolReference = ProxyResourceReference & {}; + +// @public +export type LoadBalancerNatRuleReference = ProxyResourceReference & {}; + +// @public +export type LoadBalancerResourceSettings = ResourceSettings & { + resourceType: "Microsoft.Network/loadBalancers"; + tags?: { + [propertyName: string]: string; + }; + sku?: string; + frontendIPConfigurations?: LBFrontendIPConfigurationResourceSettings[]; + backendAddressPools?: LBBackendAddressPoolResourceSettings[]; + zones?: string; +}; + +// @public +export interface ManualResolutionProperties { + targetId?: string; +} + +// @public +export interface MoveCollection { + readonly etag?: string; + readonly id?: string; + identity?: Identity; + location?: string; + readonly name?: string; + properties?: MoveCollectionProperties; + readonly systemData?: SystemData; + tags?: { + [propertyName: string]: string; + }; + readonly type?: string; +} + +// @public +export interface MoveCollectionProperties { + readonly errors?: MoveCollectionPropertiesErrors; + readonly provisioningState?: ProvisioningState; + sourceRegion: string; + targetRegion: string; +} + +// @public +export type MoveCollectionPropertiesErrors = MoveResourceError & {}; + +// @public +export interface MoveCollectionResultList { + nextLink?: string; + value?: MoveCollection[]; +} + +// @public +export interface MoveCollections { + beginBulkRemove(resourceGroupName: string, moveCollectionName: string, options?: MoveCollectionsBulkRemoveOptionalParams): Promise, MoveCollectionsBulkRemoveResponse>>; + beginBulkRemoveAndWait(resourceGroupName: string, moveCollectionName: string, options?: MoveCollectionsBulkRemoveOptionalParams): Promise; + beginCommit(resourceGroupName: string, moveCollectionName: string, options?: MoveCollectionsCommitOptionalParams): Promise, MoveCollectionsCommitResponse>>; + beginCommitAndWait(resourceGroupName: string, moveCollectionName: string, options?: MoveCollectionsCommitOptionalParams): Promise; + beginDelete(resourceGroupName: string, moveCollectionName: string, options?: MoveCollectionsDeleteOptionalParams): Promise, MoveCollectionsDeleteResponse>>; + beginDeleteAndWait(resourceGroupName: string, moveCollectionName: string, options?: MoveCollectionsDeleteOptionalParams): Promise; + beginDiscard(resourceGroupName: string, moveCollectionName: string, options?: MoveCollectionsDiscardOptionalParams): Promise, MoveCollectionsDiscardResponse>>; + beginDiscardAndWait(resourceGroupName: string, moveCollectionName: string, options?: MoveCollectionsDiscardOptionalParams): Promise; + beginInitiateMove(resourceGroupName: string, moveCollectionName: string, options?: MoveCollectionsInitiateMoveOptionalParams): Promise, MoveCollectionsInitiateMoveResponse>>; + beginInitiateMoveAndWait(resourceGroupName: string, moveCollectionName: string, options?: MoveCollectionsInitiateMoveOptionalParams): Promise; + beginPrepare(resourceGroupName: string, moveCollectionName: string, options?: MoveCollectionsPrepareOptionalParams): Promise, MoveCollectionsPrepareResponse>>; + beginPrepareAndWait(resourceGroupName: string, moveCollectionName: string, options?: MoveCollectionsPrepareOptionalParams): Promise; + beginResolveDependencies(resourceGroupName: string, moveCollectionName: string, options?: MoveCollectionsResolveDependenciesOptionalParams): Promise, MoveCollectionsResolveDependenciesResponse>>; + beginResolveDependenciesAndWait(resourceGroupName: string, moveCollectionName: string, options?: MoveCollectionsResolveDependenciesOptionalParams): Promise; + create(resourceGroupName: string, moveCollectionName: string, options?: MoveCollectionsCreateOptionalParams): Promise; + get(resourceGroupName: string, moveCollectionName: string, options?: MoveCollectionsGetOptionalParams): Promise; + listMoveCollectionsByResourceGroup(resourceGroupName: string, options?: MoveCollectionsListMoveCollectionsByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listMoveCollectionsBySubscription(options?: MoveCollectionsListMoveCollectionsBySubscriptionOptionalParams): PagedAsyncIterableIterator; + listRequiredFor(resourceGroupName: string, moveCollectionName: string, sourceId: string, options?: MoveCollectionsListRequiredForOptionalParams): Promise; + update(resourceGroupName: string, moveCollectionName: string, options?: MoveCollectionsUpdateOptionalParams): Promise; +} + +// @public +export interface MoveCollectionsBulkRemoveOptionalParams extends coreClient.OperationOptions { + body?: BulkRemoveRequest; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type MoveCollectionsBulkRemoveResponse = OperationStatus; + +// @public +export interface MoveCollectionsCommitOptionalParams extends coreClient.OperationOptions { + body?: CommitRequest; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type MoveCollectionsCommitResponse = OperationStatus; + +// @public +export interface MoveCollectionsCreateOptionalParams extends coreClient.OperationOptions { + body?: MoveCollection; +} + +// @public +export type MoveCollectionsCreateResponse = MoveCollection; + +// @public +export interface MoveCollectionsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type MoveCollectionsDeleteResponse = OperationStatus; + +// @public +export interface MoveCollectionsDiscardOptionalParams extends coreClient.OperationOptions { + body?: DiscardRequest; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type MoveCollectionsDiscardResponse = OperationStatus; + +// @public +export interface MoveCollectionsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MoveCollectionsGetResponse = MoveCollection; + +// @public +export interface MoveCollectionsInitiateMoveOptionalParams extends coreClient.OperationOptions { + body?: ResourceMoveRequest; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type MoveCollectionsInitiateMoveResponse = OperationStatus; + +// @public +export interface MoveCollectionsListMoveCollectionsByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MoveCollectionsListMoveCollectionsByResourceGroupNextResponse = MoveCollectionResultList; + +// @public +export interface MoveCollectionsListMoveCollectionsByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MoveCollectionsListMoveCollectionsByResourceGroupResponse = MoveCollectionResultList; + +// @public +export interface MoveCollectionsListMoveCollectionsBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MoveCollectionsListMoveCollectionsBySubscriptionNextResponse = MoveCollectionResultList; + +// @public +export interface MoveCollectionsListMoveCollectionsBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MoveCollectionsListMoveCollectionsBySubscriptionResponse = MoveCollectionResultList; + +// @public +export interface MoveCollectionsListRequiredForOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MoveCollectionsListRequiredForResponse = RequiredForResourcesCollection; + +// @public +export interface MoveCollectionsPrepareOptionalParams extends coreClient.OperationOptions { + body?: PrepareRequest; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type MoveCollectionsPrepareResponse = OperationStatus; + +// @public +export interface MoveCollectionsResolveDependenciesOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type MoveCollectionsResolveDependenciesResponse = OperationStatus; + +// @public +export interface MoveCollectionsUpdateOptionalParams extends coreClient.OperationOptions { + body?: UpdateMoveCollectionRequest; +} + +// @public +export type MoveCollectionsUpdateResponse = MoveCollection; + +// @public +export interface MoveErrorInfo { + readonly moveResources?: AffectedMoveResource[]; +} + +// @public +export interface MoveResource { + readonly id?: string; + readonly name?: string; + properties?: MoveResourceProperties; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface MoveResourceCollection { + nextLink?: string; + summaryCollection?: SummaryCollection; + readonly totalCount?: number; + value?: MoveResource[]; +} + +// @public +export interface MoveResourceDependency { + automaticResolution?: AutomaticResolutionProperties; + dependencyType?: DependencyType; + id?: string; + isOptional?: string; + manualResolution?: ManualResolutionProperties; + resolutionStatus?: string; + resolutionType?: ResolutionType; +} + +// @public +export interface MoveResourceDependencyOverride { + id?: string; + targetId?: string; +} + +// @public +export interface MoveResourceError { + properties?: MoveResourceErrorBody; +} + +// @public +export interface MoveResourceErrorBody { + readonly code?: string; + readonly details?: MoveResourceErrorBody[]; + readonly message?: string; + readonly target?: string; +} + +// @public +export interface MoveResourceFilter { + // (undocumented) + properties?: MoveResourceFilterProperties; +} + +// @public (undocumented) +export interface MoveResourceFilterProperties { + provisioningState?: string; +} + +// @public +export type MoveResourceInputType = string; + +// @public +export interface MoveResourceProperties { + readonly dependsOn?: MoveResourceDependency[]; + dependsOnOverrides?: MoveResourceDependencyOverride[]; + readonly errors?: MoveResourcePropertiesErrors; + existingTargetId?: string; + readonly isResolveRequired?: boolean; + readonly moveStatus?: MoveResourcePropertiesMoveStatus; + readonly provisioningState?: ProvisioningState; + resourceSettings?: ResourceSettingsUnion; + sourceId: string; + readonly sourceResourceSettings?: ResourceSettingsUnion; + readonly targetId?: string; +} + +// @public +export type MoveResourcePropertiesErrors = MoveResourceError & {}; + +// @public +export type MoveResourcePropertiesMoveStatus = MoveResourceStatus & {}; + +// @public +export interface MoveResources { + beginCreate(resourceGroupName: string, moveCollectionName: string, moveResourceName: string, options?: MoveResourcesCreateOptionalParams): Promise, MoveResourcesCreateResponse>>; + beginCreateAndWait(resourceGroupName: string, moveCollectionName: string, moveResourceName: string, options?: MoveResourcesCreateOptionalParams): Promise; + beginDelete(resourceGroupName: string, moveCollectionName: string, moveResourceName: string, options?: MoveResourcesDeleteOptionalParams): Promise, MoveResourcesDeleteResponse>>; + beginDeleteAndWait(resourceGroupName: string, moveCollectionName: string, moveResourceName: string, options?: MoveResourcesDeleteOptionalParams): Promise; + get(resourceGroupName: string, moveCollectionName: string, moveResourceName: string, options?: MoveResourcesGetOptionalParams): Promise; + list(resourceGroupName: string, moveCollectionName: string, options?: MoveResourcesListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface MoveResourcesCreateOptionalParams extends coreClient.OperationOptions { + body?: MoveResource; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type MoveResourcesCreateResponse = MoveResource; + +// @public +export interface MoveResourcesDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type MoveResourcesDeleteResponse = OperationStatus; + +// @public +export interface MoveResourcesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MoveResourcesGetResponse = MoveResource; + +// @public +export interface MoveResourcesListNextOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type MoveResourcesListNextResponse = MoveResourceCollection; + +// @public +export interface MoveResourcesListOptionalParams extends coreClient.OperationOptions { + filter?: string; +} + +// @public +export type MoveResourcesListResponse = MoveResourceCollection; + +// @public +export interface MoveResourceStatus { + errors?: MoveResourceError; + jobStatus?: JobStatus; + readonly moveState?: MoveState; +} + +// @public +export type MoveState = string; + +// @public +export type NetworkInterfaceResourceSettings = ResourceSettings & { + resourceType: "Microsoft.Network/networkInterfaces"; + tags?: { + [propertyName: string]: string; + }; + ipConfigurations?: NicIpConfigurationResourceSettings[]; + enableAcceleratedNetworking?: boolean; +}; + +// @public +export type NetworkSecurityGroupResourceSettings = ResourceSettings & { + resourceType: "Microsoft.Network/networkSecurityGroups"; + tags?: { + [propertyName: string]: string; + }; + securityRules?: NsgSecurityRule[]; +}; + +// @public +export interface NicIpConfigurationResourceSettings { + loadBalancerBackendAddressPools?: LoadBalancerBackendAddressPoolReference[]; + loadBalancerNatRules?: LoadBalancerNatRuleReference[]; + name?: string; + primary?: boolean; + privateIpAddress?: string; + privateIpAllocationMethod?: string; + publicIp?: PublicIpReference; + subnet?: SubnetReference; +} + +// @public +export type NsgReference = AzureResourceReference & {}; + +// @public +export interface NsgSecurityRule { + access?: string; + description?: string; + destinationAddressPrefix?: string; + destinationPortRange?: string; + direction?: string; + name?: string; + priority?: number; + protocol?: string; + sourceAddressPrefix?: string; + sourcePortRange?: string; +} + +// @public +export interface OperationErrorAdditionalInfo { + readonly info?: MoveErrorInfo; + readonly type?: string; +} + +// @public +export interface OperationsDiscovery { + display?: Display; + isDataAction?: boolean; + name?: string; + origin?: string; + properties?: Record; +} + +// @public +export interface OperationsDiscoveryCollection { + nextLink?: string; + value?: OperationsDiscovery[]; +} + +// @public +export interface OperationsDiscoveryGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsDiscoveryGetResponse = OperationsDiscoveryCollection; + +// @public +export interface OperationsDiscoveryOperations { + // (undocumented) + get(options?: OperationsDiscoveryGetOptionalParams): Promise; +} + +// @public +export interface OperationStatus { + readonly endTime?: string; + readonly error?: OperationStatusError; + readonly id?: string; + readonly name?: string; + readonly properties?: Record; + readonly startTime?: string; + readonly status?: string; +} + +// @public +export interface OperationStatusError { + readonly additionalInfo?: OperationErrorAdditionalInfo[]; + readonly code?: string; + readonly details?: OperationStatusError[]; + readonly message?: string; +} + +// @public +export interface PrepareRequest { + moveResourceInputType?: MoveResourceInputType; + moveResources: string[]; + validateOnly?: boolean; +} + +// @public +export type ProvisioningState = string; + +// @public +export type ProxyResourceReference = AzureResourceReference & { + name?: string; +}; + +// @public +export type PublicIPAddressResourceSettings = ResourceSettings & { + resourceType: "Microsoft.Network/publicIPAddresses"; + tags?: { + [propertyName: string]: string; + }; + domainNameLabel?: string; + fqdn?: string; + publicIpAllocationMethod?: string; + sku?: string; + zones?: string; +}; + +// @public +export type PublicIpReference = AzureResourceReference & {}; + +// @public +export interface RequiredForResourcesCollection { + sourceIds?: string[]; +} + +// @public +export type ResolutionType = string; + +// @public +export type ResourceGroupResourceSettings = ResourceSettings & { + resourceType: "resourceGroups"; +}; + +// @public +export type ResourceIdentityType = string; + +// @public +export interface ResourceMoveRequest { + moveResourceInputType?: MoveResourceInputType; + moveResources: string[]; + validateOnly?: boolean; +} + +// @public (undocumented) +export class ResourceMoverServiceAPI extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: ResourceMoverServiceAPIOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + moveCollections: MoveCollections; + // (undocumented) + moveResources: MoveResources; + // (undocumented) + operationsDiscoveryOperations: OperationsDiscoveryOperations; + // (undocumented) + subscriptionId: string; + // (undocumented) + unresolvedDependencies: UnresolvedDependencies; +} + +// @public +export interface ResourceMoverServiceAPIOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface ResourceSettings { + resourceType: "Microsoft.Compute/virtualMachines" | "Microsoft.Compute/availabilitySets" | "Microsoft.Network/virtualNetworks" | "Microsoft.Network/networkInterfaces" | "Microsoft.Network/networkSecurityGroups" | "Microsoft.Network/loadBalancers" | "Microsoft.Sql/servers" | "Microsoft.Sql/servers/elasticPools" | "Microsoft.Sql/servers/databases" | "resourceGroups" | "Microsoft.Network/publicIPAddresses" | "Microsoft.KeyVault/vaults" | "Microsoft.Compute/diskEncryptionSets"; + targetResourceName: string; +} + +// @public (undocumented) +export type ResourceSettingsUnion = ResourceSettings | VirtualMachineResourceSettings | AvailabilitySetResourceSettings | VirtualNetworkResourceSettings | NetworkInterfaceResourceSettings | NetworkSecurityGroupResourceSettings | LoadBalancerResourceSettings | SqlServerResourceSettings | SqlElasticPoolResourceSettings | SqlDatabaseResourceSettings | ResourceGroupResourceSettings | PublicIPAddressResourceSettings | KeyVaultResourceSettings | DiskEncryptionSetResourceSettings; + +// @public +export type SqlDatabaseResourceSettings = ResourceSettings & { + resourceType: "Microsoft.Sql/servers/databases"; + tags?: { + [propertyName: string]: string; + }; + zoneRedundant?: ZoneRedundant; +}; + +// @public +export type SqlElasticPoolResourceSettings = ResourceSettings & { + resourceType: "Microsoft.Sql/servers/elasticPools"; + tags?: { + [propertyName: string]: string; + }; + zoneRedundant?: ZoneRedundant; +}; + +// @public +export type SqlServerResourceSettings = ResourceSettings & { + resourceType: "Microsoft.Sql/servers"; +}; + +// @public +export type SubnetReference = ProxyResourceReference & {}; + +// @public +export interface SubnetResourceSettings { + addressPrefix?: string; + name?: string; + networkSecurityGroup?: NsgReference; +} + +// @public +export interface Summary { + count?: number; + item?: string; +} + +// @public +export interface SummaryCollection { + fieldName?: string; + summary?: Summary[]; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export type TargetAvailabilityZone = string; + +// @public +export interface UnresolvedDependencies { + list(resourceGroupName: string, moveCollectionName: string, options?: UnresolvedDependenciesGetOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface UnresolvedDependenciesFilter { + // (undocumented) + properties?: UnresolvedDependenciesFilterProperties; +} + +// @public (undocumented) +export interface UnresolvedDependenciesFilterProperties { + count?: number; +} + +// @public +export interface UnresolvedDependenciesGetNextOptionalParams extends coreClient.OperationOptions { + dependencyLevel?: DependencyLevel; + filter?: string; + orderby?: string; +} + +// @public +export type UnresolvedDependenciesGetNextResponse = UnresolvedDependencyCollection; + +// @public +export interface UnresolvedDependenciesGetOptionalParams extends coreClient.OperationOptions { + dependencyLevel?: DependencyLevel; + filter?: string; + orderby?: string; +} + +// @public +export type UnresolvedDependenciesGetResponse = UnresolvedDependencyCollection; + +// @public +export interface UnresolvedDependency { + count?: number; + id?: string; +} + +// @public +export interface UnresolvedDependencyCollection { + nextLink?: string; + readonly summaryCollection?: SummaryCollection; + readonly totalCount?: number; + value?: UnresolvedDependency[]; +} + +// @public +export interface UpdateMoveCollectionRequest { + identity?: Identity; + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export type VirtualMachineResourceSettings = ResourceSettings & { + resourceType: "Microsoft.Compute/virtualMachines"; + tags?: { + [propertyName: string]: string; + }; + userManagedIdentities?: string[]; + targetAvailabilityZone?: TargetAvailabilityZone; + targetVmSize?: string; + targetAvailabilitySetId?: string; +}; + +// @public +export type VirtualNetworkResourceSettings = ResourceSettings & { + resourceType: "Microsoft.Network/virtualNetworks"; + tags?: { + [propertyName: string]: string; + }; + enableDdosProtection?: boolean; + addressSpace?: string[]; + dnsServers?: string[]; + subnets?: SubnetResourceSettings[]; +}; + +// @public +export type ZoneRedundant = string; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/resourcemover/arm-resourcemover/rollup.config.js b/sdk/resourcemover/arm-resourcemover/rollup.config.js index 91c34496930..9be1955eb7f 100644 --- a/sdk/resourcemover/arm-resourcemover/rollup.config.js +++ b/sdk/resourcemover/arm-resourcemover/rollup.config.js @@ -1,37 +1,188 @@ -import rollup from "rollup"; -import nodeResolve from "rollup-plugin-node-resolve"; -import sourcemaps from "rollup-plugin-sourcemaps"; - -/** - * @type {rollup.RollupFileOptions} - */ -const config = { - input: "./esm/resourceMoverServiceAPI.js", - external: [ - "@azure/ms-rest-js", - "@azure/ms-rest-azure-js" - ], - output: { - file: "./dist/arm-resourcemover.js", - format: "umd", - name: "Azure.ArmResourcemover", - sourcemap: true, - globals: { - "@azure/ms-rest-js": "msRest", - "@azure/ms-rest-azure-js": "msRestAzure" - }, - banner: `/* +/* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */` - }, - plugins: [ - nodeResolve({ mainFields: ['module', 'main'] }), - sourcemaps() - ] + */ + +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"; + +/** + * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. + * + * NOTE: this manual configuration is only needed because OpenTelemetry uses an + * __exportStar downleveled helper function to declare its exports which confuses + * rollup's automatic discovery mechanism. + * + * @returns an object reference that can be `...`'d into your cjs() configuration. + */ +export function openTelemetryCommonJs() { + const namedExports = {}; + + for (const key of [ + "@opentelemetry/api", + "@azure/core-tracing/node_modules/@opentelemetry/api" + ]) { + namedExports[key] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "SpanStatusCode", + "getSpanContext", + "setSpanContext" + ]; + } + + const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; + + for (const version of releasedOpenTelemetryVersions) { + namedExports[ + // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. + `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` + ] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "StatusCode", + "CanonicalCode", + "getSpanContext", + "setSpanContext" + ]; + } + + return namedExports; +} + +// #region Warning Handler + +/** + * A function that can determine whether a rollupwarning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEvalWarnings(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependencyWarnings(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ + ignoreChaiCircularDependencyWarnings, + ignoreNiseSinonEvalWarnings +]; + +/** + * 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({ + namedExports: { + // Chai's strange internal architecture makes it impossible to statically + // analyze its exports. + chai: [ + "version", + "use", + "util", + "config", + "expect", + "should", + "assert" + ], + ...openTelemetryCommonJs() + } + }), + 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 default config; +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(), cjs()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/resourcemover/arm-resourcemover/sample.env b/sdk/resourcemover/arm-resourcemover/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsBulkRemove.ts b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsBulkRemove.ts new file mode 100644 index 00000000000..162cee76fda --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsBulkRemove.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Removes the set of move resources included in the request body from move collection. The orchestration is done by service. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * + * @summary Removes the set of move resources included in the request body from move collection. The orchestration is done by service. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_BulkRemove.json + */ +import { + BulkRemoveRequest, + ResourceMoverServiceAPI +} from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsBulkRemove() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const body: BulkRemoveRequest = { + moveResources: [ + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1" + ], + validateOnly: false + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.beginBulkRemoveAndWait( + resourceGroupName, + moveCollectionName, + options + ); + console.log(result); +} + +moveCollectionsBulkRemove().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsCommit.ts b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsCommit.ts new file mode 100644 index 00000000000..1f65f4288d7 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsCommit.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Commits the set of resources included in the request body. The commit operation is triggered on the moveResources in the moveState 'CommitPending' or 'CommitFailed', on a successful completion the moveResource moveState do a transition to Committed. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * + * @summary Commits the set of resources included in the request body. The commit operation is triggered on the moveResources in the moveState 'CommitPending' or 'CommitFailed', on a successful completion the moveResource moveState do a transition to Committed. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Commit.json + */ +import { + CommitRequest, + ResourceMoverServiceAPI +} from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsCommit() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const body: CommitRequest = { + moveResources: [ + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1" + ], + validateOnly: false + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.beginCommitAndWait( + resourceGroupName, + moveCollectionName, + options + ); + console.log(result); +} + +moveCollectionsCommit().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsCreate.ts b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsCreate.ts new file mode 100644 index 00000000000..15f8031ce53 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsCreate.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a move collection. + * + * @summary Creates or updates a move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Create.json + */ +import { + MoveCollection, + ResourceMoverServiceAPI +} from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsCreate() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const body: MoveCollection = { + identity: { type: "SystemAssigned" }, + location: "eastus2", + properties: { sourceRegion: "eastus", targetRegion: "westus" } + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.create( + resourceGroupName, + moveCollectionName, + options + ); + console.log(result); +} + +moveCollectionsCreate().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsDelete.ts b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsDelete.ts new file mode 100644 index 00000000000..ab25a8802b7 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsDelete.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Deletes a move collection. + * + * @summary Deletes a move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Delete.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsDelete() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.beginDeleteAndWait( + resourceGroupName, + moveCollectionName + ); + console.log(result); +} + +moveCollectionsDelete().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsDiscard.ts b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsDiscard.ts new file mode 100644 index 00000000000..fa35a1c52be --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsDiscard.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Discards the set of resources included in the request body. The discard operation is triggered on the moveResources in the moveState 'CommitPending' or 'DiscardFailed', on a successful completion the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * + * @summary Discards the set of resources included in the request body. The discard operation is triggered on the moveResources in the moveState 'CommitPending' or 'DiscardFailed', on a successful completion the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Discard.json + */ +import { + DiscardRequest, + ResourceMoverServiceAPI +} from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsDiscard() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const body: DiscardRequest = { + moveResources: [ + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1" + ], + validateOnly: false + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.beginDiscardAndWait( + resourceGroupName, + moveCollectionName, + options + ); + console.log(result); +} + +moveCollectionsDiscard().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsGet.ts b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsGet.ts new file mode 100644 index 00000000000..8c636e0b823 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsGet.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets the move collection. + * + * @summary Gets the move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Get.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsGet() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.get( + resourceGroupName, + moveCollectionName + ); + console.log(result); +} + +moveCollectionsGet().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsInitiateMove.ts b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsInitiateMove.ts new file mode 100644 index 00000000000..f66f6294026 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsInitiateMove.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Moves the set of resources included in the request body. The move operation is triggered after the moveResources are in the moveState 'MovePending' or 'MoveFailed', on a successful completion the moveResource moveState do a transition to CommitPending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * + * @summary Moves the set of resources included in the request body. The move operation is triggered after the moveResources are in the moveState 'MovePending' or 'MoveFailed', on a successful completion the moveResource moveState do a transition to CommitPending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_InitiateMove.json + */ +import { + ResourceMoveRequest, + ResourceMoverServiceAPI +} from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsInitiateMove() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const body: ResourceMoveRequest = { + moveResources: [ + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1" + ], + validateOnly: false + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.beginInitiateMoveAndWait( + resourceGroupName, + moveCollectionName, + options + ); + console.log(result); +} + +moveCollectionsInitiateMove().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsListMoveCollectionsByResourceGroup.ts b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsListMoveCollectionsByResourceGroup.ts new file mode 100644 index 00000000000..ba3c9844e6a --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsListMoveCollectionsByResourceGroup.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get all the Move Collections in the resource group. + * + * @summary Get all the Move Collections in the resource group. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_ListMoveCollectionsByResourceGroup.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsListMoveCollectionsByResourceGroup() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.moveCollections.listMoveCollectionsByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +moveCollectionsListMoveCollectionsByResourceGroup().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsListMoveCollectionsBySubscription.ts b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsListMoveCollectionsBySubscription.ts new file mode 100644 index 00000000000..e2d5704bcc3 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsListMoveCollectionsBySubscription.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get all the Move Collections in the subscription. + * + * @summary Get all the Move Collections in the subscription. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_ListMoveCollectionsBySubscription.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsListMoveCollectionsBySubscription() { + const subscriptionId = "subid"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.moveCollections.listMoveCollectionsBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +moveCollectionsListMoveCollectionsBySubscription().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsPrepare.ts b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsPrepare.ts new file mode 100644 index 00000000000..a2529e49891 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsPrepare.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Initiates prepare for the set of resources included in the request body. The prepare operation is on the moveResources that are in the moveState 'PreparePending' or 'PrepareFailed', on a successful completion the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * + * @summary Initiates prepare for the set of resources included in the request body. The prepare operation is on the moveResources that are in the moveState 'PreparePending' or 'PrepareFailed', on a successful completion the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Prepare.json + */ +import { + PrepareRequest, + ResourceMoverServiceAPI +} from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsPrepare() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const body: PrepareRequest = { + moveResources: [ + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1" + ], + validateOnly: false + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.beginPrepareAndWait( + resourceGroupName, + moveCollectionName, + options + ); + console.log(result); +} + +moveCollectionsPrepare().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsResolveDependencies.ts b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsResolveDependencies.ts new file mode 100644 index 00000000000..b7b84d76317 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsResolveDependencies.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Computes, resolves and validate the dependencies of the moveResources in the move collection. + * + * @summary Computes, resolves and validate the dependencies of the moveResources in the move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_ResolveDependencies.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsResolveDependencies() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.beginResolveDependenciesAndWait( + resourceGroupName, + moveCollectionName + ); + console.log(result); +} + +moveCollectionsResolveDependencies().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsUpdate.ts b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsUpdate.ts new file mode 100644 index 00000000000..6a98d41daf3 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples-dev/moveCollectionsUpdate.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Updates a move collection. + * + * @summary Updates a move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Update.json + */ +import { + UpdateMoveCollectionRequest, + ResourceMoverServiceAPI +} from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsUpdate() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const body: UpdateMoveCollectionRequest = { + identity: { type: "SystemAssigned" }, + tags: { key1: "mc1" } + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.update( + resourceGroupName, + moveCollectionName, + options + ); + console.log(result); +} + +moveCollectionsUpdate().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples-dev/moveResourcesCreate.ts b/sdk/resourcemover/arm-resourcemover/samples-dev/moveResourcesCreate.ts new file mode 100644 index 00000000000..c30e89b2992 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples-dev/moveResourcesCreate.ts @@ -0,0 +1,65 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a Move Resource in the move collection. + * + * @summary Creates or updates a Move Resource in the move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_Create.json + */ +import { + MoveResource, + ResourceMoverServiceAPI +} from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveResourcesCreate() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const moveResourceName = "moveresourcename1"; + const body: MoveResource = { + properties: { + dependsOnOverrides: [ + { + id: + "/subscriptions/c4488a3f-a7f7-4ad4-aa72-0e1f4d9c0756/resourceGroups/eastusRG/providers/Microsoft.Network/networkInterfaces/eastusvm140", + targetId: + "/subscriptions/c4488a3f-a7f7-4ad4-aa72-0e1f4d9c0756/resourceGroups/westusRG/providers/Microsoft.Network/networkInterfaces/eastusvm140" + } + ], + resourceSettings: { + resourceType: "Microsoft.Compute/virtualMachines", + targetAvailabilitySetId: + "/subscriptions/subid/resourceGroups/eastusRG/providers/Microsoft.Compute/availabilitySets/avset1", + targetAvailabilityZone: "2", + targetResourceName: "westusvm1", + targetVmSize: undefined, + userManagedIdentities: [ + "/subscriptions/subid/resourceGroups/eastusRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/umi1" + ] + }, + sourceId: + "/subscriptions/subid/resourceGroups/eastusRG/providers/Microsoft.Compute/virtualMachines/eastusvm1" + } + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveResources.beginCreateAndWait( + resourceGroupName, + moveCollectionName, + moveResourceName, + options + ); + console.log(result); +} + +moveResourcesCreate().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples-dev/moveResourcesDelete.ts b/sdk/resourcemover/arm-resourcemover/samples-dev/moveResourcesDelete.ts new file mode 100644 index 00000000000..e30243b61d2 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples-dev/moveResourcesDelete.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Deletes a Move Resource from the move collection. + * + * @summary Deletes a Move Resource from the move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_Delete.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveResourcesDelete() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const moveResourceName = "moveresourcename1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveResources.beginDeleteAndWait( + resourceGroupName, + moveCollectionName, + moveResourceName + ); + console.log(result); +} + +moveResourcesDelete().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples-dev/moveResourcesGet.ts b/sdk/resourcemover/arm-resourcemover/samples-dev/moveResourcesGet.ts new file mode 100644 index 00000000000..d64c813dee5 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples-dev/moveResourcesGet.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets the Move Resource. + * + * @summary Gets the Move Resource. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_Get.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveResourcesGet() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const moveResourceName = "moveresourcename1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveResources.get( + resourceGroupName, + moveCollectionName, + moveResourceName + ); + console.log(result); +} + +moveResourcesGet().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples-dev/moveResourcesList.ts b/sdk/resourcemover/arm-resourcemover/samples-dev/moveResourcesList.ts new file mode 100644 index 00000000000..ec8451052c5 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples-dev/moveResourcesList.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Lists the Move Resources in the move collection. + * + * @summary Lists the Move Resources in the move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_List.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveResourcesList() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.moveResources.list( + resourceGroupName, + moveCollectionName + )) { + resArray.push(item); + } + console.log(resArray); +} + +moveResourcesList().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples-dev/operationsDiscoveryGet.ts b/sdk/resourcemover/arm-resourcemover/samples-dev/operationsDiscoveryGet.ts new file mode 100644 index 00000000000..f8ff84086eb --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples-dev/operationsDiscoveryGet.ts @@ -0,0 +1,28 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/OperationsDiscovery_Get.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function operationsDiscoveryGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.operationsDiscoveryOperations.get(); + console.log(result); +} + +operationsDiscoveryGet().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples-dev/requiredForGet.ts b/sdk/resourcemover/arm-resourcemover/samples-dev/requiredForGet.ts new file mode 100644 index 00000000000..ddd30e96c0a --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples-dev/requiredForGet.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List of the move resources for which an arm resource is required for. + * + * @summary List of the move resources for which an arm resource is required for. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/RequiredFor_Get.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function requiredForGet() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const sourceId = + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/nic1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.listRequiredFor( + resourceGroupName, + moveCollectionName, + sourceId + ); + console.log(result); +} + +requiredForGet().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples-dev/unresolvedDependenciesGet.ts b/sdk/resourcemover/arm-resourcemover/samples-dev/unresolvedDependenciesGet.ts new file mode 100644 index 00000000000..21b29851fe0 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples-dev/unresolvedDependenciesGet.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets a list of unresolved dependencies. + * + * @summary Gets a list of unresolved dependencies. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/UnresolvedDependencies_Get.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function unresolvedDependenciesGet() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.unresolvedDependencies.list( + resourceGroupName, + moveCollectionName + )) { + resArray.push(item); + } + console.log(resArray); +} + +unresolvedDependenciesGet().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/README.md b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/README.md new file mode 100644 index 00000000000..0ade74385f6 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/README.md @@ -0,0 +1,86 @@ +# client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [moveCollectionsBulkRemove.js][movecollectionsbulkremove] | Removes the set of move resources included in the request body from move collection. The orchestration is done by service. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_BulkRemove.json | +| [moveCollectionsCommit.js][movecollectionscommit] | Commits the set of resources included in the request body. The commit operation is triggered on the moveResources in the moveState 'CommitPending' or 'CommitFailed', on a successful completion the moveResource moveState do a transition to Committed. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Commit.json | +| [moveCollectionsCreate.js][movecollectionscreate] | Creates or updates a move collection. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Create.json | +| [moveCollectionsDelete.js][movecollectionsdelete] | Deletes a move collection. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Delete.json | +| [moveCollectionsDiscard.js][movecollectionsdiscard] | Discards the set of resources included in the request body. The discard operation is triggered on the moveResources in the moveState 'CommitPending' or 'DiscardFailed', on a successful completion the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Discard.json | +| [moveCollectionsGet.js][movecollectionsget] | Gets the move collection. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Get.json | +| [moveCollectionsInitiateMove.js][movecollectionsinitiatemove] | Moves the set of resources included in the request body. The move operation is triggered after the moveResources are in the moveState 'MovePending' or 'MoveFailed', on a successful completion the moveResource moveState do a transition to CommitPending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_InitiateMove.json | +| [moveCollectionsListMoveCollectionsByResourceGroup.js][movecollectionslistmovecollectionsbyresourcegroup] | Get all the Move Collections in the resource group. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_ListMoveCollectionsByResourceGroup.json | +| [moveCollectionsListMoveCollectionsBySubscription.js][movecollectionslistmovecollectionsbysubscription] | Get all the Move Collections in the subscription. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_ListMoveCollectionsBySubscription.json | +| [moveCollectionsPrepare.js][movecollectionsprepare] | Initiates prepare for the set of resources included in the request body. The prepare operation is on the moveResources that are in the moveState 'PreparePending' or 'PrepareFailed', on a successful completion the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Prepare.json | +| [moveCollectionsResolveDependencies.js][movecollectionsresolvedependencies] | Computes, resolves and validate the dependencies of the moveResources in the move collection. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_ResolveDependencies.json | +| [moveCollectionsUpdate.js][movecollectionsupdate] | Updates a move collection. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Update.json | +| [moveResourcesCreate.js][moveresourcescreate] | Creates or updates a Move Resource in the move collection. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_Create.json | +| [moveResourcesDelete.js][moveresourcesdelete] | Deletes a Move Resource from the move collection. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_Delete.json | +| [moveResourcesGet.js][moveresourcesget] | Gets the Move Resource. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_Get.json | +| [moveResourcesList.js][moveresourceslist] | Lists the Move Resources in the move collection. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_List.json | +| [operationsDiscoveryGet.js][operationsdiscoveryget] | x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/OperationsDiscovery_Get.json | +| [requiredForGet.js][requiredforget] | List of the move resources for which an arm resource is required for. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/RequiredFor_Get.json | +| [unresolvedDependenciesGet.js][unresolveddependenciesget] | Gets a list of unresolved dependencies. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/UnresolvedDependencies_Get.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node moveCollectionsBulkRemove.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node moveCollectionsBulkRemove.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[movecollectionsbulkremove]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsBulkRemove.js +[movecollectionscommit]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsCommit.js +[movecollectionscreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsCreate.js +[movecollectionsdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsDelete.js +[movecollectionsdiscard]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsDiscard.js +[movecollectionsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsGet.js +[movecollectionsinitiatemove]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsInitiateMove.js +[movecollectionslistmovecollectionsbyresourcegroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsListMoveCollectionsByResourceGroup.js +[movecollectionslistmovecollectionsbysubscription]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsListMoveCollectionsBySubscription.js +[movecollectionsprepare]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsPrepare.js +[movecollectionsresolvedependencies]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsResolveDependencies.js +[movecollectionsupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsUpdate.js +[moveresourcescreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveResourcesCreate.js +[moveresourcesdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveResourcesDelete.js +[moveresourcesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveResourcesGet.js +[moveresourceslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveResourcesList.js +[operationsdiscoveryget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/operationsDiscoveryGet.js +[requiredforget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/requiredForGet.js +[unresolveddependenciesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/unresolvedDependenciesGet.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-resourcemover?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcemover/arm-resourcemover/README.md diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsBulkRemove.js b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsBulkRemove.js new file mode 100644 index 00000000000..79e4706c5e7 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsBulkRemove.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Removes the set of move resources included in the request body from move collection. The orchestration is done by service. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * + * @summary Removes the set of move resources included in the request body from move collection. The orchestration is done by service. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_BulkRemove.json + */ +const { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function moveCollectionsBulkRemove() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const body = { + moveResources: [ + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1", + ], + validateOnly: false, + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.beginBulkRemoveAndWait( + resourceGroupName, + moveCollectionName, + options + ); + console.log(result); +} + +moveCollectionsBulkRemove().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsCommit.js b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsCommit.js new file mode 100644 index 00000000000..2ee6896edea --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsCommit.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Commits the set of resources included in the request body. The commit operation is triggered on the moveResources in the moveState 'CommitPending' or 'CommitFailed', on a successful completion the moveResource moveState do a transition to Committed. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * + * @summary Commits the set of resources included in the request body. The commit operation is triggered on the moveResources in the moveState 'CommitPending' or 'CommitFailed', on a successful completion the moveResource moveState do a transition to Committed. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Commit.json + */ +const { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function moveCollectionsCommit() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const body = { + moveResources: [ + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1", + ], + validateOnly: false, + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.beginCommitAndWait( + resourceGroupName, + moveCollectionName, + options + ); + console.log(result); +} + +moveCollectionsCommit().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsCreate.js b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsCreate.js new file mode 100644 index 00000000000..a03e1f62975 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsCreate.js @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a move collection. + * + * @summary Creates or updates a move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Create.json + */ +const { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function moveCollectionsCreate() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const body = { + identity: { type: "SystemAssigned" }, + location: "eastus2", + properties: { sourceRegion: "eastus", targetRegion: "westus" }, + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.create( + resourceGroupName, + moveCollectionName, + options + ); + console.log(result); +} + +moveCollectionsCreate().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsDelete.js b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsDelete.js new file mode 100644 index 00000000000..df21821f797 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsDelete.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Deletes a move collection. + * + * @summary Deletes a move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Delete.json + */ +const { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function moveCollectionsDelete() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.beginDeleteAndWait( + resourceGroupName, + moveCollectionName + ); + console.log(result); +} + +moveCollectionsDelete().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsDiscard.js b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsDiscard.js new file mode 100644 index 00000000000..edcbf82595e --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsDiscard.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Discards the set of resources included in the request body. The discard operation is triggered on the moveResources in the moveState 'CommitPending' or 'DiscardFailed', on a successful completion the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * + * @summary Discards the set of resources included in the request body. The discard operation is triggered on the moveResources in the moveState 'CommitPending' or 'DiscardFailed', on a successful completion the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Discard.json + */ +const { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function moveCollectionsDiscard() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const body = { + moveResources: [ + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1", + ], + validateOnly: false, + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.beginDiscardAndWait( + resourceGroupName, + moveCollectionName, + options + ); + console.log(result); +} + +moveCollectionsDiscard().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsGet.js b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsGet.js new file mode 100644 index 00000000000..77744bbaf7c --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsGet.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets the move collection. + * + * @summary Gets the move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Get.json + */ +const { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function moveCollectionsGet() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.get(resourceGroupName, moveCollectionName); + console.log(result); +} + +moveCollectionsGet().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsInitiateMove.js b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsInitiateMove.js new file mode 100644 index 00000000000..fa90abe35c9 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsInitiateMove.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Moves the set of resources included in the request body. The move operation is triggered after the moveResources are in the moveState 'MovePending' or 'MoveFailed', on a successful completion the moveResource moveState do a transition to CommitPending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * + * @summary Moves the set of resources included in the request body. The move operation is triggered after the moveResources are in the moveState 'MovePending' or 'MoveFailed', on a successful completion the moveResource moveState do a transition to CommitPending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_InitiateMove.json + */ +const { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function moveCollectionsInitiateMove() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const body = { + moveResources: [ + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1", + ], + validateOnly: false, + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.beginInitiateMoveAndWait( + resourceGroupName, + moveCollectionName, + options + ); + console.log(result); +} + +moveCollectionsInitiateMove().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsListMoveCollectionsByResourceGroup.js b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsListMoveCollectionsByResourceGroup.js new file mode 100644 index 00000000000..371de7b2b2f --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsListMoveCollectionsByResourceGroup.js @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get all the Move Collections in the resource group. + * + * @summary Get all the Move Collections in the resource group. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_ListMoveCollectionsByResourceGroup.json + */ +const { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function moveCollectionsListMoveCollectionsByResourceGroup() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.moveCollections.listMoveCollectionsByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +moveCollectionsListMoveCollectionsByResourceGroup().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsListMoveCollectionsBySubscription.js b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsListMoveCollectionsBySubscription.js new file mode 100644 index 00000000000..5c705920ca4 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsListMoveCollectionsBySubscription.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get all the Move Collections in the subscription. + * + * @summary Get all the Move Collections in the subscription. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_ListMoveCollectionsBySubscription.json + */ +const { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function moveCollectionsListMoveCollectionsBySubscription() { + const subscriptionId = "subid"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.moveCollections.listMoveCollectionsBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +moveCollectionsListMoveCollectionsBySubscription().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsPrepare.js b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsPrepare.js new file mode 100644 index 00000000000..a59e5ac68b0 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsPrepare.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Initiates prepare for the set of resources included in the request body. The prepare operation is on the moveResources that are in the moveState 'PreparePending' or 'PrepareFailed', on a successful completion the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * + * @summary Initiates prepare for the set of resources included in the request body. The prepare operation is on the moveResources that are in the moveState 'PreparePending' or 'PrepareFailed', on a successful completion the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Prepare.json + */ +const { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function moveCollectionsPrepare() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const body = { + moveResources: [ + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1", + ], + validateOnly: false, + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.beginPrepareAndWait( + resourceGroupName, + moveCollectionName, + options + ); + console.log(result); +} + +moveCollectionsPrepare().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsResolveDependencies.js b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsResolveDependencies.js new file mode 100644 index 00000000000..0e96759f7d6 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsResolveDependencies.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Computes, resolves and validate the dependencies of the moveResources in the move collection. + * + * @summary Computes, resolves and validate the dependencies of the moveResources in the move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_ResolveDependencies.json + */ +const { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function moveCollectionsResolveDependencies() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.beginResolveDependenciesAndWait( + resourceGroupName, + moveCollectionName + ); + console.log(result); +} + +moveCollectionsResolveDependencies().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsUpdate.js b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsUpdate.js new file mode 100644 index 00000000000..9bd9032c922 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveCollectionsUpdate.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Updates a move collection. + * + * @summary Updates a move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Update.json + */ +const { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function moveCollectionsUpdate() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const body = { + identity: { type: "SystemAssigned" }, + tags: { key1: "mc1" }, + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.update( + resourceGroupName, + moveCollectionName, + options + ); + console.log(result); +} + +moveCollectionsUpdate().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveResourcesCreate.js b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveResourcesCreate.js new file mode 100644 index 00000000000..9000f00bba1 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveResourcesCreate.js @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a Move Resource in the move collection. + * + * @summary Creates or updates a Move Resource in the move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_Create.json + */ +const { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function moveResourcesCreate() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const moveResourceName = "moveresourcename1"; + const body = { + properties: { + dependsOnOverrides: [ + { + id: "/subscriptions/c4488a3f-a7f7-4ad4-aa72-0e1f4d9c0756/resourceGroups/eastusRG/providers/Microsoft.Network/networkInterfaces/eastusvm140", + targetId: + "/subscriptions/c4488a3f-a7f7-4ad4-aa72-0e1f4d9c0756/resourceGroups/westusRG/providers/Microsoft.Network/networkInterfaces/eastusvm140", + }, + ], + resourceSettings: { + resourceType: "Microsoft.Compute/virtualMachines", + targetAvailabilitySetId: + "/subscriptions/subid/resourceGroups/eastusRG/providers/Microsoft.Compute/availabilitySets/avset1", + targetAvailabilityZone: "2", + targetResourceName: "westusvm1", + targetVmSize: undefined, + userManagedIdentities: [ + "/subscriptions/subid/resourceGroups/eastusRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/umi1", + ], + }, + sourceId: + "/subscriptions/subid/resourceGroups/eastusRG/providers/Microsoft.Compute/virtualMachines/eastusvm1", + }, + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveResources.beginCreateAndWait( + resourceGroupName, + moveCollectionName, + moveResourceName, + options + ); + console.log(result); +} + +moveResourcesCreate().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveResourcesDelete.js b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveResourcesDelete.js new file mode 100644 index 00000000000..751dd7a2d66 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveResourcesDelete.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Deletes a Move Resource from the move collection. + * + * @summary Deletes a Move Resource from the move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_Delete.json + */ +const { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function moveResourcesDelete() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const moveResourceName = "moveresourcename1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveResources.beginDeleteAndWait( + resourceGroupName, + moveCollectionName, + moveResourceName + ); + console.log(result); +} + +moveResourcesDelete().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveResourcesGet.js b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveResourcesGet.js new file mode 100644 index 00000000000..4d318b37f35 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveResourcesGet.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets the Move Resource. + * + * @summary Gets the Move Resource. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_Get.json + */ +const { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function moveResourcesGet() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const moveResourceName = "moveresourcename1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveResources.get( + resourceGroupName, + moveCollectionName, + moveResourceName + ); + console.log(result); +} + +moveResourcesGet().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveResourcesList.js b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveResourcesList.js new file mode 100644 index 00000000000..051d2a8b8d2 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/moveResourcesList.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Lists the Move Resources in the move collection. + * + * @summary Lists the Move Resources in the move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_List.json + */ +const { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function moveResourcesList() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.moveResources.list(resourceGroupName, moveCollectionName)) { + resArray.push(item); + } + console.log(resArray); +} + +moveResourcesList().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/operationsDiscoveryGet.js b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/operationsDiscoveryGet.js new file mode 100644 index 00000000000..d51f132ca1e --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/operationsDiscoveryGet.js @@ -0,0 +1,28 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/OperationsDiscovery_Get.json + */ +const { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function operationsDiscoveryGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.operationsDiscoveryOperations.get(); + console.log(result); +} + +operationsDiscoveryGet().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/package.json b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/package.json new file mode 100644 index 00000000000..5fc26adf7f0 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "azure-arm-resourcemover-samples-js", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript", + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/resourcemover/arm-resourcemover" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcemover/arm-resourcemover", + "dependencies": { + "@azure/arm-resourcemover": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/requiredForGet.js b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/requiredForGet.js new file mode 100644 index 00000000000..df9886a4b7b --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/requiredForGet.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List of the move resources for which an arm resource is required for. + * + * @summary List of the move resources for which an arm resource is required for. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/RequiredFor_Get.json + */ +const { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function requiredForGet() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const sourceId = + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/nic1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.listRequiredFor( + resourceGroupName, + moveCollectionName, + sourceId + ); + console.log(result); +} + +requiredForGet().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/sample.env b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/unresolvedDependenciesGet.js b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/unresolvedDependenciesGet.js new file mode 100644 index 00000000000..1110741a7fb --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/javascript/unresolvedDependenciesGet.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets a list of unresolved dependencies. + * + * @summary Gets a list of unresolved dependencies. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/UnresolvedDependencies_Get.json + */ +const { ResourceMoverServiceAPI } = require("@azure/arm-resourcemover"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function unresolvedDependenciesGet() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.unresolvedDependencies.list( + resourceGroupName, + moveCollectionName + )) { + resArray.push(item); + } + console.log(resArray); +} + +unresolvedDependenciesGet().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/README.md b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/README.md new file mode 100644 index 00000000000..4b1facc56eb --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/README.md @@ -0,0 +1,99 @@ +# client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [moveCollectionsBulkRemove.ts][movecollectionsbulkremove] | Removes the set of move resources included in the request body from move collection. The orchestration is done by service. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_BulkRemove.json | +| [moveCollectionsCommit.ts][movecollectionscommit] | Commits the set of resources included in the request body. The commit operation is triggered on the moveResources in the moveState 'CommitPending' or 'CommitFailed', on a successful completion the moveResource moveState do a transition to Committed. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Commit.json | +| [moveCollectionsCreate.ts][movecollectionscreate] | Creates or updates a move collection. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Create.json | +| [moveCollectionsDelete.ts][movecollectionsdelete] | Deletes a move collection. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Delete.json | +| [moveCollectionsDiscard.ts][movecollectionsdiscard] | Discards the set of resources included in the request body. The discard operation is triggered on the moveResources in the moveState 'CommitPending' or 'DiscardFailed', on a successful completion the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Discard.json | +| [moveCollectionsGet.ts][movecollectionsget] | Gets the move collection. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Get.json | +| [moveCollectionsInitiateMove.ts][movecollectionsinitiatemove] | Moves the set of resources included in the request body. The move operation is triggered after the moveResources are in the moveState 'MovePending' or 'MoveFailed', on a successful completion the moveResource moveState do a transition to CommitPending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_InitiateMove.json | +| [moveCollectionsListMoveCollectionsByResourceGroup.ts][movecollectionslistmovecollectionsbyresourcegroup] | Get all the Move Collections in the resource group. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_ListMoveCollectionsByResourceGroup.json | +| [moveCollectionsListMoveCollectionsBySubscription.ts][movecollectionslistmovecollectionsbysubscription] | Get all the Move Collections in the subscription. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_ListMoveCollectionsBySubscription.json | +| [moveCollectionsPrepare.ts][movecollectionsprepare] | Initiates prepare for the set of resources included in the request body. The prepare operation is on the moveResources that are in the moveState 'PreparePending' or 'PrepareFailed', on a successful completion the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Prepare.json | +| [moveCollectionsResolveDependencies.ts][movecollectionsresolvedependencies] | Computes, resolves and validate the dependencies of the moveResources in the move collection. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_ResolveDependencies.json | +| [moveCollectionsUpdate.ts][movecollectionsupdate] | Updates a move collection. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Update.json | +| [moveResourcesCreate.ts][moveresourcescreate] | Creates or updates a Move Resource in the move collection. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_Create.json | +| [moveResourcesDelete.ts][moveresourcesdelete] | Deletes a Move Resource from the move collection. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_Delete.json | +| [moveResourcesGet.ts][moveresourcesget] | Gets the Move Resource. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_Get.json | +| [moveResourcesList.ts][moveresourceslist] | Lists the Move Resources in the move collection. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_List.json | +| [operationsDiscoveryGet.ts][operationsdiscoveryget] | x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/OperationsDiscovery_Get.json | +| [requiredForGet.ts][requiredforget] | List of the move resources for which an arm resource is required for. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/RequiredFor_Get.json | +| [unresolvedDependenciesGet.ts][unresolveddependenciesget] | Gets a list of unresolved dependencies. x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/UnresolvedDependencies_Get.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/moveCollectionsBulkRemove.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node dist/moveCollectionsBulkRemove.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[movecollectionsbulkremove]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsBulkRemove.ts +[movecollectionscommit]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsCommit.ts +[movecollectionscreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsCreate.ts +[movecollectionsdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsDelete.ts +[movecollectionsdiscard]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsDiscard.ts +[movecollectionsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsGet.ts +[movecollectionsinitiatemove]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsInitiateMove.ts +[movecollectionslistmovecollectionsbyresourcegroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsListMoveCollectionsByResourceGroup.ts +[movecollectionslistmovecollectionsbysubscription]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsListMoveCollectionsBySubscription.ts +[movecollectionsprepare]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsPrepare.ts +[movecollectionsresolvedependencies]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsResolveDependencies.ts +[movecollectionsupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsUpdate.ts +[moveresourcescreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveResourcesCreate.ts +[moveresourcesdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveResourcesDelete.ts +[moveresourcesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveResourcesGet.ts +[moveresourceslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveResourcesList.ts +[operationsdiscoveryget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/operationsDiscoveryGet.ts +[requiredforget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/requiredForGet.ts +[unresolveddependenciesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/unresolvedDependenciesGet.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-resourcemover?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcemover/arm-resourcemover/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/package.json b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/package.json new file mode 100644 index 00000000000..b7ef4245dab --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "azure-arm-resourcemover-samples-ts", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript", + "engines": { + "node": ">=12.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/resourcemover/arm-resourcemover" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/resourcemover/arm-resourcemover", + "dependencies": { + "@azure/arm-resourcemover": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^12.0.0", + "typescript": "~4.4.0", + "rimraf": "latest" + } +} diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/sample.env b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsBulkRemove.ts b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsBulkRemove.ts new file mode 100644 index 00000000000..162cee76fda --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsBulkRemove.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Removes the set of move resources included in the request body from move collection. The orchestration is done by service. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * + * @summary Removes the set of move resources included in the request body from move collection. The orchestration is done by service. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_BulkRemove.json + */ +import { + BulkRemoveRequest, + ResourceMoverServiceAPI +} from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsBulkRemove() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const body: BulkRemoveRequest = { + moveResources: [ + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1" + ], + validateOnly: false + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.beginBulkRemoveAndWait( + resourceGroupName, + moveCollectionName, + options + ); + console.log(result); +} + +moveCollectionsBulkRemove().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsCommit.ts b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsCommit.ts new file mode 100644 index 00000000000..1f65f4288d7 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsCommit.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Commits the set of resources included in the request body. The commit operation is triggered on the moveResources in the moveState 'CommitPending' or 'CommitFailed', on a successful completion the moveResource moveState do a transition to Committed. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * + * @summary Commits the set of resources included in the request body. The commit operation is triggered on the moveResources in the moveState 'CommitPending' or 'CommitFailed', on a successful completion the moveResource moveState do a transition to Committed. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Commit.json + */ +import { + CommitRequest, + ResourceMoverServiceAPI +} from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsCommit() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const body: CommitRequest = { + moveResources: [ + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1" + ], + validateOnly: false + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.beginCommitAndWait( + resourceGroupName, + moveCollectionName, + options + ); + console.log(result); +} + +moveCollectionsCommit().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsCreate.ts b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsCreate.ts new file mode 100644 index 00000000000..15f8031ce53 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsCreate.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a move collection. + * + * @summary Creates or updates a move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Create.json + */ +import { + MoveCollection, + ResourceMoverServiceAPI +} from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsCreate() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const body: MoveCollection = { + identity: { type: "SystemAssigned" }, + location: "eastus2", + properties: { sourceRegion: "eastus", targetRegion: "westus" } + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.create( + resourceGroupName, + moveCollectionName, + options + ); + console.log(result); +} + +moveCollectionsCreate().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsDelete.ts b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsDelete.ts new file mode 100644 index 00000000000..ab25a8802b7 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsDelete.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Deletes a move collection. + * + * @summary Deletes a move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Delete.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsDelete() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.beginDeleteAndWait( + resourceGroupName, + moveCollectionName + ); + console.log(result); +} + +moveCollectionsDelete().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsDiscard.ts b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsDiscard.ts new file mode 100644 index 00000000000..fa35a1c52be --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsDiscard.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Discards the set of resources included in the request body. The discard operation is triggered on the moveResources in the moveState 'CommitPending' or 'DiscardFailed', on a successful completion the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * + * @summary Discards the set of resources included in the request body. The discard operation is triggered on the moveResources in the moveState 'CommitPending' or 'DiscardFailed', on a successful completion the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Discard.json + */ +import { + DiscardRequest, + ResourceMoverServiceAPI +} from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsDiscard() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const body: DiscardRequest = { + moveResources: [ + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1" + ], + validateOnly: false + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.beginDiscardAndWait( + resourceGroupName, + moveCollectionName, + options + ); + console.log(result); +} + +moveCollectionsDiscard().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsGet.ts b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsGet.ts new file mode 100644 index 00000000000..8c636e0b823 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsGet.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets the move collection. + * + * @summary Gets the move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Get.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsGet() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.get( + resourceGroupName, + moveCollectionName + ); + console.log(result); +} + +moveCollectionsGet().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsInitiateMove.ts b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsInitiateMove.ts new file mode 100644 index 00000000000..f66f6294026 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsInitiateMove.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Moves the set of resources included in the request body. The move operation is triggered after the moveResources are in the moveState 'MovePending' or 'MoveFailed', on a successful completion the moveResource moveState do a transition to CommitPending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * + * @summary Moves the set of resources included in the request body. The move operation is triggered after the moveResources are in the moveState 'MovePending' or 'MoveFailed', on a successful completion the moveResource moveState do a transition to CommitPending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_InitiateMove.json + */ +import { + ResourceMoveRequest, + ResourceMoverServiceAPI +} from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsInitiateMove() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const body: ResourceMoveRequest = { + moveResources: [ + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1" + ], + validateOnly: false + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.beginInitiateMoveAndWait( + resourceGroupName, + moveCollectionName, + options + ); + console.log(result); +} + +moveCollectionsInitiateMove().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsListMoveCollectionsByResourceGroup.ts b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsListMoveCollectionsByResourceGroup.ts new file mode 100644 index 00000000000..ba3c9844e6a --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsListMoveCollectionsByResourceGroup.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get all the Move Collections in the resource group. + * + * @summary Get all the Move Collections in the resource group. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_ListMoveCollectionsByResourceGroup.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsListMoveCollectionsByResourceGroup() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.moveCollections.listMoveCollectionsByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +moveCollectionsListMoveCollectionsByResourceGroup().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsListMoveCollectionsBySubscription.ts b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsListMoveCollectionsBySubscription.ts new file mode 100644 index 00000000000..e2d5704bcc3 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsListMoveCollectionsBySubscription.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get all the Move Collections in the subscription. + * + * @summary Get all the Move Collections in the subscription. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_ListMoveCollectionsBySubscription.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsListMoveCollectionsBySubscription() { + const subscriptionId = "subid"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.moveCollections.listMoveCollectionsBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +moveCollectionsListMoveCollectionsBySubscription().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsPrepare.ts b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsPrepare.ts new file mode 100644 index 00000000000..a2529e49891 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsPrepare.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Initiates prepare for the set of resources included in the request body. The prepare operation is on the moveResources that are in the moveState 'PreparePending' or 'PrepareFailed', on a successful completion the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * + * @summary Initiates prepare for the set of resources included in the request body. The prepare operation is on the moveResources that are in the moveState 'PreparePending' or 'PrepareFailed', on a successful completion the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the operation the client can call operation with validateOnly property set to true. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Prepare.json + */ +import { + PrepareRequest, + ResourceMoverServiceAPI +} from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsPrepare() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const body: PrepareRequest = { + moveResources: [ + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Migrate/MoveCollections/movecollection1/MoveResources/moveresource1" + ], + validateOnly: false + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.beginPrepareAndWait( + resourceGroupName, + moveCollectionName, + options + ); + console.log(result); +} + +moveCollectionsPrepare().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsResolveDependencies.ts b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsResolveDependencies.ts new file mode 100644 index 00000000000..b7b84d76317 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsResolveDependencies.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Computes, resolves and validate the dependencies of the moveResources in the move collection. + * + * @summary Computes, resolves and validate the dependencies of the moveResources in the move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_ResolveDependencies.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsResolveDependencies() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.beginResolveDependenciesAndWait( + resourceGroupName, + moveCollectionName + ); + console.log(result); +} + +moveCollectionsResolveDependencies().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsUpdate.ts b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsUpdate.ts new file mode 100644 index 00000000000..6a98d41daf3 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveCollectionsUpdate.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Updates a move collection. + * + * @summary Updates a move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveCollections_Update.json + */ +import { + UpdateMoveCollectionRequest, + ResourceMoverServiceAPI +} from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveCollectionsUpdate() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const body: UpdateMoveCollectionRequest = { + identity: { type: "SystemAssigned" }, + tags: { key1: "mc1" } + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.update( + resourceGroupName, + moveCollectionName, + options + ); + console.log(result); +} + +moveCollectionsUpdate().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveResourcesCreate.ts b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveResourcesCreate.ts new file mode 100644 index 00000000000..c30e89b2992 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveResourcesCreate.ts @@ -0,0 +1,65 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates or updates a Move Resource in the move collection. + * + * @summary Creates or updates a Move Resource in the move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_Create.json + */ +import { + MoveResource, + ResourceMoverServiceAPI +} from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveResourcesCreate() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const moveResourceName = "moveresourcename1"; + const body: MoveResource = { + properties: { + dependsOnOverrides: [ + { + id: + "/subscriptions/c4488a3f-a7f7-4ad4-aa72-0e1f4d9c0756/resourceGroups/eastusRG/providers/Microsoft.Network/networkInterfaces/eastusvm140", + targetId: + "/subscriptions/c4488a3f-a7f7-4ad4-aa72-0e1f4d9c0756/resourceGroups/westusRG/providers/Microsoft.Network/networkInterfaces/eastusvm140" + } + ], + resourceSettings: { + resourceType: "Microsoft.Compute/virtualMachines", + targetAvailabilitySetId: + "/subscriptions/subid/resourceGroups/eastusRG/providers/Microsoft.Compute/availabilitySets/avset1", + targetAvailabilityZone: "2", + targetResourceName: "westusvm1", + targetVmSize: undefined, + userManagedIdentities: [ + "/subscriptions/subid/resourceGroups/eastusRG/providers/Microsoft.ManagedIdentity/userAssignedIdentities/umi1" + ] + }, + sourceId: + "/subscriptions/subid/resourceGroups/eastusRG/providers/Microsoft.Compute/virtualMachines/eastusvm1" + } + }; + const options = { body: body }; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveResources.beginCreateAndWait( + resourceGroupName, + moveCollectionName, + moveResourceName, + options + ); + console.log(result); +} + +moveResourcesCreate().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveResourcesDelete.ts b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveResourcesDelete.ts new file mode 100644 index 00000000000..e30243b61d2 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveResourcesDelete.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Deletes a Move Resource from the move collection. + * + * @summary Deletes a Move Resource from the move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_Delete.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveResourcesDelete() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const moveResourceName = "moveresourcename1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveResources.beginDeleteAndWait( + resourceGroupName, + moveCollectionName, + moveResourceName + ); + console.log(result); +} + +moveResourcesDelete().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveResourcesGet.ts b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveResourcesGet.ts new file mode 100644 index 00000000000..d64c813dee5 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveResourcesGet.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets the Move Resource. + * + * @summary Gets the Move Resource. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_Get.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveResourcesGet() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const moveResourceName = "moveresourcename1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveResources.get( + resourceGroupName, + moveCollectionName, + moveResourceName + ); + console.log(result); +} + +moveResourcesGet().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveResourcesList.ts b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveResourcesList.ts new file mode 100644 index 00000000000..ec8451052c5 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/moveResourcesList.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Lists the Move Resources in the move collection. + * + * @summary Lists the Move Resources in the move collection. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/MoveResources_List.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function moveResourcesList() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.moveResources.list( + resourceGroupName, + moveCollectionName + )) { + resArray.push(item); + } + console.log(resArray); +} + +moveResourcesList().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/operationsDiscoveryGet.ts b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/operationsDiscoveryGet.ts new file mode 100644 index 00000000000..f8ff84086eb --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/operationsDiscoveryGet.ts @@ -0,0 +1,28 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to + * + * @summary + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/OperationsDiscovery_Get.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function operationsDiscoveryGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.operationsDiscoveryOperations.get(); + console.log(result); +} + +operationsDiscoveryGet().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/requiredForGet.ts b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/requiredForGet.ts new file mode 100644 index 00000000000..ddd30e96c0a --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/requiredForGet.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List of the move resources for which an arm resource is required for. + * + * @summary List of the move resources for which an arm resource is required for. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/RequiredFor_Get.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function requiredForGet() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const sourceId = + "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/nic1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const result = await client.moveCollections.listRequiredFor( + resourceGroupName, + moveCollectionName, + sourceId + ); + console.log(result); +} + +requiredForGet().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/unresolvedDependenciesGet.ts b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/unresolvedDependenciesGet.ts new file mode 100644 index 00000000000..21b29851fe0 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/src/unresolvedDependenciesGet.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets a list of unresolved dependencies. + * + * @summary Gets a list of unresolved dependencies. + * x-ms-original-file: specification/resourcemover/resource-manager/Microsoft.Migrate/stable/2021-08-01/examples/UnresolvedDependencies_Get.json + */ +import { ResourceMoverServiceAPI } from "@azure/arm-resourcemover"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function unresolvedDependenciesGet() { + const subscriptionId = "subid"; + const resourceGroupName = "rg1"; + const moveCollectionName = "movecollection1"; + const credential = new DefaultAzureCredential(); + const client = new ResourceMoverServiceAPI(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.unresolvedDependencies.list( + resourceGroupName, + moveCollectionName + )) { + resArray.push(item); + } + console.log(resArray); +} + +unresolvedDependenciesGet().catch(console.error); diff --git a/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/tsconfig.json b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/tsconfig.json new file mode 100644 index 00000000000..416c2dd82e0 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/samples/v2/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2018", + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "alwaysStrict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src/**.ts" + ] +} diff --git a/sdk/resourcemover/arm-resourcemover/src/index.ts b/sdk/resourcemover/arm-resourcemover/src/index.ts new file mode 100644 index 00000000000..c57586d19b0 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/src/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +/// +export * from "./models"; +export { ResourceMoverServiceAPI } from "./resourceMoverServiceAPI"; +export * from "./operationsInterfaces"; diff --git a/sdk/resourcemover/arm-resourcemover/src/lroImpl.ts b/sdk/resourcemover/arm-resourcemover/src/lroImpl.ts new file mode 100644 index 00000000000..518d5f053b4 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/src/lroImpl.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export class LroImpl implements LongRunningOperation { + constructor( + private sendOperationFn: (args: any, spec: any) => Promise>, + private args: Record, + private spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record, + public requestPath: string = spec.path!, + public requestMethod: string = spec.httpMethod + ) {} + public async sendInitialRequest(): Promise> { + return this.sendOperationFn(this.args, this.spec); + } + public async sendPollRequest(path: string): Promise> { + const { requestBody, ...restSpec } = this.spec; + return this.sendOperationFn(this.args, { + ...restSpec, + path, + httpMethod: "GET" + }); + } +} diff --git a/sdk/resourcemover/arm-resourcemover/src/models/index.ts b/sdk/resourcemover/arm-resourcemover/src/models/index.ts index a518b7546e4..25dd82d43ce 100644 --- a/sdk/resourcemover/arm-resourcemover/src/models/index.ts +++ b/sdk/resourcemover/arm-resourcemover/src/models/index.ts @@ -6,110 +6,467 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export { BaseResource, CloudError }; +export type ResourceSettingsUnion = + | ResourceSettings + | VirtualMachineResourceSettings + | AvailabilitySetResourceSettings + | VirtualNetworkResourceSettings + | NetworkInterfaceResourceSettings + | NetworkSecurityGroupResourceSettings + | LoadBalancerResourceSettings + | SqlServerResourceSettings + | SqlElasticPoolResourceSettings + | SqlDatabaseResourceSettings + | ResourceGroupResourceSettings + | PublicIPAddressResourceSettings + | KeyVaultResourceSettings + | DiskEncryptionSetResourceSettings; -/** - * Defines the MSI properties of the Move Collection. - */ +/** Define the move collection. */ +export interface MoveCollection { + /** + * Fully qualified resource Id for the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The name of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The type of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The etag of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly etag?: string; + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** The geo-location where the resource lives. */ + location?: string; + /** Defines the MSI properties of the Move Collection. */ + identity?: Identity; + /** Defines the move collection properties. */ + properties?: MoveCollectionProperties; + /** + * Metadata pertaining to creation and last modification of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** Defines the MSI properties of the Move Collection. */ export interface Identity { - /** - * Possible values include: 'None', 'SystemAssigned', 'UserAssigned' - */ + /** The type of identity used for the resource mover service. */ type?: ResourceIdentityType; - /** - * Gets or sets the principal id. - */ + /** Gets or sets the principal id. */ principalId?: string; - /** - * Gets or sets the tenant id. - */ + /** Gets or sets the tenant id. */ tenantId?: string; } -/** - * Defines the job status. - */ -export interface JobStatus { +/** Defines the move collection properties. */ +export interface MoveCollectionProperties { + /** Gets or sets the source region. */ + sourceRegion: string; + /** Gets or sets the target region. */ + targetRegion: string; /** - * Possible values include: 'InitialSync' + * Defines the provisioning states. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - jobName?: JobName; + readonly provisioningState?: ProvisioningState; /** - * Gets or sets the monitoring job percentage. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * Defines the move collection errors. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly jobProgress?: string; + readonly errors?: MoveCollectionPropertiesErrors; } -/** - * An error response from the Azure Migrate service. - */ +/** An error response from the azure resource mover service. */ +export interface MoveResourceError { + /** The move resource error body. */ + properties?: MoveResourceErrorBody; +} + +/** An error response from the Azure Migrate service. */ export interface MoveResourceErrorBody { /** - * An identifier for the error. Codes are invariant and are intended to be consumed - * programmatically. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly code?: string; /** * A message describing the error, intended to be suitable for display in a user interface. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly message?: string; /** * The target of the particular error. For example, the name of the property in error. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly target?: string; /** * A list of additional details about the error. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly details?: MoveResourceErrorBody[]; } -/** - * An error response from the azure resource mover service. - */ -export interface MoveResourceError { - /** - * The move resource error body. - */ - properties?: MoveResourceErrorBody; +/** 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; } -/** - * Defines the move resource status. - */ +/** An error response from the service. */ +export interface CloudError { + /** Cloud error body. */ + error?: CloudErrorBody; +} + +/** An error response from the service. */ +export interface CloudErrorBody { + /** An identifier for the error. Codes are invariant and are intended to be consumed programmatically. */ + code?: string; + /** A message describing the error, intended to be suitable for display in a user interface. */ + message?: string; + /** The target of the particular error. For example, the name of the property in error. */ + target?: string; + /** A list of additional details about the error. */ + details?: CloudErrorBody[]; +} + +/** Defines the request body for updating move collection. */ +export interface UpdateMoveCollectionRequest { + /** Gets or sets the Resource tags. */ + tags?: { [propertyName: string]: string }; + /** Defines the MSI properties of the Move Collection. */ + identity?: Identity; +} + +/** Operation status REST resource. */ +export interface OperationStatus { + /** + * Resource Id. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * Operation name. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * Status of the operation. ARM expects the terminal status to be one of Succeeded/ Failed/ Canceled. All other values imply that the operation is still running. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly status?: string; + /** + * Start time. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly startTime?: string; + /** + * End time. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly endTime?: string; + /** + * Error stating all error details for the operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly error?: OperationStatusError; + /** + * Custom data. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly properties?: Record; +} + +/** Class for operation status errors. */ +export interface OperationStatusError { + /** + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: OperationStatusError[]; + /** + * The additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalInfo?: OperationErrorAdditionalInfo[]; +} + +/** The operation error info. */ +export interface OperationErrorAdditionalInfo { + /** + * The error type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The operation error info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly info?: MoveErrorInfo; +} + +/** The move custom error info. */ +export interface MoveErrorInfo { + /** + * The affected move resources. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly moveResources?: AffectedMoveResource[]; +} + +/** The RP custom operation error info. */ +export interface AffectedMoveResource { + /** + * The affected move resource id. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The affected move resource source id. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly sourceId?: string; + /** + * The affected move resources. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly moveResources?: AffectedMoveResource[]; +} + +/** Defines the request body for initiate prepare operation. */ +export interface PrepareRequest { + /** Gets or sets a value indicating whether the operation needs to only run pre-requisite. */ + validateOnly?: boolean; + /** Gets or sets the list of resource Id's, by default it accepts move resource id's unless the input type is switched via moveResourceInputType property. */ + moveResources: string[]; + /** Defines the move resource input type. */ + moveResourceInputType?: MoveResourceInputType; +} + +/** Defines the request body for resource move operation. */ +export interface ResourceMoveRequest { + /** Gets or sets a value indicating whether the operation needs to only run pre-requisite. */ + validateOnly?: boolean; + /** Gets or sets the list of resource Id's, by default it accepts move resource id's unless the input type is switched via moveResourceInputType property. */ + moveResources: string[]; + /** Defines the move resource input type. */ + moveResourceInputType?: MoveResourceInputType; +} + +/** Defines the request body for commit operation. */ +export interface CommitRequest { + /** Gets or sets a value indicating whether the operation needs to only run pre-requisite. */ + validateOnly?: boolean; + /** Gets or sets the list of resource Id's, by default it accepts move resource id's unless the input type is switched via moveResourceInputType property. */ + moveResources: string[]; + /** Defines the move resource input type. */ + moveResourceInputType?: MoveResourceInputType; +} + +/** Defines the request body for discard operation. */ +export interface DiscardRequest { + /** Gets or sets a value indicating whether the operation needs to only run pre-requisite. */ + validateOnly?: boolean; + /** Gets or sets the list of resource Id's, by default it accepts move resource id's unless the input type is switched via moveResourceInputType property. */ + moveResources: string[]; + /** Defines the move resource input type. */ + moveResourceInputType?: MoveResourceInputType; +} + +/** Defines the collection of move resources. */ +export interface MoveResourceCollection { + /** Gets the list of move resources. */ + value?: MoveResource[]; + /** Gets the value of next link. */ + nextLink?: string; + /** Gets or sets the list of summary items and the field on which summary is done. */ + summaryCollection?: SummaryCollection; + /** + * Gets the total count. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly totalCount?: number; +} + +/** Defines the move resource. */ +export interface MoveResource { + /** + * Fully qualified resource Id for the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The name of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The type of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** Defines the move resource properties. */ + properties?: MoveResourceProperties; + /** + * Metadata pertaining to creation and last modification of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; +} + +/** Defines the move resource properties. */ +export interface MoveResourceProperties { + /** + * Defines the provisioning states. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** Gets or sets the Source ARM Id of the resource. */ + sourceId: string; + /** + * Gets or sets the Target ARM Id of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly targetId?: string; + /** Gets or sets the existing target ARM Id of the resource. */ + existingTargetId?: string; + /** Gets or sets the resource settings. */ + resourceSettings?: ResourceSettingsUnion; + /** + * Gets or sets the source resource settings. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly sourceResourceSettings?: ResourceSettingsUnion; + /** + * Defines the move resource status. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly moveStatus?: MoveResourcePropertiesMoveStatus; + /** + * Gets or sets the move resource dependencies. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly dependsOn?: MoveResourceDependency[]; + /** Gets or sets the move resource dependencies overrides. */ + dependsOnOverrides?: MoveResourceDependencyOverride[]; + /** + * Gets a value indicating whether the resolve action is required over the move collection. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly isResolveRequired?: boolean; + /** + * Defines the move resource errors. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly errors?: MoveResourcePropertiesErrors; +} + +/** Gets or sets the resource settings. */ +export interface ResourceSettings { + /** Polymorphic discriminator, which specifies the different types this object can be */ + resourceType: + | "Microsoft.Compute/virtualMachines" + | "Microsoft.Compute/availabilitySets" + | "Microsoft.Network/virtualNetworks" + | "Microsoft.Network/networkInterfaces" + | "Microsoft.Network/networkSecurityGroups" + | "Microsoft.Network/loadBalancers" + | "Microsoft.Sql/servers" + | "Microsoft.Sql/servers/elasticPools" + | "Microsoft.Sql/servers/databases" + | "resourceGroups" + | "Microsoft.Network/publicIPAddresses" + | "Microsoft.KeyVault/vaults" + | "Microsoft.Compute/diskEncryptionSets"; + /** Gets or sets the target Resource name. */ + targetResourceName: string; +} + +/** Defines the move resource status. */ export interface MoveResourceStatus { /** - * Possible values include: 'AssignmentPending', 'PreparePending', 'PrepareInProgress', - * 'PrepareFailed', 'MovePending', 'MoveInProgress', 'MoveFailed', 'DiscardInProgress', - * 'DiscardFailed', 'CommitPending', 'CommitInProgress', 'CommitFailed', 'Committed', - * 'DeleteSourcePending', 'ResourceMoveCompleted' + * Defines the MoveResource states. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - moveState?: MoveState; + readonly moveState?: MoveState; + /** Defines the job status. */ jobStatus?: JobStatus; + /** An error response from the azure resource mover service. */ errors?: MoveResourceError; } -/** - * Defines the properties for manual resolution. - */ -export interface ManualResolutionProperties { +/** Defines the job status. */ +export interface JobStatus { /** - * Gets or sets the target resource ARM ID of the dependent resource if the resource type is - * Manual. + * Defines the job name. + * NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly jobName?: JobName; + /** + * Gets or sets the monitoring job percentage. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly jobProgress?: string; +} + +/** Defines the dependency of the move resource. */ +export interface MoveResourceDependency { + /** Gets the source ARM ID of the dependent resource. */ + id?: string; + /** Gets the dependency resolution status. */ + resolutionStatus?: string; + /** Defines the resolution type. */ + resolutionType?: ResolutionType; + /** Defines the dependency type. */ + dependencyType?: DependencyType; + /** Defines the properties for manual resolution. */ + manualResolution?: ManualResolutionProperties; + /** Defines the properties for automatic resolution. */ + automaticResolution?: AutomaticResolutionProperties; + /** Gets or sets a value indicating whether the dependency is optional. */ + isOptional?: string; +} + +/** Defines the properties for manual resolution. */ +export interface ManualResolutionProperties { + /** Gets or sets the target resource ARM ID of the dependent resource if the resource type is Manual. */ targetId?: string; } -/** - * Defines the properties for automatic resolution. - */ +/** Defines the properties for automatic resolution. */ export interface AutomaticResolutionProperties { /** * Gets the MoveResource ARM ID of @@ -118,41 +475,9 @@ export interface AutomaticResolutionProperties { moveResourceId?: string; } -/** - * Defines the dependency of the move resource. - */ -export interface MoveResourceDependency { - /** - * Gets the source ARM ID of the dependent resource. - */ - id?: string; - /** - * Gets the dependency resolution status. - */ - resolutionStatus?: string; - /** - * Possible values include: 'Manual', 'Automatic' - */ - resolutionType?: ResolutionType; - /** - * Possible values include: 'RequiredForPrepare', 'RequiredForMove' - */ - dependencyType?: DependencyType; - manualResolution?: ManualResolutionProperties; - automaticResolution?: AutomaticResolutionProperties; - /** - * Gets or sets a value indicating whether the dependency is optional. - */ - isOptional?: string; -} - -/** - * Defines the dependency override of the move resource. - */ +/** Defines the dependency override of the move resource. */ export interface MoveResourceDependencyOverride { - /** - * Gets or sets the ARM ID of the dependent resource. - */ + /** Gets or sets the ARM ID of the dependent resource. */ id?: string; /** * Gets or sets the resource ARM id of either the MoveResource or the resource ARM ID of @@ -161,370 +486,112 @@ export interface MoveResourceDependencyOverride { targetId?: string; } -/** - * Contains the possible cases for ResourceSettings. - */ -export type ResourceSettingsUnion = ResourceSettings | VirtualMachineResourceSettings | AvailabilitySetResourceSettings | VirtualNetworkResourceSettings | NetworkInterfaceResourceSettings | NetworkSecurityGroupResourceSettings | LoadBalancerResourceSettings | SqlServerResourceSettings | SqlElasticPoolResourceSettings | SqlDatabaseResourceSettings | ResourceGroupResourceSettings | PublicIPAddressResourceSettings | KeyVaultResourceSettings | DiskEncryptionSetResourceSettings; - -/** - * Gets or sets the resource settings. - */ -export interface ResourceSettings { - /** - * Polymorphic Discriminator - */ - resourceType: "ResourceSettings"; - /** - * Gets or sets the target Resource name. - */ - targetResourceName: string; -} - -/** - * Defines the move resource status. - */ -export interface MoveResourcePropertiesMoveStatus extends MoveResourceStatus { -} - -/** - * Defines the move resource errors. - */ -export interface MoveResourcePropertiesErrors extends MoveResourceError { -} - -/** - * Defines the move resource properties. - */ -export interface MoveResourceProperties { - /** - * Possible values include: 'Succeeded', 'Updating', 'Creating', 'Failed' - */ - provisioningState?: ProvisioningState; - /** - * Gets or sets the Source ARM Id of the resource. - */ - sourceId: string; - /** - * Gets or sets the Target ARM Id of the resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly targetId?: string; - /** - * Gets or sets the existing target ARM Id of the resource. - */ - existingTargetId?: string; - /** - * Gets or sets the resource settings. - */ - resourceSettings?: ResourceSettingsUnion; - /** - * Gets or sets the source resource settings. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly sourceResourceSettings?: ResourceSettingsUnion; - /** - * Defines the move resource status. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly moveStatus?: MoveResourcePropertiesMoveStatus; - /** - * Gets or sets the move resource dependencies. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly dependsOn?: MoveResourceDependency[]; - /** - * Gets or sets the move resource dependencies overrides. - */ - dependsOnOverrides?: MoveResourceDependencyOverride[]; - /** - * Gets a value indicating whether the resolve action is required over the move collection. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly isResolveRequired?: boolean; - /** - * Defines the move resource errors. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly errors?: MoveResourcePropertiesErrors; -} - -/** - * Defines the move resource. - */ -export interface MoveResource extends BaseResource { - /** - * Fully qualified resource Id for the resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * The name of the resource - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * The type of the resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - properties?: MoveResourceProperties; -} - -/** - * Summary item. - */ -export interface Summary { - /** - * Gets the count. - */ - count?: number; - /** - * Gets the item. - */ - item?: string; -} - -/** - * Summary Collection. - */ +/** Summary Collection. */ export interface SummaryCollection { - /** - * Gets or sets the field name on which summary is done. - */ + /** Gets or sets the field name on which summary is done. */ fieldName?: string; - /** - * Gets or sets the list of summary items. - */ + /** Gets or sets the list of summary items. */ summary?: Summary[]; } -/** - * Defines the move collection errors. - */ -export interface MoveCollectionPropertiesErrors extends MoveResourceError { -} - -/** - * Defines the move collection properties. - */ -export interface MoveCollectionProperties { - /** - * Gets or sets the source region. - */ - sourceRegion: string; - /** - * Gets or sets the target region. - */ - targetRegion: string; - /** - * Possible values include: 'Succeeded', 'Updating', 'Creating', 'Failed' - */ - provisioningState?: ProvisioningState; - /** - * Defines the move collection errors. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly errors?: MoveCollectionPropertiesErrors; -} - -/** - * Define the move collection. - */ -export interface MoveCollection extends BaseResource { - /** - * Fully qualified resource Id for the resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * The name of the resource - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * The type of the resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * The etag of the resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly etag?: string; - /** - * Resource tags. - */ - tags?: { [propertyName: string]: string }; - /** - * The geo-location where the resource lives. - */ - location?: string; - identity?: Identity; - properties?: MoveCollectionProperties; -} - -/** - * Defines the request body for updating move collection. - */ -export interface UpdateMoveCollectionRequest { - /** - * Gets or sets the Resource tags. - */ - tags?: { [propertyName: string]: string }; - identity?: Identity; -} - -/** - * Defines the request body for initiate prepare operation. - */ -export interface PrepareRequest { - /** - * Gets or sets a value indicating whether the operation needs to only run pre-requisite. - */ - validateOnly?: boolean; - /** - * Gets or sets the list of resource Id's, by default it accepts move resource id's unless the - * input type is switched via moveResourceInputType property. - */ - moveResources: string[]; - /** - * Possible values include: 'MoveResourceId', 'MoveResourceSourceId' - */ - moveResourceInputType?: MoveResourceInputType; -} - -/** - * Defines the request body for resource move operation. - */ -export interface ResourceMoveRequest { - /** - * Gets or sets a value indicating whether the operation needs to only run pre-requisite. - */ - validateOnly?: boolean; - /** - * Gets or sets the list of resource Id's, by default it accepts move resource id's unless the - * input type is switched via moveResourceInputType property. - */ - moveResources: string[]; - /** - * Possible values include: 'MoveResourceId', 'MoveResourceSourceId' - */ - moveResourceInputType?: MoveResourceInputType; -} - -/** - * Defines the request body for commit operation. - */ -export interface CommitRequest { - /** - * Gets or sets a value indicating whether the operation needs to only run pre-requisite. - */ - validateOnly?: boolean; - /** - * Gets or sets the list of resource Id's, by default it accepts move resource id's unless the - * input type is switched via moveResourceInputType property. - */ - moveResources: string[]; - /** - * Possible values include: 'MoveResourceId', 'MoveResourceSourceId' - */ - moveResourceInputType?: MoveResourceInputType; -} - -/** - * Defines the request body for discard operation. - */ -export interface DiscardRequest { - /** - * Gets or sets a value indicating whether the operation needs to only run pre-requisite. - */ - validateOnly?: boolean; - /** - * Gets or sets the list of resource Id's, by default it accepts move resource id's unless the - * input type is switched via moveResourceInputType property. - */ - moveResources: string[]; - /** - * Possible values include: 'MoveResourceId', 'MoveResourceSourceId' - */ - moveResourceInputType?: MoveResourceInputType; -} - -/** - * Defines the request body for bulk remove of move resources operation. - */ -export interface BulkRemoveRequest { - /** - * Gets or sets a value indicating whether the operation needs to only run pre-requisite. - */ - validateOnly?: boolean; - /** - * Gets or sets the list of resource Id's, by default it accepts move resource id's unless the - * input type is switched via moveResourceInputType property. - */ - moveResources?: string[]; - /** - * Possible values include: 'MoveResourceId', 'MoveResourceSourceId' - */ - moveResourceInputType?: MoveResourceInputType; -} - -/** - * An interface representing MoveResourceFilterProperties. - */ -export interface MoveResourceFilterProperties { - /** - * The provisioning state. - */ - provisioningState?: string; -} - -/** - * Move resource filter. - */ -export interface MoveResourceFilter { - properties?: MoveResourceFilterProperties; -} - -/** - * An interface representing UnresolvedDependenciesFilterProperties. - */ -export interface UnresolvedDependenciesFilterProperties { - /** - * The count of the resource. - */ +/** Summary item. */ +export interface Summary { + /** Gets the count. */ count?: number; + /** Gets the item. */ + item?: string; } -/** - * Unresolved dependencies contract. - */ -export interface UnresolvedDependenciesFilter { - properties?: UnresolvedDependenciesFilterProperties; +/** Unresolved dependency collection. */ +export interface UnresolvedDependencyCollection { + /** Gets or sets the list of unresolved dependencies. */ + value?: UnresolvedDependency[]; + /** Gets or sets the value of next link. */ + nextLink?: string; + /** + * Gets or sets the list of summary items and the field on which summary is done. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly summaryCollection?: SummaryCollection; + /** + * Gets the total count. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly totalCount?: number; } -/** - * Unresolved dependency. - */ +/** Unresolved dependency. */ export interface UnresolvedDependency { - /** - * Gets or sets the count. - */ + /** Gets or sets the count. */ count?: number; - /** - * Gets or sets the arm id of the dependency. - */ + /** Gets or sets the arm id of the dependency. */ id?: string; } -/** - * Required for resources collection. - */ -export interface RequiredForResourcesCollection { +/** Defines the request body for bulk remove of move resources operation. */ +export interface BulkRemoveRequest { + /** Gets or sets a value indicating whether the operation needs to only run pre-requisite. */ + validateOnly?: boolean; + /** Gets or sets the list of resource Id's, by default it accepts move resource id's unless the input type is switched via moveResourceInputType property. */ + moveResources?: string[]; + /** Defines the move resource input type. */ + moveResourceInputType?: MoveResourceInputType; +} + +/** Collection of ClientDiscovery details. */ +export interface OperationsDiscoveryCollection { + /** Gets or sets the ClientDiscovery details. */ + value?: OperationsDiscovery[]; + /** Gets or sets the value of next link. */ + nextLink?: string; +} + +/** Operations discovery class. */ +export interface OperationsDiscovery { /** - * Gets or sets the list of source Ids for which the input resource is required. + * Gets or sets Name of the API. + * The name of the operation being performed on this particular object. It should + * match the action name that appears in RBAC / the event service. + * Examples of operations include: + * * Microsoft.Compute/virtualMachine/capture/action + * * Microsoft.Compute/virtualMachine/restart/action + * * Microsoft.Compute/virtualMachine/write + * * Microsoft.Compute/virtualMachine/read + * * Microsoft.Compute/virtualMachine/delete + * Each action should include, in order: + * (1) Resource Provider Namespace + * (2) Type hierarchy for which the action applies (e.g. server/databases for a SQL + * Azure database) + * (3) Read, Write, Action or Delete indicating which type applies. If it is a PUT/PATCH + * on a collection or named value, Write should be used. + * If it is a GET, Read should be used. If it is a DELETE, Delete should be used. If it + * is a POST, Action should be used. + * As a note: all resource providers would need to include the "{Resource Provider + * Namespace}/register/action" operation in their response. + * This API is used to register for their service, and should include details about the + * operation (e.g. a localized name for the resource provider + any special + * considerations like PII release). */ - sourceIds?: string[]; + name?: string; + /** Indicates whether the operation is a data action */ + isDataAction?: boolean; + /** + * Contains the localized display information for this particular operation / action. These + * value will be used by several clients for + * (1) custom role definitions for RBAC; + * (2) complex query filters for the event service; and + * (3) audit history / records for management operations. + */ + display?: Display; + /** + * Gets or sets Origin. + * The intended executor of the operation; governs the display of the operation in the + * RBAC UX and the audit logs UX. + * Default value is "user,system". + */ + origin?: string; + /** Any object */ + properties?: Record; } /** @@ -574,289 +641,95 @@ export interface Display { * Perform any other action on any 'display.provider' resource * Prescriptive guidance for namespace: * Read any 'display.resource' Create or Update any 'display.resource' Delete any - * 'display.resource' 'ActionName' any 'display.resources'. + * 'display.resource' 'ActionName' any 'display.resources'. */ description?: string; } -/** - * Operations discovery class. - */ -export interface OperationsDiscovery { - /** - * Gets or sets Name of the API. - * The name of the operation being performed on this particular object. It should - * match the action name that appears in RBAC / the event service. - * Examples of operations include: - * * Microsoft.Compute/virtualMachine/capture/action - * * Microsoft.Compute/virtualMachine/restart/action - * * Microsoft.Compute/virtualMachine/write - * * Microsoft.Compute/virtualMachine/read - * * Microsoft.Compute/virtualMachine/delete - * Each action should include, in order: - * (1) Resource Provider Namespace - * (2) Type hierarchy for which the action applies (e.g. server/databases for a SQL - * Azure database) - * (3) Read, Write, Action or Delete indicating which type applies. If it is a PUT/PATCH - * on a collection or named value, Write should be used. - * If it is a GET, Read should be used. If it is a DELETE, Delete should be used. If it - * is a POST, Action should be used. - * As a note: all resource providers would need to include the "{Resource Provider - * Namespace}/register/action" operation in their response. - * This API is used to register for their service, and should include details about the - * operation (e.g. a localized name for the resource provider + any special - * considerations like PII release). - */ - name?: string; - /** - * Indicates whether the operation is a data action - */ - isDataAction?: boolean; - display?: Display; - /** - * Gets or sets Origin. - * The intended executor of the operation; governs the display of the operation in the - * RBAC UX and the audit logs UX. - * Default value is "user,system". - */ - origin?: string; - properties?: any; -} - -/** - * Collection of ClientDiscovery details. - */ -export interface OperationsDiscoveryCollection { - /** - * Gets or sets the ClientDiscovery details. - */ - value?: OperationsDiscovery[]; - /** - * Gets or sets the value of next link. - */ +/** Defines the collection of move collections. */ +export interface MoveCollectionResultList { + /** Gets the list of move collections. */ + value?: MoveCollection[]; + /** Gets the value of next link. */ nextLink?: string; } -/** - * Gets or sets the virtual machine resource settings. - */ -export interface VirtualMachineResourceSettings { - /** - * Polymorphic Discriminator - */ - resourceType: "Microsoft.Compute/virtualMachines"; - /** - * Gets or sets the target Resource name. - */ - targetResourceName: string; - /** - * Gets or sets the target availability zone. Possible values include: '1', '2', '3', 'NA' - */ - targetAvailabilityZone?: TargetAvailabilityZone; - /** - * Gets or sets the target virtual machine size. - */ - targetVmSize?: string; - /** - * Gets or sets the target availability set id for virtual machines not in an availability set at - * source. - */ - targetAvailabilitySetId?: string; +/** Required for resources collection. */ +export interface RequiredForResourcesCollection { + /** Gets or sets the list of source Ids for which the input resource is required. */ + sourceIds?: string[]; } -/** - * Gets or sets the availability set resource settings. - */ -export interface AvailabilitySetResourceSettings { - /** - * Polymorphic Discriminator - */ - resourceType: "Microsoft.Compute/availabilitySets"; - /** - * Gets or sets the target Resource name. - */ - targetResourceName: string; - /** - * Gets or sets the target fault domain. - */ - faultDomain?: number; - /** - * Gets or sets the target update domain. - */ - updateDomain?: number; +/** Move resource filter. */ +export interface MoveResourceFilter { + properties?: MoveResourceFilterProperties; } -/** - * Defines reference to an Azure resource. - */ -export interface AzureResourceReference { - /** - * Gets the ARM resource ID of the tracked resource being referenced. - */ - sourceArmResourceId: string; +export interface MoveResourceFilterProperties { + /** The provisioning state. */ + provisioningState?: string; } -/** - * Defines reference to NSG. - */ -export interface NsgReference extends AzureResourceReference { +/** Unresolved dependencies contract. */ +export interface UnresolvedDependenciesFilter { + properties?: UnresolvedDependenciesFilterProperties; } -/** - * Defines the virtual network subnets resource settings. - */ +export interface UnresolvedDependenciesFilterProperties { + /** The count of the resource. */ + count?: number; +} + +/** Defines the virtual network subnets resource settings. */ export interface SubnetResourceSettings { - /** - * Gets or sets the Subnet name. - */ + /** Gets or sets the Subnet name. */ name?: string; - /** - * Gets or sets address prefix for the subnet. - */ + /** Gets or sets address prefix for the subnet. */ addressPrefix?: string; + /** Defines reference to NSG. */ networkSecurityGroup?: NsgReference; } -/** - * Defines the virtual network resource settings. - */ -export interface VirtualNetworkResourceSettings { - /** - * Polymorphic Discriminator - */ - resourceType: "Microsoft.Network/virtualNetworks"; - /** - * Gets or sets the target Resource name. - */ - targetResourceName: string; - /** - * Gets or sets a value indicating whether gets or sets whether the - * DDOS protection should be switched on. - */ - enableDdosProtection?: boolean; - /** - * Gets or sets the address prefixes for the virtual network. - */ - addressSpace?: string[]; - /** - * Gets or sets DHCPOptions that contains an array of DNS servers available to VMs - * deployed in the virtual network. - */ - dnsServers?: string[]; - /** - * Gets or sets List of subnets in a VirtualNetwork. - */ - subnets?: SubnetResourceSettings[]; +/** Defines reference to an Azure resource. */ +export interface AzureResourceReference { + /** Gets the ARM resource ID of the tracked resource being referenced. */ + sourceArmResourceId: string; } -/** - * Defines reference to a proxy resource. - */ -export interface ProxyResourceReference extends AzureResourceReference { - /** - * Gets the name of the proxy resource on the target side. - */ - name?: string; -} - -/** - * Defines reference to subnet. - */ -export interface SubnetReference extends ProxyResourceReference { -} - -/** - * Defines reference to load balancer backend address pools. - */ -export interface LoadBalancerBackendAddressPoolReference extends ProxyResourceReference { -} - -/** - * Defines reference to load balancer NAT rules. - */ -export interface LoadBalancerNatRuleReference extends ProxyResourceReference { -} - -/** - * Defines reference to a public IP. - */ -export interface PublicIpReference extends AzureResourceReference { -} - -/** - * Defines NIC IP configuration properties. - */ +/** Defines NIC IP configuration properties. */ export interface NicIpConfigurationResourceSettings { - /** - * Gets or sets the IP configuration name. - */ + /** Gets or sets the IP configuration name. */ name?: string; - /** - * Gets or sets the private IP address of the network interface IP Configuration. - */ + /** Gets or sets the private IP address of the network interface IP Configuration. */ privateIpAddress?: string; - /** - * Gets or sets the private IP address allocation method. - */ + /** Gets or sets the private IP address allocation method. */ privateIpAllocationMethod?: string; + /** Defines reference to subnet. */ subnet?: SubnetReference; - /** - * Gets or sets a value indicating whether this IP configuration is the primary. - */ + /** Gets or sets a value indicating whether this IP configuration is the primary. */ primary?: boolean; - /** - * Gets or sets the references of the load balancer backend address pools. - */ + /** Gets or sets the references of the load balancer backend address pools. */ loadBalancerBackendAddressPools?: LoadBalancerBackendAddressPoolReference[]; - /** - * Gets or sets the references of the load balancer NAT rules. - */ + /** Gets or sets the references of the load balancer NAT rules. */ loadBalancerNatRules?: LoadBalancerNatRuleReference[]; + /** Defines reference to a public IP. */ publicIp?: PublicIpReference; } -/** - * Defines the network interface resource settings. - */ -export interface NetworkInterfaceResourceSettings { - /** - * Polymorphic Discriminator - */ - resourceType: "Microsoft.Network/networkInterfaces"; - /** - * Gets or sets the target Resource name. - */ - targetResourceName: string; - /** - * Gets or sets the IP configurations of the NIC. - */ - ipConfigurations?: NicIpConfigurationResourceSettings[]; - /** - * Gets or sets a value indicating whether accelerated networking is enabled. - */ - enableAcceleratedNetworking?: boolean; -} - -/** - * Security Rule data model for Network Security Groups. - */ +/** Security Rule data model for Network Security Groups. */ export interface NsgSecurityRule { - /** - * Gets or sets the Security rule name. - */ + /** Gets or sets the Security rule name. */ name?: string; /** * Gets or sets whether network traffic is allowed or denied. * Possible values are “Allow” and “Deny”. */ access?: string; - /** - * Gets or sets a description for this rule. Restricted to 140 chars. - */ + /** Gets or sets a description for this rule. Restricted to 140 chars. */ description?: string; /** * Gets or sets destination address prefix. CIDR or source IP range. - * A “*” can also be used to match all source IPs. Default tags such + * A “*” can also be used to match all source IPs. Default tags such * as ‘VirtualNetwork’, ‘AzureLoadBalancer’ and ‘Internet’ can also be used. */ destinationAddressPrefix?: string; @@ -876,9 +749,7 @@ export interface NsgSecurityRule { * The lower the priority number, the higher the priority of the rule. */ priority?: number; - /** - * Gets or sets Network protocol this rule applies to. Can be Tcp, Udp or All(*). - */ + /** Gets or sets Network protocol this rule applies to. Can be Tcp, Udp or All(*). */ protocol?: string; /** * Gets or sets source address prefix. CIDR or source IP range. A @@ -894,1269 +765,677 @@ export interface NsgSecurityRule { sourcePortRange?: string; } -/** - * Defines the NSG resource settings. - */ -export interface NetworkSecurityGroupResourceSettings { - /** - * Polymorphic Discriminator - */ - resourceType: "Microsoft.Network/networkSecurityGroups"; - /** - * Gets or sets the target Resource name. - */ - targetResourceName: string; - /** - * Gets or sets Security rules of network security group. - */ - securityRules?: NsgSecurityRule[]; -} - -/** - * Defines load balancer frontend IP configuration properties. - */ +/** Defines load balancer frontend IP configuration properties. */ export interface LBFrontendIPConfigurationResourceSettings { - /** - * Gets or sets the frontend IP configuration name. - */ + /** Gets or sets the frontend IP configuration name. */ name?: string; /** * Gets or sets the IP address of the Load Balancer.This is only specified if a specific * private IP address shall be allocated from the subnet specified in subnetRef. */ privateIpAddress?: string; - /** - * Gets or sets PrivateIP allocation method (Static/Dynamic). - */ + /** Gets or sets PrivateIP allocation method (Static/Dynamic). */ privateIpAllocationMethod?: string; + /** Defines reference to subnet. */ subnet?: SubnetReference; - /** - * Gets or sets the csv list of zones. - */ + /** Gets or sets the csv list of zones. */ zones?: string; } -/** - * Defines load balancer backend address pool properties. - */ +/** Defines load balancer backend address pool properties. */ export interface LBBackendAddressPoolResourceSettings { - /** - * Gets or sets the backend address pool name. - */ + /** Gets or sets the backend address pool name. */ name?: string; } -/** - * Defines the load balancer resource settings. - */ -export interface LoadBalancerResourceSettings { +/** Defines the move collection errors. */ +export type MoveCollectionPropertiesErrors = MoveResourceError & {}; + +/** Defines the move resource errors. */ +export type MoveResourcePropertiesErrors = MoveResourceError & {}; + +/** Gets or sets the virtual machine resource settings. */ +export type VirtualMachineResourceSettings = ResourceSettings & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + resourceType: "Microsoft.Compute/virtualMachines"; + /** Gets or sets the Resource tags. */ + tags?: { [propertyName: string]: string }; + /** Gets or sets user-managed identities */ + userManagedIdentities?: string[]; + /** Gets or sets the target availability zone. */ + targetAvailabilityZone?: TargetAvailabilityZone; + /** Gets or sets the target virtual machine size. */ + targetVmSize?: string; + /** Gets or sets the target availability set id for virtual machines not in an availability set at source. */ + targetAvailabilitySetId?: string; +}; + +/** Gets or sets the availability set resource settings. */ +export type AvailabilitySetResourceSettings = ResourceSettings & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + resourceType: "Microsoft.Compute/availabilitySets"; + /** Gets or sets the Resource tags. */ + tags?: { [propertyName: string]: string }; + /** Gets or sets the target fault domain. */ + faultDomain?: number; + /** Gets or sets the target update domain. */ + updateDomain?: number; +}; + +/** Defines the virtual network resource settings. */ +export type VirtualNetworkResourceSettings = ResourceSettings & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + resourceType: "Microsoft.Network/virtualNetworks"; + /** Gets or sets the Resource tags. */ + tags?: { [propertyName: string]: string }; /** - * Polymorphic Discriminator + * Gets or sets a value indicating whether gets or sets whether the + * DDOS protection should be switched on. */ + enableDdosProtection?: boolean; + /** Gets or sets the address prefixes for the virtual network. */ + addressSpace?: string[]; + /** + * Gets or sets DHCPOptions that contains an array of DNS servers available to VMs + * deployed in the virtual network. + */ + dnsServers?: string[]; + /** Gets or sets List of subnets in a VirtualNetwork. */ + subnets?: SubnetResourceSettings[]; +}; + +/** Defines the network interface resource settings. */ +export type NetworkInterfaceResourceSettings = ResourceSettings & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + resourceType: "Microsoft.Network/networkInterfaces"; + /** Gets or sets the Resource tags. */ + tags?: { [propertyName: string]: string }; + /** Gets or sets the IP configurations of the NIC. */ + ipConfigurations?: NicIpConfigurationResourceSettings[]; + /** Gets or sets a value indicating whether accelerated networking is enabled. */ + enableAcceleratedNetworking?: boolean; +}; + +/** Defines the NSG resource settings. */ +export type NetworkSecurityGroupResourceSettings = ResourceSettings & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + resourceType: "Microsoft.Network/networkSecurityGroups"; + /** Gets or sets the Resource tags. */ + tags?: { [propertyName: string]: string }; + /** Gets or sets Security rules of network security group. */ + securityRules?: NsgSecurityRule[]; +}; + +/** Defines the load balancer resource settings. */ +export type LoadBalancerResourceSettings = ResourceSettings & { + /** Polymorphic discriminator, which specifies the different types this object can be */ resourceType: "Microsoft.Network/loadBalancers"; - /** - * Gets or sets the target Resource name. - */ - targetResourceName: string; - /** - * Gets or sets load balancer sku (Basic/Standard). - */ + /** Gets or sets the Resource tags. */ + tags?: { [propertyName: string]: string }; + /** Gets or sets load balancer sku (Basic/Standard). */ sku?: string; - /** - * Gets or sets the frontend IP configurations of the load balancer. - */ + /** Gets or sets the frontend IP configurations of the load balancer. */ frontendIPConfigurations?: LBFrontendIPConfigurationResourceSettings[]; - /** - * Gets or sets the backend address pools of the load balancer. - */ + /** Gets or sets the backend address pools of the load balancer. */ backendAddressPools?: LBBackendAddressPoolResourceSettings[]; /** - * Gets or sets the csv list of zones common for all frontend IP configurations. Note this is - * given - * precedence only if frontend IP configurations settings are not present. + * Gets or sets the csv list of zones common for all frontend IP configurations. Note this is given + * precedence only if frontend IP configurations settings are not present. */ zones?: string; -} +}; -/** - * Defines the SQL Server resource settings. - */ -export interface SqlServerResourceSettings { - /** - * Polymorphic Discriminator - */ +/** Defines the SQL Server resource settings. */ +export type SqlServerResourceSettings = ResourceSettings & { + /** Polymorphic discriminator, which specifies the different types this object can be */ resourceType: "Microsoft.Sql/servers"; - /** - * Gets or sets the target Resource name. - */ - targetResourceName: string; -} +}; -/** - * Defines the Sql ElasticPool resource settings. - */ -export interface SqlElasticPoolResourceSettings { - /** - * Polymorphic Discriminator - */ +/** Defines the Sql ElasticPool resource settings. */ +export type SqlElasticPoolResourceSettings = ResourceSettings & { + /** Polymorphic discriminator, which specifies the different types this object can be */ resourceType: "Microsoft.Sql/servers/elasticPools"; - /** - * Gets or sets the target Resource name. - */ - targetResourceName: string; - /** - * Possible values include: 'Enable', 'Disable' - */ + /** Gets or sets the Resource tags. */ + tags?: { [propertyName: string]: string }; + /** Defines the zone redundant resource setting. */ zoneRedundant?: ZoneRedundant; -} +}; -/** - * Defines the Sql Database resource settings. - */ -export interface SqlDatabaseResourceSettings { - /** - * Polymorphic Discriminator - */ +/** Defines the Sql Database resource settings. */ +export type SqlDatabaseResourceSettings = ResourceSettings & { + /** Polymorphic discriminator, which specifies the different types this object can be */ resourceType: "Microsoft.Sql/servers/databases"; - /** - * Gets or sets the target Resource name. - */ - targetResourceName: string; - /** - * Possible values include: 'Enable', 'Disable' - */ + /** Gets or sets the Resource tags. */ + tags?: { [propertyName: string]: string }; + /** Defines the zone redundant resource setting. */ zoneRedundant?: ZoneRedundant; -} +}; -/** - * Defines the resource group resource settings. - */ -export interface ResourceGroupResourceSettings { - /** - * Polymorphic Discriminator - */ +/** Defines the resource group resource settings. */ +export type ResourceGroupResourceSettings = ResourceSettings & { + /** Polymorphic discriminator, which specifies the different types this object can be */ resourceType: "resourceGroups"; - /** - * Gets or sets the target Resource name. - */ - targetResourceName: string; -} +}; -/** - * Defines the public IP address resource settings. - */ -export interface PublicIPAddressResourceSettings { - /** - * Polymorphic Discriminator - */ +/** Defines the public IP address resource settings. */ +export type PublicIPAddressResourceSettings = ResourceSettings & { + /** Polymorphic discriminator, which specifies the different types this object can be */ resourceType: "Microsoft.Network/publicIPAddresses"; - /** - * Gets or sets the target Resource name. - */ - targetResourceName: string; - /** - * Gets or sets the domain name label. - */ + /** Gets or sets the Resource tags. */ + tags?: { [propertyName: string]: string }; + /** Gets or sets the domain name label. */ domainNameLabel?: string; - /** - * Gets or sets the fully qualified domain name. - */ + /** Gets or sets the fully qualified domain name. */ fqdn?: string; - /** - * Gets or sets public IP allocation method. - */ + /** Gets or sets public IP allocation method. */ publicIpAllocationMethod?: string; - /** - * Gets or sets public IP sku. - */ + /** Gets or sets public IP sku. */ sku?: string; - /** - * Gets or sets public IP zones. - */ + /** Gets or sets public IP zones. */ zones?: string; -} +}; -/** - * Defines the key vault resource settings. - */ -export interface KeyVaultResourceSettings { - /** - * Polymorphic Discriminator - */ +/** Defines the key vault resource settings. */ +export type KeyVaultResourceSettings = ResourceSettings & { + /** Polymorphic discriminator, which specifies the different types this object can be */ resourceType: "Microsoft.KeyVault/vaults"; - /** - * Gets or sets the target Resource name. - */ - targetResourceName: string; -} +}; -/** - * Defines the disk encryption set resource settings. - */ -export interface DiskEncryptionSetResourceSettings { - /** - * Polymorphic Discriminator - */ +/** Defines the disk encryption set resource settings. */ +export type DiskEncryptionSetResourceSettings = ResourceSettings & { + /** Polymorphic discriminator, which specifies the different types this object can be */ resourceType: "Microsoft.Compute/diskEncryptionSets"; - /** - * Gets or sets the target Resource name. - */ - targetResourceName: string; +}; + +/** Defines the move resource status. */ +export type MoveResourcePropertiesMoveStatus = MoveResourceStatus & {}; + +/** Defines reference to NSG. */ +export type NsgReference = AzureResourceReference & {}; + +/** Defines reference to a proxy resource. */ +export type ProxyResourceReference = AzureResourceReference & { + /** Gets the name of the proxy resource on the target side. */ + name?: string; +}; + +/** Defines reference to a public IP. */ +export type PublicIpReference = AzureResourceReference & {}; + +/** Defines reference to subnet. */ +export type SubnetReference = ProxyResourceReference & {}; + +/** Defines reference to load balancer backend address pools. */ +export type LoadBalancerBackendAddressPoolReference = ProxyResourceReference & {}; + +/** Defines reference to load balancer NAT rules. */ +export type LoadBalancerNatRuleReference = ProxyResourceReference & {}; + +/** Known values of {@link ResourceIdentityType} that the service accepts. */ +export enum KnownResourceIdentityType { + None = "None", + SystemAssigned = "SystemAssigned", + UserAssigned = "UserAssigned" } /** - * The RP custom operation error info. + * Defines values for ResourceIdentityType. \ + * {@link KnownResourceIdentityType} can be used interchangeably with ResourceIdentityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **SystemAssigned** \ + * **UserAssigned** */ -export interface AffectedMoveResource { - /** - * The affected move resource id. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * The affected move resource source id. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly sourceId?: string; - /** - * The affected move resources. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly moveResources?: AffectedMoveResource[]; +export type ResourceIdentityType = string; + +/** Known values of {@link ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + Succeeded = "Succeeded", + Updating = "Updating", + Creating = "Creating", + Failed = "Failed" } /** - * The move custom error info. + * Defines values for ProvisioningState. \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Updating** \ + * **Creating** \ + * **Failed** */ -export interface MoveErrorInfo { - /** - * The affected move resources. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly moveResources?: AffectedMoveResource[]; +export type ProvisioningState = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + User = "User", + Application = "Application", + ManagedIdentity = "ManagedIdentity", + Key = "Key" } /** - * The operation error info. + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** */ -export interface OperationErrorAdditionalInfo { - /** - * The error type. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * The operation error info. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly info?: MoveErrorInfo; +export type CreatedByType = string; + +/** Known values of {@link MoveResourceInputType} that the service accepts. */ +export enum KnownMoveResourceInputType { + MoveResourceId = "MoveResourceId", + MoveResourceSourceId = "MoveResourceSourceId" } /** - * Class for operation status errors. + * Defines values for MoveResourceInputType. \ + * {@link KnownMoveResourceInputType} can be used interchangeably with MoveResourceInputType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **MoveResourceId** \ + * **MoveResourceSourceId** */ -export interface OperationStatusError { - /** - * The error code. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly code?: string; - /** - * The error message. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly message?: string; - /** - * The error details. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly details?: OperationStatusError[]; - /** - * The additional info. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly additionalInfo?: OperationErrorAdditionalInfo[]; +export type MoveResourceInputType = string; + +/** Known values of {@link MoveState} that the service accepts. */ +export enum KnownMoveState { + AssignmentPending = "AssignmentPending", + PreparePending = "PreparePending", + PrepareInProgress = "PrepareInProgress", + PrepareFailed = "PrepareFailed", + MovePending = "MovePending", + MoveInProgress = "MoveInProgress", + MoveFailed = "MoveFailed", + DiscardInProgress = "DiscardInProgress", + DiscardFailed = "DiscardFailed", + CommitPending = "CommitPending", + CommitInProgress = "CommitInProgress", + CommitFailed = "CommitFailed", + Committed = "Committed", + DeleteSourcePending = "DeleteSourcePending", + ResourceMoveCompleted = "ResourceMoveCompleted" } /** - * Operation status REST resource. + * Defines values for MoveState. \ + * {@link KnownMoveState} can be used interchangeably with MoveState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **AssignmentPending** \ + * **PreparePending** \ + * **PrepareInProgress** \ + * **PrepareFailed** \ + * **MovePending** \ + * **MoveInProgress** \ + * **MoveFailed** \ + * **DiscardInProgress** \ + * **DiscardFailed** \ + * **CommitPending** \ + * **CommitInProgress** \ + * **CommitFailed** \ + * **Committed** \ + * **DeleteSourcePending** \ + * **ResourceMoveCompleted** */ -export interface OperationStatus { - /** - * Resource Id. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * Operation name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * Status of the operation. ARM expects the terminal status to be one of Succeeded/ Failed/ - * Canceled. All other values imply that the operation is still running. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly status?: string; - /** - * Start time. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly startTime?: string; - /** - * End time. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly endTime?: string; - /** - * Error stating all error details for the operation. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly error?: OperationStatusError; - /** - * Custom data. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly properties?: any; +export type MoveState = string; + +/** Known values of {@link JobName} that the service accepts. */ +export enum KnownJobName { + InitialSync = "InitialSync" } /** - * Optional Parameters. + * Defines values for JobName. \ + * {@link KnownJobName} can be used interchangeably with JobName, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **InitialSync** */ -export interface MoveCollectionsCreateOptionalParams extends msRest.RequestOptionsBase { +export type JobName = string; + +/** Known values of {@link ResolutionType} that the service accepts. */ +export enum KnownResolutionType { + Manual = "Manual", + Automatic = "Automatic" +} + +/** + * Defines values for ResolutionType. \ + * {@link KnownResolutionType} can be used interchangeably with ResolutionType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Manual** \ + * **Automatic** + */ +export type ResolutionType = string; + +/** Known values of {@link DependencyType} that the service accepts. */ +export enum KnownDependencyType { + RequiredForPrepare = "RequiredForPrepare", + RequiredForMove = "RequiredForMove" +} + +/** + * Defines values for DependencyType. \ + * {@link KnownDependencyType} can be used interchangeably with DependencyType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **RequiredForPrepare** \ + * **RequiredForMove** + */ +export type DependencyType = string; + +/** Known values of {@link DependencyLevel} that the service accepts. */ +export enum KnownDependencyLevel { + Direct = "Direct", + Descendant = "Descendant" +} + +/** + * Defines values for DependencyLevel. \ + * {@link KnownDependencyLevel} can be used interchangeably with DependencyLevel, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Direct** \ + * **Descendant** + */ +export type DependencyLevel = string; + +/** Known values of {@link TargetAvailabilityZone} that the service accepts. */ +export enum KnownTargetAvailabilityZone { + One = "1", + Two = "2", + Three = "3", + NA = "NA" +} + +/** + * Defines values for TargetAvailabilityZone. \ + * {@link KnownTargetAvailabilityZone} can be used interchangeably with TargetAvailabilityZone, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **1** \ + * **2** \ + * **3** \ + * **NA** + */ +export type TargetAvailabilityZone = string; + +/** Known values of {@link ZoneRedundant} that the service accepts. */ +export enum KnownZoneRedundant { + Enable = "Enable", + Disable = "Disable" +} + +/** + * Defines values for ZoneRedundant. \ + * {@link KnownZoneRedundant} can be used interchangeably with ZoneRedundant, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Enable** \ + * **Disable** + */ +export type ZoneRedundant = string; + +/** Optional parameters. */ +export interface MoveCollectionsCreateOptionalParams + extends coreClient.OperationOptions { + /** Define the move collection. */ body?: MoveCollection; } -/** - * Optional Parameters. - */ -export interface MoveCollectionsUpdateOptionalParams extends msRest.RequestOptionsBase { +/** Contains response data for the create operation. */ +export type MoveCollectionsCreateResponse = MoveCollection; + +/** Optional parameters. */ +export interface MoveCollectionsUpdateOptionalParams + extends coreClient.OperationOptions { + /** Defines the request body for updating move collection. */ body?: UpdateMoveCollectionRequest; } -/** - * Optional Parameters. - */ -export interface MoveCollectionsPrepareOptionalParams extends msRest.RequestOptionsBase { +/** Contains response data for the update operation. */ +export type MoveCollectionsUpdateResponse = MoveCollection; + +/** Optional parameters. */ +export interface MoveCollectionsDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the delete operation. */ +export type MoveCollectionsDeleteResponse = OperationStatus; + +/** Optional parameters. */ +export interface MoveCollectionsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type MoveCollectionsGetResponse = MoveCollection; + +/** Optional parameters. */ +export interface MoveCollectionsPrepareOptionalParams + extends coreClient.OperationOptions { + /** Defines the request body for initiate prepare operation. */ body?: PrepareRequest; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; } -/** - * Optional Parameters. - */ -export interface MoveCollectionsInitiateMoveOptionalParams extends msRest.RequestOptionsBase { +/** Contains response data for the prepare operation. */ +export type MoveCollectionsPrepareResponse = OperationStatus; + +/** Optional parameters. */ +export interface MoveCollectionsInitiateMoveOptionalParams + extends coreClient.OperationOptions { + /** Defines the request body for resource move operation. */ body?: ResourceMoveRequest; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; } -/** - * Optional Parameters. - */ -export interface MoveCollectionsCommitOptionalParams extends msRest.RequestOptionsBase { +/** Contains response data for the initiateMove operation. */ +export type MoveCollectionsInitiateMoveResponse = OperationStatus; + +/** Optional parameters. */ +export interface MoveCollectionsCommitOptionalParams + extends coreClient.OperationOptions { + /** Defines the request body for commit operation. */ body?: CommitRequest; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; } -/** - * Optional Parameters. - */ -export interface MoveCollectionsDiscardOptionalParams extends msRest.RequestOptionsBase { +/** Contains response data for the commit operation. */ +export type MoveCollectionsCommitResponse = OperationStatus; + +/** Optional parameters. */ +export interface MoveCollectionsDiscardOptionalParams + extends coreClient.OperationOptions { + /** Defines the request body for discard operation. */ body?: DiscardRequest; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; } -/** - * Optional Parameters. - */ -export interface MoveCollectionsBulkRemoveOptionalParams extends msRest.RequestOptionsBase { +/** Contains response data for the discard operation. */ +export type MoveCollectionsDiscardResponse = OperationStatus; + +/** Optional parameters. */ +export interface MoveCollectionsResolveDependenciesOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the resolveDependencies operation. */ +export type MoveCollectionsResolveDependenciesResponse = OperationStatus; + +/** Optional parameters. */ +export interface MoveCollectionsBulkRemoveOptionalParams + extends coreClient.OperationOptions { + /** Defines the request body for bulk remove of move resources operation. */ body?: BulkRemoveRequest; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; } -/** - * Optional Parameters. - */ -export interface MoveCollectionsBeginPrepareOptionalParams extends msRest.RequestOptionsBase { - body?: PrepareRequest; -} +/** Contains response data for the bulkRemove operation. */ +export type MoveCollectionsBulkRemoveResponse = OperationStatus; -/** - * Optional Parameters. - */ -export interface MoveCollectionsBeginInitiateMoveOptionalParams extends msRest.RequestOptionsBase { - body?: ResourceMoveRequest; -} +/** Optional parameters. */ +export interface MoveCollectionsListMoveCollectionsBySubscriptionOptionalParams + extends coreClient.OperationOptions {} -/** - * Optional Parameters. - */ -export interface MoveCollectionsBeginCommitOptionalParams extends msRest.RequestOptionsBase { - body?: CommitRequest; -} +/** Contains response data for the listMoveCollectionsBySubscription operation. */ +export type MoveCollectionsListMoveCollectionsBySubscriptionResponse = MoveCollectionResultList; -/** - * Optional Parameters. - */ -export interface MoveCollectionsBeginDiscardOptionalParams extends msRest.RequestOptionsBase { - body?: DiscardRequest; -} +/** Optional parameters. */ +export interface MoveCollectionsListMoveCollectionsByResourceGroupOptionalParams + extends coreClient.OperationOptions {} -/** - * Optional Parameters. - */ -export interface MoveCollectionsBeginBulkRemoveOptionalParams extends msRest.RequestOptionsBase { - body?: BulkRemoveRequest; -} +/** Contains response data for the listMoveCollectionsByResourceGroup operation. */ +export type MoveCollectionsListMoveCollectionsByResourceGroupResponse = MoveCollectionResultList; -/** - * Optional Parameters. - */ -export interface MoveResourcesListOptionalParams extends msRest.RequestOptionsBase { - /** - * The filter to apply on the operation. For example, you can use - * $filter=Properties/ProvisioningState eq 'Succeeded'. - */ +/** Optional parameters. */ +export interface MoveCollectionsListRequiredForOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listRequiredFor operation. */ +export type MoveCollectionsListRequiredForResponse = RequiredForResourcesCollection; + +/** Optional parameters. */ +export interface MoveCollectionsListMoveCollectionsBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listMoveCollectionsBySubscriptionNext operation. */ +export type MoveCollectionsListMoveCollectionsBySubscriptionNextResponse = MoveCollectionResultList; + +/** Optional parameters. */ +export interface MoveCollectionsListMoveCollectionsByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listMoveCollectionsByResourceGroupNext operation. */ +export type MoveCollectionsListMoveCollectionsByResourceGroupNextResponse = MoveCollectionResultList; + +/** Optional parameters. */ +export interface MoveResourcesListOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. For example, you can use $filter=Properties/ProvisioningState eq 'Succeeded'. */ filter?: string; } -/** - * Optional Parameters. - */ -export interface MoveResourcesCreateOptionalParams extends msRest.RequestOptionsBase { - properties?: MoveResourceProperties; +/** Contains response data for the list operation. */ +export type MoveResourcesListResponse = MoveResourceCollection; + +/** Optional parameters. */ +export interface MoveResourcesCreateOptionalParams + extends coreClient.OperationOptions { + /** Defines the move resource. */ + body?: MoveResource; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; } -/** - * Optional Parameters. - */ -export interface MoveResourcesBeginCreateOptionalParams extends msRest.RequestOptionsBase { - properties?: MoveResourceProperties; +/** Contains response data for the create operation. */ +export type MoveResourcesCreateResponse = MoveResource; + +/** Optional parameters. */ +export interface MoveResourcesDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; } -/** - * Optional Parameters. - */ -export interface MoveResourcesListNextOptionalParams extends msRest.RequestOptionsBase { - /** - * The filter to apply on the operation. For example, you can use - * $filter=Properties/ProvisioningState eq 'Succeeded'. - */ +/** Contains response data for the delete operation. */ +export type MoveResourcesDeleteResponse = OperationStatus; + +/** Optional parameters. */ +export interface MoveResourcesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type MoveResourcesGetResponse = MoveResource; + +/** Optional parameters. */ +export interface MoveResourcesListNextOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. For example, you can use $filter=Properties/ProvisioningState eq 'Succeeded'. */ filter?: string; } -/** - * Optional Parameters. - */ -export interface UnresolvedDependenciesGetOptionalParams extends msRest.RequestOptionsBase { - /** - * Defines the dependency level. Possible values include: 'Direct', 'Descendant' - */ +/** Contains response data for the listNext operation. */ +export type MoveResourcesListNextResponse = MoveResourceCollection; + +/** Optional parameters. */ +export interface UnresolvedDependenciesGetOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. For example, $apply=filter(count eq 2). */ + filter?: string; + /** Defines the dependency level. */ dependencyLevel?: DependencyLevel; - /** - * OData order by query option. For example, you can use $orderby=Count desc. - */ + /** OData order by query option. For example, you can use $orderby=Count desc. */ orderby?: string; - /** - * The filter to apply on the operation. For example, $apply=filter(count eq 2). - */ - filter?: string; } -/** - * Optional Parameters. - */ -export interface UnresolvedDependenciesGetNextOptionalParams extends msRest.RequestOptionsBase { - /** - * Defines the dependency level. Possible values include: 'Direct', 'Descendant' - */ +/** Contains response data for the get operation. */ +export type UnresolvedDependenciesGetResponse = UnresolvedDependencyCollection; + +/** Optional parameters. */ +export interface UnresolvedDependenciesGetNextOptionalParams + extends coreClient.OperationOptions { + /** The filter to apply on the operation. For example, $apply=filter(count eq 2). */ + filter?: string; + /** Defines the dependency level. */ dependencyLevel?: DependencyLevel; - /** - * OData order by query option. For example, you can use $orderby=Count desc. - */ + /** OData order by query option. For example, you can use $orderby=Count desc. */ orderby?: string; - /** - * The filter to apply on the operation. For example, $apply=filter(count eq 2). - */ - filter?: string; } -/** - * An interface representing ResourceMoverServiceAPIOptions. - */ -export interface ResourceMoverServiceAPIOptions extends AzureServiceClientOptions { - baseUri?: string; +/** Contains response data for the getNext operation. */ +export type UnresolvedDependenciesGetNextResponse = UnresolvedDependencyCollection; + +/** Optional parameters. */ +export interface OperationsDiscoveryGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type OperationsDiscoveryGetResponse = OperationsDiscoveryCollection; + +/** Optional parameters. */ +export interface ResourceMoverServiceAPIOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; } - -/** - * @interface - * Defines the collection of move collections. - * @extends Array - */ -export interface MoveCollectionResultList extends Array { - /** - * Gets the value of next link. - */ - nextLink?: string; -} - -/** - * @interface - * Defines the collection of move resources. - * @extends Array - */ -export interface MoveResourceCollection extends Array { - /** - * Gets the value of next link. - */ - nextLink?: string; - /** - * Gets or sets the list of summary items and the field on which summary is done. - */ - summaryCollection?: SummaryCollection; - /** - * Gets the total count. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly totalCount?: number; -} - -/** - * @interface - * Unresolved dependency collection. - * @extends Array - */ -export interface UnresolvedDependencyCollection extends Array { - /** - * Gets or sets the value of next link. - */ - nextLink?: string; - /** - * Gets or sets the list of summary items and the field on which summary is done. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly summaryCollection?: SummaryCollection; - /** - * Gets the total count. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly totalCount?: number; -} - -/** - * Defines values for ResourceIdentityType. - * Possible values include: 'None', 'SystemAssigned', 'UserAssigned' - * @readonly - * @enum {string} - */ -export type ResourceIdentityType = 'None' | 'SystemAssigned' | 'UserAssigned'; - -/** - * Defines values for MoveState. - * Possible values include: 'AssignmentPending', 'PreparePending', 'PrepareInProgress', - * 'PrepareFailed', 'MovePending', 'MoveInProgress', 'MoveFailed', 'DiscardInProgress', - * 'DiscardFailed', 'CommitPending', 'CommitInProgress', 'CommitFailed', 'Committed', - * 'DeleteSourcePending', 'ResourceMoveCompleted' - * @readonly - * @enum {string} - */ -export type MoveState = 'AssignmentPending' | 'PreparePending' | 'PrepareInProgress' | 'PrepareFailed' | 'MovePending' | 'MoveInProgress' | 'MoveFailed' | 'DiscardInProgress' | 'DiscardFailed' | 'CommitPending' | 'CommitInProgress' | 'CommitFailed' | 'Committed' | 'DeleteSourcePending' | 'ResourceMoveCompleted'; - -/** - * Defines values for MoveResourceInputType. - * Possible values include: 'MoveResourceId', 'MoveResourceSourceId' - * @readonly - * @enum {string} - */ -export type MoveResourceInputType = 'MoveResourceId' | 'MoveResourceSourceId'; - -/** - * Defines values for ProvisioningState. - * Possible values include: 'Succeeded', 'Updating', 'Creating', 'Failed' - * @readonly - * @enum {string} - */ -export type ProvisioningState = 'Succeeded' | 'Updating' | 'Creating' | 'Failed'; - -/** - * Defines values for JobName. - * Possible values include: 'InitialSync' - * @readonly - * @enum {string} - */ -export type JobName = 'InitialSync'; - -/** - * Defines values for ResolutionType. - * Possible values include: 'Manual', 'Automatic' - * @readonly - * @enum {string} - */ -export type ResolutionType = 'Manual' | 'Automatic'; - -/** - * Defines values for DependencyType. - * Possible values include: 'RequiredForPrepare', 'RequiredForMove' - * @readonly - * @enum {string} - */ -export type DependencyType = 'RequiredForPrepare' | 'RequiredForMove'; - -/** - * Defines values for TargetAvailabilityZone. - * Possible values include: '1', '2', '3', 'NA' - * @readonly - * @enum {string} - */ -export type TargetAvailabilityZone = '1' | '2' | '3' | 'NA'; - -/** - * Defines values for ZoneRedundant. - * Possible values include: 'Enable', 'Disable' - * @readonly - * @enum {string} - */ -export type ZoneRedundant = 'Enable' | 'Disable'; - -/** - * Defines values for DependencyLevel. - * Possible values include: 'Direct', 'Descendant' - * @readonly - * @enum {string} - */ -export type DependencyLevel = 'Direct' | 'Descendant'; - -/** - * Contains response data for the create operation. - */ -export type MoveCollectionsCreateResponse = MoveCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MoveCollection; - }; -}; - -/** - * Contains response data for the update operation. - */ -export type MoveCollectionsUpdateResponse = MoveCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MoveCollection; - }; -}; - -/** - * Contains response data for the deleteMethod operation. - */ -export type MoveCollectionsDeleteMethodResponse = OperationStatus & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationStatus; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type MoveCollectionsGetResponse = MoveCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MoveCollection; - }; -}; - -/** - * Contains response data for the prepare operation. - */ -export type MoveCollectionsPrepareResponse = OperationStatus & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationStatus; - }; -}; - -/** - * Contains response data for the initiateMove operation. - */ -export type MoveCollectionsInitiateMoveResponse = OperationStatus & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationStatus; - }; -}; - -/** - * Contains response data for the commit operation. - */ -export type MoveCollectionsCommitResponse = OperationStatus & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationStatus; - }; -}; - -/** - * Contains response data for the discard operation. - */ -export type MoveCollectionsDiscardResponse = OperationStatus & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationStatus; - }; -}; - -/** - * Contains response data for the resolveDependencies operation. - */ -export type MoveCollectionsResolveDependenciesResponse = OperationStatus & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationStatus; - }; -}; - -/** - * Contains response data for the bulkRemove operation. - */ -export type MoveCollectionsBulkRemoveResponse = OperationStatus & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationStatus; - }; -}; - -/** - * Contains response data for the listMoveCollectionsBySubscription operation. - */ -export type MoveCollectionsListMoveCollectionsBySubscriptionResponse = MoveCollectionResultList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MoveCollectionResultList; - }; -}; - -/** - * Contains response data for the listMoveCollectionsByResourceGroup operation. - */ -export type MoveCollectionsListMoveCollectionsByResourceGroupResponse = MoveCollectionResultList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MoveCollectionResultList; - }; -}; - -/** - * Contains response data for the listRequiredFor operation. - */ -export type MoveCollectionsListRequiredForResponse = RequiredForResourcesCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RequiredForResourcesCollection; - }; -}; - -/** - * Contains response data for the beginDeleteMethod operation. - */ -export type MoveCollectionsBeginDeleteMethodResponse = OperationStatus & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationStatus; - }; -}; - -/** - * Contains response data for the beginPrepare operation. - */ -export type MoveCollectionsBeginPrepareResponse = OperationStatus & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationStatus; - }; -}; - -/** - * Contains response data for the beginInitiateMove operation. - */ -export type MoveCollectionsBeginInitiateMoveResponse = OperationStatus & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationStatus; - }; -}; - -/** - * Contains response data for the beginCommit operation. - */ -export type MoveCollectionsBeginCommitResponse = OperationStatus & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationStatus; - }; -}; - -/** - * Contains response data for the beginDiscard operation. - */ -export type MoveCollectionsBeginDiscardResponse = OperationStatus & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationStatus; - }; -}; - -/** - * Contains response data for the beginResolveDependencies operation. - */ -export type MoveCollectionsBeginResolveDependenciesResponse = OperationStatus & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationStatus; - }; -}; - -/** - * Contains response data for the beginBulkRemove operation. - */ -export type MoveCollectionsBeginBulkRemoveResponse = OperationStatus & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationStatus; - }; -}; - -/** - * Contains response data for the listMoveCollectionsBySubscriptionNext operation. - */ -export type MoveCollectionsListMoveCollectionsBySubscriptionNextResponse = MoveCollectionResultList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MoveCollectionResultList; - }; -}; - -/** - * Contains response data for the listMoveCollectionsByResourceGroupNext operation. - */ -export type MoveCollectionsListMoveCollectionsByResourceGroupNextResponse = MoveCollectionResultList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MoveCollectionResultList; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type MoveResourcesListResponse = MoveResourceCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MoveResourceCollection; - }; -}; - -/** - * Contains response data for the create operation. - */ -export type MoveResourcesCreateResponse = MoveResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MoveResource; - }; -}; - -/** - * Contains response data for the deleteMethod operation. - */ -export type MoveResourcesDeleteMethodResponse = OperationStatus & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationStatus; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type MoveResourcesGetResponse = MoveResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MoveResource; - }; -}; - -/** - * Contains response data for the beginCreate operation. - */ -export type MoveResourcesBeginCreateResponse = MoveResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MoveResource; - }; -}; - -/** - * Contains response data for the beginDeleteMethod operation. - */ -export type MoveResourcesBeginDeleteMethodResponse = OperationStatus & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationStatus; - }; -}; - -/** - * Contains response data for the listNext operation. - */ -export type MoveResourcesListNextResponse = MoveResourceCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MoveResourceCollection; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type UnresolvedDependenciesGetResponse = UnresolvedDependencyCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: UnresolvedDependencyCollection; - }; -}; - -/** - * Contains response data for the getNext operation. - */ -export type UnresolvedDependenciesGetNextResponse = UnresolvedDependencyCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: UnresolvedDependencyCollection; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type OperationsDiscoveryGetResponse = OperationsDiscoveryCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationsDiscoveryCollection; - }; -}; diff --git a/sdk/resourcemover/arm-resourcemover/src/models/mappers.ts b/sdk/resourcemover/arm-resourcemover/src/models/mappers.ts index 7af8a09e85d..36761d33efe 100644 --- a/sdk/resourcemover/arm-resourcemover/src/models/mappers.ts +++ b/sdk/resourcemover/arm-resourcemover/src/models/mappers.ts @@ -6,14 +6,80 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export const CloudError = CloudErrorMapper; -export const BaseResource = BaseResourceMapper; +export const MoveCollection: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MoveCollection", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + etag: { + serializedName: "etag", + readOnly: true, + type: { + name: "String" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "Identity" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "MoveCollectionProperties" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + } + } + } +}; -export const Identity: msRest.CompositeMapper = { - serializedName: "Identity", +export const Identity: coreClient.CompositeMapper = { type: { name: "Composite", className: "Identity", @@ -40,75 +106,44 @@ export const Identity: msRest.CompositeMapper = { } }; -export const JobStatus: msRest.CompositeMapper = { - serializedName: "JobStatus", +export const MoveCollectionProperties: coreClient.CompositeMapper = { type: { name: "Composite", - className: "JobStatus", + className: "MoveCollectionProperties", modelProperties: { - jobName: { - serializedName: "jobName", + sourceRegion: { + serializedName: "sourceRegion", + required: true, type: { name: "String" } }, - jobProgress: { - readOnly: true, - serializedName: "jobProgress", + targetRegion: { + serializedName: "targetRegion", + required: true, type: { name: "String" } + }, + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + errors: { + serializedName: "errors", + type: { + name: "Composite", + className: "MoveCollectionPropertiesErrors" + } } } } }; -export const MoveResourceErrorBody: msRest.CompositeMapper = { - serializedName: "MoveResourceErrorBody", - type: { - name: "Composite", - className: "MoveResourceErrorBody", - modelProperties: { - code: { - readOnly: true, - serializedName: "code", - type: { - name: "String" - } - }, - message: { - readOnly: true, - serializedName: "message", - type: { - name: "String" - } - }, - target: { - readOnly: true, - serializedName: "target", - type: { - name: "String" - } - }, - details: { - readOnly: true, - serializedName: "details", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "MoveResourceErrorBody" - } - } - } - } - } - } -}; - -export const MoveResourceError: msRest.CompositeMapper = { - serializedName: "MoveResourceError", +export const MoveResourceError: coreClient.CompositeMapper = { type: { name: "Composite", className: "MoveResourceError", @@ -124,14 +159,710 @@ export const MoveResourceError: msRest.CompositeMapper = { } }; -export const MoveResourceStatus: msRest.CompositeMapper = { - serializedName: "MoveResourceStatus", +export const MoveResourceErrorBody: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MoveResourceErrorBody", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MoveResourceErrorBody" + } + } + } + } + } + } +}; + +export const SystemData: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SystemData", + modelProperties: { + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + createdByType: { + serializedName: "createdByType", + type: { + name: "String" + } + }, + createdAt: { + serializedName: "createdAt", + type: { + name: "DateTime" + } + }, + lastModifiedBy: { + serializedName: "lastModifiedBy", + type: { + name: "String" + } + }, + lastModifiedByType: { + serializedName: "lastModifiedByType", + type: { + name: "String" + } + }, + lastModifiedAt: { + serializedName: "lastModifiedAt", + type: { + name: "DateTime" + } + } + } + } +}; + +export const CloudError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CloudError", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "CloudErrorBody" + } + } + } + } +}; + +export const CloudErrorBody: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CloudErrorBody", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + }, + target: { + serializedName: "target", + type: { + name: "String" + } + }, + details: { + serializedName: "details", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CloudErrorBody" + } + } + } + } + } + } +}; + +export const UpdateMoveCollectionRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UpdateMoveCollectionRequest", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "Identity" + } + } + } + } +}; + +export const OperationStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationStatus", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + status: { + serializedName: "status", + readOnly: true, + type: { + name: "String" + } + }, + startTime: { + serializedName: "startTime", + readOnly: true, + type: { + name: "String" + } + }, + endTime: { + serializedName: "endTime", + readOnly: true, + type: { + name: "String" + } + }, + error: { + serializedName: "error", + type: { + name: "Composite", + className: "OperationStatusError" + } + }, + properties: { + serializedName: "properties", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const OperationStatusError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationStatusError", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OperationStatusError" + } + } + } + }, + additionalInfo: { + serializedName: "additionalInfo", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OperationErrorAdditionalInfo" + } + } + } + } + } + } +}; + +export const OperationErrorAdditionalInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationErrorAdditionalInfo", + modelProperties: { + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + info: { + serializedName: "info", + type: { + name: "Composite", + className: "MoveErrorInfo" + } + } + } + } +}; + +export const MoveErrorInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MoveErrorInfo", + modelProperties: { + moveResources: { + serializedName: "moveResources", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AffectedMoveResource" + } + } + } + } + } + } +}; + +export const AffectedMoveResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AffectedMoveResource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + sourceId: { + serializedName: "sourceId", + readOnly: true, + type: { + name: "String" + } + }, + moveResources: { + serializedName: "moveResources", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "AffectedMoveResource" + } + } + } + } + } + } +}; + +export const PrepareRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrepareRequest", + modelProperties: { + validateOnly: { + serializedName: "validateOnly", + type: { + name: "Boolean" + } + }, + moveResources: { + serializedName: "moveResources", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + moveResourceInputType: { + serializedName: "moveResourceInputType", + type: { + name: "String" + } + } + } + } +}; + +export const ResourceMoveRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceMoveRequest", + modelProperties: { + validateOnly: { + serializedName: "validateOnly", + type: { + name: "Boolean" + } + }, + moveResources: { + serializedName: "moveResources", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + moveResourceInputType: { + serializedName: "moveResourceInputType", + type: { + name: "String" + } + } + } + } +}; + +export const CommitRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CommitRequest", + modelProperties: { + validateOnly: { + serializedName: "validateOnly", + type: { + name: "Boolean" + } + }, + moveResources: { + serializedName: "moveResources", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + moveResourceInputType: { + serializedName: "moveResourceInputType", + type: { + name: "String" + } + } + } + } +}; + +export const DiscardRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DiscardRequest", + modelProperties: { + validateOnly: { + serializedName: "validateOnly", + type: { + name: "Boolean" + } + }, + moveResources: { + serializedName: "moveResources", + required: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + moveResourceInputType: { + serializedName: "moveResourceInputType", + type: { + name: "String" + } + } + } + } +}; + +export const MoveResourceCollection: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MoveResourceCollection", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MoveResource" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + }, + summaryCollection: { + serializedName: "summaryCollection", + type: { + name: "Composite", + className: "SummaryCollection" + } + }, + totalCount: { + serializedName: "totalCount", + readOnly: true, + type: { + name: "Number" + } + } + } + } +}; + +export const MoveResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MoveResource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "MoveResourceProperties" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + } + } + } +}; + +export const MoveResourceProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MoveResourceProperties", + modelProperties: { + provisioningState: { + serializedName: "provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + sourceId: { + serializedName: "sourceId", + required: true, + type: { + name: "String" + } + }, + targetId: { + serializedName: "targetId", + readOnly: true, + type: { + name: "String" + } + }, + existingTargetId: { + serializedName: "existingTargetId", + type: { + name: "String" + } + }, + resourceSettings: { + serializedName: "resourceSettings", + type: { + name: "Composite", + className: "ResourceSettings" + } + }, + sourceResourceSettings: { + serializedName: "sourceResourceSettings", + type: { + name: "Composite", + className: "ResourceSettings" + } + }, + moveStatus: { + serializedName: "moveStatus", + type: { + name: "Composite", + className: "MoveResourcePropertiesMoveStatus" + } + }, + dependsOn: { + serializedName: "dependsOn", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MoveResourceDependency" + } + } + } + }, + dependsOnOverrides: { + serializedName: "dependsOnOverrides", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MoveResourceDependencyOverride" + } + } + } + }, + isResolveRequired: { + serializedName: "isResolveRequired", + readOnly: true, + type: { + name: "Boolean" + } + }, + errors: { + serializedName: "errors", + type: { + name: "Composite", + className: "MoveResourcePropertiesErrors" + } + } + } + } +}; + +export const ResourceSettings: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceSettings", + uberParent: "ResourceSettings", + polymorphicDiscriminator: { + serializedName: "resourceType", + clientName: "resourceType" + }, + modelProperties: { + resourceType: { + serializedName: "resourceType", + required: true, + type: { + name: "String" + } + }, + targetResourceName: { + serializedName: "targetResourceName", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const MoveResourceStatus: coreClient.CompositeMapper = { type: { name: "Composite", className: "MoveResourceStatus", modelProperties: { moveState: { serializedName: "moveState", + readOnly: true, type: { name: "String" } @@ -154,14 +885,21 @@ export const MoveResourceStatus: msRest.CompositeMapper = { } }; -export const ManualResolutionProperties: msRest.CompositeMapper = { - serializedName: "ManualResolutionProperties", +export const JobStatus: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ManualResolutionProperties", + className: "JobStatus", modelProperties: { - targetId: { - serializedName: "targetId", + jobName: { + serializedName: "jobName", + readOnly: true, + type: { + name: "String" + } + }, + jobProgress: { + serializedName: "jobProgress", + readOnly: true, type: { name: "String" } @@ -170,24 +908,7 @@ export const ManualResolutionProperties: msRest.CompositeMapper = { } }; -export const AutomaticResolutionProperties: msRest.CompositeMapper = { - serializedName: "AutomaticResolutionProperties", - type: { - name: "Composite", - className: "AutomaticResolutionProperties", - modelProperties: { - moveResourceId: { - serializedName: "moveResourceId", - type: { - name: "String" - } - } - } - } -}; - -export const MoveResourceDependency: msRest.CompositeMapper = { - serializedName: "MoveResourceDependency", +export const MoveResourceDependency: coreClient.CompositeMapper = { type: { name: "Composite", className: "MoveResourceDependency", @@ -240,8 +961,37 @@ export const MoveResourceDependency: msRest.CompositeMapper = { } }; -export const MoveResourceDependencyOverride: msRest.CompositeMapper = { - serializedName: "MoveResourceDependencyOverride", +export const ManualResolutionProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManualResolutionProperties", + modelProperties: { + targetId: { + serializedName: "targetId", + type: { + name: "String" + } + } + } + } +}; + +export const AutomaticResolutionProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "AutomaticResolutionProperties", + modelProperties: { + moveResourceId: { + serializedName: "moveResourceId", + type: { + name: "String" + } + } + } + } +}; + +export const MoveResourceDependencyOverride: coreClient.CompositeMapper = { type: { name: "Composite", className: "MoveResourceDependencyOverride", @@ -262,218 +1012,7 @@ export const MoveResourceDependencyOverride: msRest.CompositeMapper = { } }; -export const ResourceSettings: msRest.CompositeMapper = { - serializedName: "ResourceSettings", - type: { - name: "Composite", - polymorphicDiscriminator: { - serializedName: "resourceType", - clientName: "resourceType" - }, - uberParent: "ResourceSettings", - className: "ResourceSettings", - modelProperties: { - targetResourceName: { - required: true, - serializedName: "targetResourceName", - type: { - name: "String" - } - }, - resourceType: { - required: true, - serializedName: "resourceType", - type: { - name: "String" - } - } - } - } -}; - -export const MoveResourcePropertiesMoveStatus: msRest.CompositeMapper = { - serializedName: "MoveResourceProperties_moveStatus", - type: { - name: "Composite", - className: "MoveResourcePropertiesMoveStatus", - modelProperties: { - ...MoveResourceStatus.type.modelProperties - } - } -}; - -export const MoveResourcePropertiesErrors: msRest.CompositeMapper = { - serializedName: "MoveResourceProperties_errors", - type: { - name: "Composite", - className: "MoveResourcePropertiesErrors", - modelProperties: { - ...MoveResourceError.type.modelProperties - } - } -}; - -export const MoveResourceProperties: msRest.CompositeMapper = { - serializedName: "MoveResourceProperties", - type: { - name: "Composite", - className: "MoveResourceProperties", - modelProperties: { - provisioningState: { - serializedName: "provisioningState", - type: { - name: "String" - } - }, - sourceId: { - required: true, - serializedName: "sourceId", - type: { - name: "String" - } - }, - targetId: { - readOnly: true, - serializedName: "targetId", - type: { - name: "String" - } - }, - existingTargetId: { - serializedName: "existingTargetId", - type: { - name: "String" - } - }, - resourceSettings: { - serializedName: "resourceSettings", - type: { - name: "Composite", - className: "ResourceSettings" - } - }, - sourceResourceSettings: { - readOnly: true, - serializedName: "sourceResourceSettings", - type: { - name: "Composite", - className: "ResourceSettings" - } - }, - moveStatus: { - readOnly: true, - serializedName: "moveStatus", - type: { - name: "Composite", - className: "MoveResourcePropertiesMoveStatus" - } - }, - dependsOn: { - readOnly: true, - serializedName: "dependsOn", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "MoveResourceDependency" - } - } - } - }, - dependsOnOverrides: { - serializedName: "dependsOnOverrides", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "MoveResourceDependencyOverride" - } - } - } - }, - isResolveRequired: { - readOnly: true, - serializedName: "isResolveRequired", - type: { - name: "Boolean" - } - }, - errors: { - readOnly: true, - serializedName: "errors", - type: { - name: "Composite", - className: "MoveResourcePropertiesErrors" - } - } - } - } -}; - -export const MoveResource: msRest.CompositeMapper = { - serializedName: "MoveResource", - type: { - name: "Composite", - className: "MoveResource", - modelProperties: { - id: { - readOnly: true, - serializedName: "id", - type: { - name: "String" - } - }, - name: { - readOnly: true, - serializedName: "name", - type: { - name: "String" - } - }, - type: { - readOnly: true, - serializedName: "type", - type: { - name: "String" - } - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "MoveResourceProperties" - } - } - } - } -}; - -export const Summary: msRest.CompositeMapper = { - serializedName: "Summary", - type: { - name: "Composite", - className: "Summary", - modelProperties: { - count: { - serializedName: "count", - type: { - name: "Number" - } - }, - item: { - serializedName: "item", - type: { - name: "String" - } - } - } - } -}; - -export const SummaryCollection: msRest.CompositeMapper = { - serializedName: "SummaryCollection", +export const SummaryCollection: coreClient.CompositeMapper = { type: { name: "Composite", className: "SummaryCollection", @@ -500,290 +1039,90 @@ export const SummaryCollection: msRest.CompositeMapper = { } }; -export const MoveCollectionPropertiesErrors: msRest.CompositeMapper = { - serializedName: "MoveCollectionProperties_errors", +export const Summary: coreClient.CompositeMapper = { type: { name: "Composite", - className: "MoveCollectionPropertiesErrors", + className: "Summary", modelProperties: { - ...MoveResourceError.type.modelProperties - } - } -}; - -export const MoveCollectionProperties: msRest.CompositeMapper = { - serializedName: "MoveCollectionProperties", - type: { - name: "Composite", - className: "MoveCollectionProperties", - modelProperties: { - sourceRegion: { - required: true, - serializedName: "sourceRegion", + count: { + serializedName: "count", type: { - name: "String" + name: "Number" } }, - targetRegion: { - required: true, - serializedName: "targetRegion", + item: { + serializedName: "item", type: { name: "String" } - }, - provisioningState: { - serializedName: "provisioningState", - type: { - name: "String" - } - }, - errors: { - readOnly: true, - serializedName: "errors", - type: { - name: "Composite", - className: "MoveCollectionPropertiesErrors" - } } } } }; -export const MoveCollection: msRest.CompositeMapper = { - serializedName: "MoveCollection", +export const UnresolvedDependencyCollection: coreClient.CompositeMapper = { type: { name: "Composite", - className: "MoveCollection", + className: "UnresolvedDependencyCollection", modelProperties: { - id: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "UnresolvedDependency" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + }, + summaryCollection: { + serializedName: "summaryCollection", + type: { + name: "Composite", + className: "SummaryCollection" + } + }, + totalCount: { + serializedName: "totalCount", readOnly: true, + type: { + name: "Number" + } + } + } + } +}; + +export const UnresolvedDependency: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UnresolvedDependency", + modelProperties: { + count: { + serializedName: "count", + type: { + name: "Number" + } + }, + id: { serializedName: "id", type: { name: "String" } - }, - name: { - readOnly: true, - serializedName: "name", - type: { - name: "String" - } - }, - type: { - readOnly: true, - serializedName: "type", - type: { - name: "String" - } - }, - etag: { - readOnly: true, - serializedName: "etag", - type: { - name: "String" - } - }, - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { - type: { - name: "String" - } - } - } - }, - location: { - serializedName: "location", - type: { - name: "String" - } - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "Identity" - } - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "MoveCollectionProperties" - } } } } }; -export const UpdateMoveCollectionRequest: msRest.CompositeMapper = { - serializedName: "UpdateMoveCollectionRequest", - type: { - name: "Composite", - className: "UpdateMoveCollectionRequest", - modelProperties: { - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { - type: { - name: "String" - } - } - } - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "Identity" - } - } - } - } -}; - -export const PrepareRequest: msRest.CompositeMapper = { - serializedName: "PrepareRequest", - type: { - name: "Composite", - className: "PrepareRequest", - modelProperties: { - validateOnly: { - serializedName: "validateOnly", - type: { - name: "Boolean" - } - }, - moveResources: { - required: true, - serializedName: "moveResources", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - moveResourceInputType: { - serializedName: "moveResourceInputType", - type: { - name: "String" - } - } - } - } -}; - -export const ResourceMoveRequest: msRest.CompositeMapper = { - serializedName: "ResourceMoveRequest", - type: { - name: "Composite", - className: "ResourceMoveRequest", - modelProperties: { - validateOnly: { - serializedName: "validateOnly", - type: { - name: "Boolean" - } - }, - moveResources: { - required: true, - serializedName: "moveResources", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - moveResourceInputType: { - serializedName: "moveResourceInputType", - type: { - name: "String" - } - } - } - } -}; - -export const CommitRequest: msRest.CompositeMapper = { - serializedName: "CommitRequest", - type: { - name: "Composite", - className: "CommitRequest", - modelProperties: { - validateOnly: { - serializedName: "validateOnly", - type: { - name: "Boolean" - } - }, - moveResources: { - required: true, - serializedName: "moveResources", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - moveResourceInputType: { - serializedName: "moveResourceInputType", - type: { - name: "String" - } - } - } - } -}; - -export const DiscardRequest: msRest.CompositeMapper = { - serializedName: "DiscardRequest", - type: { - name: "Composite", - className: "DiscardRequest", - modelProperties: { - validateOnly: { - serializedName: "validateOnly", - type: { - name: "Boolean" - } - }, - moveResources: { - required: true, - serializedName: "moveResources", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - moveResourceInputType: { - serializedName: "moveResourceInputType", - type: { - name: "String" - } - } - } - } -}; - -export const BulkRemoveRequest: msRest.CompositeMapper = { - serializedName: "BulkRemoveRequest", +export const BulkRemoveRequest: coreClient.CompositeMapper = { type: { name: "Composite", className: "BulkRemoveRequest", @@ -815,141 +1154,25 @@ export const BulkRemoveRequest: msRest.CompositeMapper = { } }; -export const MoveResourceFilterProperties: msRest.CompositeMapper = { - serializedName: "MoveResourceFilterProperties", +export const OperationsDiscoveryCollection: coreClient.CompositeMapper = { type: { name: "Composite", - className: "MoveResourceFilterProperties", + className: "OperationsDiscoveryCollection", modelProperties: { - provisioningState: { - serializedName: "provisioningState", - type: { - name: "String" - } - } - } - } -}; - -export const MoveResourceFilter: msRest.CompositeMapper = { - serializedName: "MoveResourceFilter", - type: { - name: "Composite", - className: "MoveResourceFilter", - modelProperties: { - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "MoveResourceFilterProperties" - } - } - } - } -}; - -export const UnresolvedDependenciesFilterProperties: msRest.CompositeMapper = { - serializedName: "UnresolvedDependenciesFilterProperties", - type: { - name: "Composite", - className: "UnresolvedDependenciesFilterProperties", - modelProperties: { - count: { - serializedName: "count", - type: { - name: "Number" - } - } - } - } -}; - -export const UnresolvedDependenciesFilter: msRest.CompositeMapper = { - serializedName: "UnresolvedDependenciesFilter", - type: { - name: "Composite", - className: "UnresolvedDependenciesFilter", - modelProperties: { - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "UnresolvedDependenciesFilterProperties" - } - } - } - } -}; - -export const UnresolvedDependency: msRest.CompositeMapper = { - serializedName: "UnresolvedDependency", - type: { - name: "Composite", - className: "UnresolvedDependency", - modelProperties: { - count: { - serializedName: "count", - type: { - name: "Number" - } - }, - id: { - serializedName: "id", - type: { - name: "String" - } - } - } - } -}; - -export const RequiredForResourcesCollection: msRest.CompositeMapper = { - serializedName: "RequiredForResourcesCollection", - type: { - name: "Composite", - className: "RequiredForResourcesCollection", - modelProperties: { - sourceIds: { - serializedName: "sourceIds", + value: { + serializedName: "value", type: { name: "Sequence", element: { type: { - name: "String" + name: "Composite", + className: "OperationsDiscovery" } } } - } - } - } -}; - -export const Display: msRest.CompositeMapper = { - serializedName: "Display", - type: { - name: "Composite", - className: "Display", - modelProperties: { - provider: { - serializedName: "provider", - type: { - name: "String" - } }, - resource: { - serializedName: "resource", - type: { - name: "String" - } - }, - operation: { - serializedName: "operation", - type: { - name: "String" - } - }, - description: { - serializedName: "description", + nextLink: { + serializedName: "nextLink", type: { name: "String" } @@ -958,8 +1181,7 @@ export const Display: msRest.CompositeMapper = { } }; -export const OperationsDiscovery: msRest.CompositeMapper = { - serializedName: "OperationsDiscovery", +export const OperationsDiscovery: coreClient.CompositeMapper = { type: { name: "Composite", className: "OperationsDiscovery", @@ -992,18 +1214,51 @@ export const OperationsDiscovery: msRest.CompositeMapper = { properties: { serializedName: "properties", type: { - name: "Object" + name: "Dictionary", + value: { type: { name: "any" } } } } } } }; -export const OperationsDiscoveryCollection: msRest.CompositeMapper = { - serializedName: "OperationsDiscoveryCollection", +export const Display: coreClient.CompositeMapper = { type: { name: "Composite", - className: "OperationsDiscoveryCollection", + className: "Display", + modelProperties: { + provider: { + serializedName: "provider", + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + } + } + } +}; + +export const MoveCollectionResultList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MoveCollectionResultList", modelProperties: { value: { serializedName: "value", @@ -1012,7 +1267,7 @@ export const OperationsDiscoveryCollection: msRest.CompositeMapper = { element: { type: { name: "Composite", - className: "OperationsDiscovery" + className: "MoveCollection" } } } @@ -1027,29 +1282,49 @@ export const OperationsDiscoveryCollection: msRest.CompositeMapper = { } }; -export const VirtualMachineResourceSettings: msRest.CompositeMapper = { - serializedName: "Microsoft.Compute/virtualMachines", +export const RequiredForResourcesCollection: coreClient.CompositeMapper = { type: { name: "Composite", - polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, - uberParent: "ResourceSettings", - className: "VirtualMachineResourceSettings", + className: "RequiredForResourcesCollection", modelProperties: { - ...ResourceSettings.type.modelProperties, - targetAvailabilityZone: { - serializedName: "targetAvailabilityZone", + sourceIds: { + serializedName: "sourceIds", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "String" + } + } } - }, - targetVmSize: { - serializedName: "targetVmSize", + } + } + } +}; + +export const MoveResourceFilter: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MoveResourceFilter", + modelProperties: { + properties: { + serializedName: "properties", type: { - name: "String" + name: "Composite", + className: "MoveResourceFilterProperties" } - }, - targetAvailabilitySetId: { - serializedName: "targetAvailabilitySetId", + } + } + } +}; + +export const MoveResourceFilterProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MoveResourceFilterProperties", + modelProperties: { + provisioningState: { + serializedName: "provisioningState", type: { name: "String" } @@ -1058,32 +1333,29 @@ export const VirtualMachineResourceSettings: msRest.CompositeMapper = { } }; -export const AvailabilitySetResourceSettings: msRest.CompositeMapper = { - serializedName: "Microsoft.Compute/availabilitySets", +export const UnresolvedDependenciesFilter: coreClient.CompositeMapper = { type: { name: "Composite", - polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, - uberParent: "ResourceSettings", - className: "AvailabilitySetResourceSettings", + className: "UnresolvedDependenciesFilter", modelProperties: { - ...ResourceSettings.type.modelProperties, - faultDomain: { - nullable: true, - serializedName: "faultDomain", - constraints: { - InclusiveMinimum: 1 - }, + properties: { + serializedName: "properties", type: { - name: "Number" + name: "Composite", + className: "UnresolvedDependenciesFilterProperties" } - }, - updateDomain: { - nullable: true, - serializedName: "updateDomain", - constraints: { - InclusiveMaximum: 20, - InclusiveMinimum: 1 - }, + } + } + } +}; + +export const UnresolvedDependenciesFilterProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UnresolvedDependenciesFilterProperties", + modelProperties: { + count: { + serializedName: "count", type: { name: "Number" } @@ -1092,36 +1364,7 @@ export const AvailabilitySetResourceSettings: msRest.CompositeMapper = { } }; -export const AzureResourceReference: msRest.CompositeMapper = { - serializedName: "AzureResourceReference", - type: { - name: "Composite", - className: "AzureResourceReference", - modelProperties: { - sourceArmResourceId: { - required: true, - serializedName: "sourceArmResourceId", - type: { - name: "String" - } - } - } - } -}; - -export const NsgReference: msRest.CompositeMapper = { - serializedName: "NsgReference", - type: { - name: "Composite", - className: "NsgReference", - modelProperties: { - ...AzureResourceReference.type.modelProperties - } - } -}; - -export const SubnetResourceSettings: msRest.CompositeMapper = { - serializedName: "SubnetResourceSettings", +export const SubnetResourceSettings: coreClient.CompositeMapper = { type: { name: "Composite", className: "SubnetResourceSettings", @@ -1149,69 +1392,14 @@ export const SubnetResourceSettings: msRest.CompositeMapper = { } }; -export const VirtualNetworkResourceSettings: msRest.CompositeMapper = { - serializedName: "Microsoft.Network/virtualNetworks", +export const AzureResourceReference: coreClient.CompositeMapper = { type: { name: "Composite", - polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, - uberParent: "ResourceSettings", - className: "VirtualNetworkResourceSettings", + className: "AzureResourceReference", modelProperties: { - ...ResourceSettings.type.modelProperties, - enableDdosProtection: { - nullable: true, - serializedName: "enableDdosProtection", - type: { - name: "Boolean" - } - }, - addressSpace: { - serializedName: "addressSpace", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - dnsServers: { - serializedName: "dnsServers", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - subnets: { - serializedName: "subnets", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "SubnetResourceSettings" - } - } - } - } - } - } -}; - -export const ProxyResourceReference: msRest.CompositeMapper = { - serializedName: "ProxyResourceReference", - type: { - name: "Composite", - className: "ProxyResourceReference", - modelProperties: { - ...AzureResourceReference.type.modelProperties, - name: { - serializedName: "name", + sourceArmResourceId: { + serializedName: "sourceArmResourceId", + required: true, type: { name: "String" } @@ -1220,52 +1408,7 @@ export const ProxyResourceReference: msRest.CompositeMapper = { } }; -export const SubnetReference: msRest.CompositeMapper = { - serializedName: "SubnetReference", - type: { - name: "Composite", - className: "SubnetReference", - modelProperties: { - ...ProxyResourceReference.type.modelProperties - } - } -}; - -export const LoadBalancerBackendAddressPoolReference: msRest.CompositeMapper = { - serializedName: "LoadBalancerBackendAddressPoolReference", - type: { - name: "Composite", - className: "LoadBalancerBackendAddressPoolReference", - modelProperties: { - ...ProxyResourceReference.type.modelProperties - } - } -}; - -export const LoadBalancerNatRuleReference: msRest.CompositeMapper = { - serializedName: "LoadBalancerNatRuleReference", - type: { - name: "Composite", - className: "LoadBalancerNatRuleReference", - modelProperties: { - ...ProxyResourceReference.type.modelProperties - } - } -}; - -export const PublicIpReference: msRest.CompositeMapper = { - serializedName: "PublicIpReference", - type: { - name: "Composite", - className: "PublicIpReference", - modelProperties: { - ...AzureResourceReference.type.modelProperties - } - } -}; - -export const NicIpConfigurationResourceSettings: msRest.CompositeMapper = { - serializedName: "NicIpConfigurationResourceSettings", +export const NicIpConfigurationResourceSettings: coreClient.CompositeMapper = { type: { name: "Composite", className: "NicIpConfigurationResourceSettings", @@ -1336,40 +1479,7 @@ export const NicIpConfigurationResourceSettings: msRest.CompositeMapper = { } }; -export const NetworkInterfaceResourceSettings: msRest.CompositeMapper = { - serializedName: "Microsoft.Network/networkInterfaces", - type: { - name: "Composite", - polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, - uberParent: "ResourceSettings", - className: "NetworkInterfaceResourceSettings", - modelProperties: { - ...ResourceSettings.type.modelProperties, - ipConfigurations: { - serializedName: "ipConfigurations", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "NicIpConfigurationResourceSettings" - } - } - } - }, - enableAcceleratedNetworking: { - nullable: true, - serializedName: "enableAcceleratedNetworking", - type: { - name: "Boolean" - } - } - } - } -}; - -export const NsgSecurityRule: msRest.CompositeMapper = { - serializedName: "NsgSecurityRule", +export const NsgSecurityRule: coreClient.CompositeMapper = { type: { name: "Composite", className: "NsgSecurityRule", @@ -1438,33 +1548,7 @@ export const NsgSecurityRule: msRest.CompositeMapper = { } }; -export const NetworkSecurityGroupResourceSettings: msRest.CompositeMapper = { - serializedName: "Microsoft.Network/networkSecurityGroups", - type: { - name: "Composite", - polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, - uberParent: "ResourceSettings", - className: "NetworkSecurityGroupResourceSettings", - modelProperties: { - ...ResourceSettings.type.modelProperties, - securityRules: { - serializedName: "securityRules", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "NsgSecurityRule" - } - } - } - } - } - } -}; - -export const LBFrontendIPConfigurationResourceSettings: msRest.CompositeMapper = { - serializedName: "LBFrontendIPConfigurationResourceSettings", +export const LBFrontendIPConfigurationResourceSettings: coreClient.CompositeMapper = { type: { name: "Composite", className: "LBFrontendIPConfigurationResourceSettings", @@ -1504,8 +1588,7 @@ export const LBFrontendIPConfigurationResourceSettings: msRest.CompositeMapper = } }; -export const LBBackendAddressPoolResourceSettings: msRest.CompositeMapper = { - serializedName: "LBBackendAddressPoolResourceSettings", +export const LBBackendAddressPoolResourceSettings: coreClient.CompositeMapper = { type: { name: "Composite", className: "LBBackendAddressPoolResourceSettings", @@ -1520,15 +1603,264 @@ export const LBBackendAddressPoolResourceSettings: msRest.CompositeMapper = { } }; -export const LoadBalancerResourceSettings: msRest.CompositeMapper = { +export const MoveCollectionPropertiesErrors: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MoveCollectionPropertiesErrors", + modelProperties: { + ...MoveResourceError.type.modelProperties + } + } +}; + +export const MoveResourcePropertiesErrors: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MoveResourcePropertiesErrors", + modelProperties: { + ...MoveResourceError.type.modelProperties + } + } +}; + +export const VirtualMachineResourceSettings: coreClient.CompositeMapper = { + serializedName: "Microsoft.Compute/virtualMachines", + type: { + name: "Composite", + className: "VirtualMachineResourceSettings", + uberParent: "ResourceSettings", + polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, + modelProperties: { + ...ResourceSettings.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + userManagedIdentities: { + serializedName: "userManagedIdentities", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + targetAvailabilityZone: { + serializedName: "targetAvailabilityZone", + type: { + name: "String" + } + }, + targetVmSize: { + serializedName: "targetVmSize", + type: { + name: "String" + } + }, + targetAvailabilitySetId: { + serializedName: "targetAvailabilitySetId", + type: { + name: "String" + } + } + } + } +}; + +export const AvailabilitySetResourceSettings: coreClient.CompositeMapper = { + serializedName: "Microsoft.Compute/availabilitySets", + type: { + name: "Composite", + className: "AvailabilitySetResourceSettings", + uberParent: "ResourceSettings", + polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, + modelProperties: { + ...ResourceSettings.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + faultDomain: { + constraints: { + InclusiveMinimum: 1 + }, + serializedName: "faultDomain", + nullable: true, + type: { + name: "Number" + } + }, + updateDomain: { + constraints: { + InclusiveMaximum: 20, + InclusiveMinimum: 1 + }, + serializedName: "updateDomain", + nullable: true, + type: { + name: "Number" + } + } + } + } +}; + +export const VirtualNetworkResourceSettings: coreClient.CompositeMapper = { + serializedName: "Microsoft.Network/virtualNetworks", + type: { + name: "Composite", + className: "VirtualNetworkResourceSettings", + uberParent: "ResourceSettings", + polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, + modelProperties: { + ...ResourceSettings.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + enableDdosProtection: { + serializedName: "enableDdosProtection", + nullable: true, + type: { + name: "Boolean" + } + }, + addressSpace: { + serializedName: "addressSpace", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + dnsServers: { + serializedName: "dnsServers", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + subnets: { + serializedName: "subnets", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SubnetResourceSettings" + } + } + } + } + } + } +}; + +export const NetworkInterfaceResourceSettings: coreClient.CompositeMapper = { + serializedName: "Microsoft.Network/networkInterfaces", + type: { + name: "Composite", + className: "NetworkInterfaceResourceSettings", + uberParent: "ResourceSettings", + polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, + modelProperties: { + ...ResourceSettings.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + ipConfigurations: { + serializedName: "ipConfigurations", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "NicIpConfigurationResourceSettings" + } + } + } + }, + enableAcceleratedNetworking: { + serializedName: "enableAcceleratedNetworking", + nullable: true, + type: { + name: "Boolean" + } + } + } + } +}; + +export const NetworkSecurityGroupResourceSettings: coreClient.CompositeMapper = { + serializedName: "Microsoft.Network/networkSecurityGroups", + type: { + name: "Composite", + className: "NetworkSecurityGroupResourceSettings", + uberParent: "ResourceSettings", + polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, + modelProperties: { + ...ResourceSettings.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + securityRules: { + serializedName: "securityRules", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "NsgSecurityRule" + } + } + } + } + } + } +}; + +export const LoadBalancerResourceSettings: coreClient.CompositeMapper = { serializedName: "Microsoft.Network/loadBalancers", type: { name: "Composite", - polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, - uberParent: "ResourceSettings", className: "LoadBalancerResourceSettings", + uberParent: "ResourceSettings", + polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, modelProperties: { ...ResourceSettings.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, sku: { serializedName: "sku", type: { @@ -1569,28 +1901,35 @@ export const LoadBalancerResourceSettings: msRest.CompositeMapper = { } }; -export const SqlServerResourceSettings: msRest.CompositeMapper = { +export const SqlServerResourceSettings: coreClient.CompositeMapper = { serializedName: "Microsoft.Sql/servers", type: { name: "Composite", - polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, - uberParent: "ResourceSettings", className: "SqlServerResourceSettings", + uberParent: "ResourceSettings", + polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, modelProperties: { ...ResourceSettings.type.modelProperties } } }; -export const SqlElasticPoolResourceSettings: msRest.CompositeMapper = { +export const SqlElasticPoolResourceSettings: coreClient.CompositeMapper = { serializedName: "Microsoft.Sql/servers/elasticPools", type: { name: "Composite", - polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, - uberParent: "ResourceSettings", className: "SqlElasticPoolResourceSettings", + uberParent: "ResourceSettings", + polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, modelProperties: { ...ResourceSettings.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, zoneRedundant: { serializedName: "zoneRedundant", type: { @@ -1601,15 +1940,22 @@ export const SqlElasticPoolResourceSettings: msRest.CompositeMapper = { } }; -export const SqlDatabaseResourceSettings: msRest.CompositeMapper = { +export const SqlDatabaseResourceSettings: coreClient.CompositeMapper = { serializedName: "Microsoft.Sql/servers/databases", type: { name: "Composite", - polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, - uberParent: "ResourceSettings", className: "SqlDatabaseResourceSettings", + uberParent: "ResourceSettings", + polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, modelProperties: { ...ResourceSettings.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, zoneRedundant: { serializedName: "zoneRedundant", type: { @@ -1620,28 +1966,35 @@ export const SqlDatabaseResourceSettings: msRest.CompositeMapper = { } }; -export const ResourceGroupResourceSettings: msRest.CompositeMapper = { +export const ResourceGroupResourceSettings: coreClient.CompositeMapper = { serializedName: "resourceGroups", type: { name: "Composite", - polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, - uberParent: "ResourceSettings", className: "ResourceGroupResourceSettings", + uberParent: "ResourceSettings", + polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, modelProperties: { ...ResourceSettings.type.modelProperties } } }; -export const PublicIPAddressResourceSettings: msRest.CompositeMapper = { +export const PublicIPAddressResourceSettings: coreClient.CompositeMapper = { serializedName: "Microsoft.Network/publicIPAddresses", type: { name: "Composite", - polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, - uberParent: "ResourceSettings", className: "PublicIPAddressResourceSettings", + uberParent: "ResourceSettings", + polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, modelProperties: { ...ResourceSettings.type.modelProperties, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, domainNameLabel: { serializedName: "domainNameLabel", type: { @@ -1676,354 +2029,121 @@ export const PublicIPAddressResourceSettings: msRest.CompositeMapper = { } }; -export const KeyVaultResourceSettings: msRest.CompositeMapper = { +export const KeyVaultResourceSettings: coreClient.CompositeMapper = { serializedName: "Microsoft.KeyVault/vaults", type: { name: "Composite", - polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, - uberParent: "ResourceSettings", className: "KeyVaultResourceSettings", + uberParent: "ResourceSettings", + polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, modelProperties: { ...ResourceSettings.type.modelProperties } } }; -export const DiskEncryptionSetResourceSettings: msRest.CompositeMapper = { +export const DiskEncryptionSetResourceSettings: coreClient.CompositeMapper = { serializedName: "Microsoft.Compute/diskEncryptionSets", type: { name: "Composite", - polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, - uberParent: "ResourceSettings", className: "DiskEncryptionSetResourceSettings", + uberParent: "ResourceSettings", + polymorphicDiscriminator: ResourceSettings.type.polymorphicDiscriminator, modelProperties: { ...ResourceSettings.type.modelProperties } } }; -export const AffectedMoveResource: msRest.CompositeMapper = { - serializedName: "AffectedMoveResource", +export const MoveResourcePropertiesMoveStatus: coreClient.CompositeMapper = { type: { name: "Composite", - className: "AffectedMoveResource", + className: "MoveResourcePropertiesMoveStatus", modelProperties: { - id: { - readOnly: true, - serializedName: "id", - type: { - name: "String" - } - }, - sourceId: { - readOnly: true, - serializedName: "sourceId", - type: { - name: "String" - } - }, - moveResources: { - readOnly: true, - serializedName: "moveResources", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "AffectedMoveResource" - } - } - } - } + ...MoveResourceStatus.type.modelProperties } } }; -export const MoveErrorInfo: msRest.CompositeMapper = { - serializedName: "MoveErrorInfo", +export const NsgReference: coreClient.CompositeMapper = { type: { name: "Composite", - className: "MoveErrorInfo", + className: "NsgReference", modelProperties: { - moveResources: { - readOnly: true, - serializedName: "moveResources", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "AffectedMoveResource" - } - } - } - } + ...AzureResourceReference.type.modelProperties } } }; -export const OperationErrorAdditionalInfo: msRest.CompositeMapper = { - serializedName: "OperationErrorAdditionalInfo", +export const ProxyResourceReference: coreClient.CompositeMapper = { type: { name: "Composite", - className: "OperationErrorAdditionalInfo", + className: "ProxyResourceReference", modelProperties: { - type: { - readOnly: true, - serializedName: "type", - type: { - name: "String" - } - }, - info: { - readOnly: true, - serializedName: "info", - type: { - name: "Composite", - className: "MoveErrorInfo" - } - } - } - } -}; - -export const OperationStatusError: msRest.CompositeMapper = { - serializedName: "OperationStatusError", - type: { - name: "Composite", - className: "OperationStatusError", - modelProperties: { - code: { - readOnly: true, - serializedName: "code", - type: { - name: "String" - } - }, - message: { - readOnly: true, - serializedName: "message", - type: { - name: "String" - } - }, - details: { - readOnly: true, - serializedName: "details", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "OperationStatusError" - } - } - } - }, - additionalInfo: { - readOnly: true, - serializedName: "additionalInfo", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "OperationErrorAdditionalInfo" - } - } - } - } - } - } -}; - -export const OperationStatus: msRest.CompositeMapper = { - serializedName: "OperationStatus", - type: { - name: "Composite", - className: "OperationStatus", - modelProperties: { - id: { - readOnly: true, - serializedName: "id", - type: { - name: "String" - } - }, + ...AzureResourceReference.type.modelProperties, name: { - readOnly: true, serializedName: "name", type: { name: "String" } - }, - status: { - readOnly: true, - serializedName: "status", - type: { - name: "String" - } - }, - startTime: { - readOnly: true, - serializedName: "startTime", - type: { - name: "String" - } - }, - endTime: { - readOnly: true, - serializedName: "endTime", - type: { - name: "String" - } - }, - error: { - readOnly: true, - serializedName: "error", - type: { - name: "Composite", - className: "OperationStatusError" - } - }, - properties: { - readOnly: true, - serializedName: "properties", - type: { - name: "Object" - } } } } }; -export const MoveCollectionResultList: msRest.CompositeMapper = { - serializedName: "MoveCollectionResultList", +export const PublicIpReference: coreClient.CompositeMapper = { type: { name: "Composite", - className: "MoveCollectionResultList", + className: "PublicIpReference", modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "MoveCollection" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } + ...AzureResourceReference.type.modelProperties } } }; -export const MoveResourceCollection: msRest.CompositeMapper = { - serializedName: "MoveResourceCollection", +export const SubnetReference: coreClient.CompositeMapper = { type: { name: "Composite", - className: "MoveResourceCollection", + className: "SubnetReference", modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "MoveResource" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - }, - summaryCollection: { - serializedName: "summaryCollection", - type: { - name: "Composite", - className: "SummaryCollection" - } - }, - totalCount: { - readOnly: true, - serializedName: "totalCount", - type: { - name: "Number" - } - } + ...ProxyResourceReference.type.modelProperties } } }; -export const UnresolvedDependencyCollection: msRest.CompositeMapper = { - serializedName: "UnresolvedDependencyCollection", +export const LoadBalancerBackendAddressPoolReference: coreClient.CompositeMapper = { type: { name: "Composite", - className: "UnresolvedDependencyCollection", + className: "LoadBalancerBackendAddressPoolReference", modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "UnresolvedDependency" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - }, - summaryCollection: { - readOnly: true, - serializedName: "summaryCollection", - type: { - name: "Composite", - className: "SummaryCollection" - } - }, - totalCount: { - readOnly: true, - serializedName: "totalCount", - type: { - name: "Number" - } - } + ...ProxyResourceReference.type.modelProperties } } }; -export const discriminators = { - 'ResourceSettings' : ResourceSettings, - 'ResourceSettings.Microsoft.Compute/virtualMachines' : VirtualMachineResourceSettings, - 'ResourceSettings.Microsoft.Compute/availabilitySets' : AvailabilitySetResourceSettings, - 'ResourceSettings.Microsoft.Network/virtualNetworks' : VirtualNetworkResourceSettings, - 'ResourceSettings.Microsoft.Network/networkInterfaces' : NetworkInterfaceResourceSettings, - 'ResourceSettings.Microsoft.Network/networkSecurityGroups' : NetworkSecurityGroupResourceSettings, - 'ResourceSettings.Microsoft.Network/loadBalancers' : LoadBalancerResourceSettings, - 'ResourceSettings.Microsoft.Sql/servers' : SqlServerResourceSettings, - 'ResourceSettings.Microsoft.Sql/servers/elasticPools' : SqlElasticPoolResourceSettings, - 'ResourceSettings.Microsoft.Sql/servers/databases' : SqlDatabaseResourceSettings, - 'ResourceSettings.resourceGroups' : ResourceGroupResourceSettings, - 'ResourceSettings.Microsoft.Network/publicIPAddresses' : PublicIPAddressResourceSettings, - 'ResourceSettings.Microsoft.KeyVault/vaults' : KeyVaultResourceSettings, - 'ResourceSettings.Microsoft.Compute/diskEncryptionSets' : DiskEncryptionSetResourceSettings - +export const LoadBalancerNatRuleReference: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LoadBalancerNatRuleReference", + modelProperties: { + ...ProxyResourceReference.type.modelProperties + } + } +}; + +export let discriminators = { + ResourceSettings: ResourceSettings, + "ResourceSettings.Microsoft.Compute/virtualMachines": VirtualMachineResourceSettings, + "ResourceSettings.Microsoft.Compute/availabilitySets": AvailabilitySetResourceSettings, + "ResourceSettings.Microsoft.Network/virtualNetworks": VirtualNetworkResourceSettings, + "ResourceSettings.Microsoft.Network/networkInterfaces": NetworkInterfaceResourceSettings, + "ResourceSettings.Microsoft.Network/networkSecurityGroups": NetworkSecurityGroupResourceSettings, + "ResourceSettings.Microsoft.Network/loadBalancers": LoadBalancerResourceSettings, + "ResourceSettings.Microsoft.Sql/servers": SqlServerResourceSettings, + "ResourceSettings.Microsoft.Sql/servers/elasticPools": SqlElasticPoolResourceSettings, + "ResourceSettings.Microsoft.Sql/servers/databases": SqlDatabaseResourceSettings, + "ResourceSettings.resourceGroups": ResourceGroupResourceSettings, + "ResourceSettings.Microsoft.Network/publicIPAddresses": PublicIPAddressResourceSettings, + "ResourceSettings.Microsoft.KeyVault/vaults": KeyVaultResourceSettings, + "ResourceSettings.Microsoft.Compute/diskEncryptionSets": DiskEncryptionSetResourceSettings }; diff --git a/sdk/resourcemover/arm-resourcemover/src/models/moveCollectionsMappers.ts b/sdk/resourcemover/arm-resourcemover/src/models/moveCollectionsMappers.ts deleted file mode 100644 index 0c4a5c329ff..00000000000 --- a/sdk/resourcemover/arm-resourcemover/src/models/moveCollectionsMappers.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - discriminators, - AffectedMoveResource, - AutomaticResolutionProperties, - AvailabilitySetResourceSettings, - AzureResourceReference, - BaseResource, - BulkRemoveRequest, - CloudError, - CommitRequest, - DiscardRequest, - DiskEncryptionSetResourceSettings, - Identity, - JobStatus, - KeyVaultResourceSettings, - LBBackendAddressPoolResourceSettings, - LBFrontendIPConfigurationResourceSettings, - LoadBalancerBackendAddressPoolReference, - LoadBalancerNatRuleReference, - LoadBalancerResourceSettings, - ManualResolutionProperties, - MoveCollection, - MoveCollectionProperties, - MoveCollectionPropertiesErrors, - MoveCollectionResultList, - MoveErrorInfo, - MoveResource, - MoveResourceDependency, - MoveResourceDependencyOverride, - MoveResourceError, - MoveResourceErrorBody, - MoveResourceProperties, - MoveResourcePropertiesErrors, - MoveResourcePropertiesMoveStatus, - MoveResourceStatus, - NetworkInterfaceResourceSettings, - NetworkSecurityGroupResourceSettings, - NicIpConfigurationResourceSettings, - NsgReference, - NsgSecurityRule, - OperationErrorAdditionalInfo, - OperationStatus, - OperationStatusError, - PrepareRequest, - ProxyResourceReference, - PublicIPAddressResourceSettings, - PublicIpReference, - RequiredForResourcesCollection, - ResourceGroupResourceSettings, - ResourceMoveRequest, - ResourceSettings, - SqlDatabaseResourceSettings, - SqlElasticPoolResourceSettings, - SqlServerResourceSettings, - SubnetReference, - SubnetResourceSettings, - UpdateMoveCollectionRequest, - VirtualMachineResourceSettings, - VirtualNetworkResourceSettings -} from "../models/mappers"; diff --git a/sdk/resourcemover/arm-resourcemover/src/models/moveResourcesMappers.ts b/sdk/resourcemover/arm-resourcemover/src/models/moveResourcesMappers.ts deleted file mode 100644 index ab9252fc77c..00000000000 --- a/sdk/resourcemover/arm-resourcemover/src/models/moveResourcesMappers.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - discriminators, - AffectedMoveResource, - AutomaticResolutionProperties, - AvailabilitySetResourceSettings, - AzureResourceReference, - BaseResource, - CloudError, - DiskEncryptionSetResourceSettings, - Identity, - JobStatus, - KeyVaultResourceSettings, - LBBackendAddressPoolResourceSettings, - LBFrontendIPConfigurationResourceSettings, - LoadBalancerBackendAddressPoolReference, - LoadBalancerNatRuleReference, - LoadBalancerResourceSettings, - ManualResolutionProperties, - MoveCollection, - MoveCollectionProperties, - MoveCollectionPropertiesErrors, - MoveErrorInfo, - MoveResource, - MoveResourceCollection, - MoveResourceDependency, - MoveResourceDependencyOverride, - MoveResourceError, - MoveResourceErrorBody, - MoveResourceProperties, - MoveResourcePropertiesErrors, - MoveResourcePropertiesMoveStatus, - MoveResourceStatus, - NetworkInterfaceResourceSettings, - NetworkSecurityGroupResourceSettings, - NicIpConfigurationResourceSettings, - NsgReference, - NsgSecurityRule, - OperationErrorAdditionalInfo, - OperationStatus, - OperationStatusError, - ProxyResourceReference, - PublicIPAddressResourceSettings, - PublicIpReference, - ResourceGroupResourceSettings, - ResourceSettings, - SqlDatabaseResourceSettings, - SqlElasticPoolResourceSettings, - SqlServerResourceSettings, - SubnetReference, - SubnetResourceSettings, - Summary, - SummaryCollection, - VirtualMachineResourceSettings, - VirtualNetworkResourceSettings -} from "../models/mappers"; diff --git a/sdk/resourcemover/arm-resourcemover/src/models/parameters.ts b/sdk/resourcemover/arm-resourcemover/src/models/parameters.ts index 0c7361ca1ef..817b7a0fc2e 100644 --- a/sdk/resourcemover/arm-resourcemover/src/models/parameters.ts +++ b/sdk/resourcemover/arm-resourcemover/src/models/parameters.ts @@ -3,49 +3,166 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + MoveCollection as MoveCollectionMapper, + UpdateMoveCollectionRequest as UpdateMoveCollectionRequestMapper, + PrepareRequest as PrepareRequestMapper, + ResourceMoveRequest as ResourceMoveRequestMapper, + CommitRequest as CommitRequestMapper, + DiscardRequest as DiscardRequestMapper, + BulkRemoveRequest as BulkRemoveRequestMapper, + MoveResource as MoveResourceMapper +} from "../models/mappers"; -export const acceptLanguage: msRest.OperationParameter = { - parameterPath: "acceptLanguage", +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], mapper: { - serializedName: "accept-language", - defaultValue: 'en-US', + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", type: { name: "String" } } }; -export const apiVersion: msRest.OperationQueryParameter = { + +export const body: OperationParameter = { + parameterPath: ["options", "body"], + mapper: MoveCollectionMapper +}; + +export const accept: OperationParameter = { + parameterPath: "accept", + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", + type: { + name: "String" + } + } +}; + +export const $host: OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", + mapper: { + serializedName: "subscriptionId", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + serializedName: "resourceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const moveCollectionName: OperationURLParameter = { + parameterPath: "moveCollectionName", + mapper: { + serializedName: "moveCollectionName", + required: true, + type: { + name: "String" + } + } +}; + +export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - required: true, + defaultValue: "2021-08-01", + isConstant: true, serializedName: "api-version", type: { name: "String" } } }; -export const dependencyLevel: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "dependencyLevel" - ], + +export const body1: OperationParameter = { + parameterPath: ["options", "body"], + mapper: UpdateMoveCollectionRequestMapper +}; + +export const body2: OperationParameter = { + parameterPath: ["options", "body"], + mapper: PrepareRequestMapper +}; + +export const body3: OperationParameter = { + parameterPath: ["options", "body"], + mapper: ResourceMoveRequestMapper +}; + +export const body4: OperationParameter = { + parameterPath: ["options", "body"], + mapper: CommitRequestMapper +}; + +export const body5: OperationParameter = { + parameterPath: ["options", "body"], + mapper: DiscardRequestMapper +}; + +export const body6: OperationParameter = { + parameterPath: ["options", "body"], + mapper: BulkRemoveRequestMapper +}; + +export const sourceId: OperationQueryParameter = { + parameterPath: "sourceId", mapper: { - serializedName: "dependencyLevel", + serializedName: "sourceId", + required: true, type: { name: "String" } } }; -export const filter: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "filter" - ], + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const filter: OperationQueryParameter = { + parameterPath: ["options", "filter"], mapper: { serializedName: "$filter", type: { @@ -53,42 +170,35 @@ export const filter: msRest.OperationQueryParameter = { } } }; -export const moveCollectionName: msRest.OperationURLParameter = { - parameterPath: "moveCollectionName", - mapper: { - required: true, - serializedName: "moveCollectionName", - type: { - name: "String" - } - } + +export const body7: OperationParameter = { + parameterPath: ["options", "body"], + mapper: MoveResourceMapper }; -export const moveResourceName: msRest.OperationURLParameter = { + +export const moveResourceName: OperationURLParameter = { parameterPath: "moveResourceName", mapper: { - required: true, serializedName: "moveResourceName", + required: true, type: { name: "String" } } }; -export const nextPageLink: msRest.OperationURLParameter = { - parameterPath: "nextPageLink", + +export const dependencyLevel: OperationQueryParameter = { + parameterPath: ["options", "dependencyLevel"], mapper: { - required: true, - serializedName: "nextLink", + serializedName: "dependencyLevel", type: { name: "String" } - }, - skipEncoding: true + } }; -export const orderby: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "orderby" - ], + +export const orderby: OperationQueryParameter = { + parameterPath: ["options", "orderby"], mapper: { serializedName: "$orderby", type: { @@ -96,33 +206,3 @@ export const orderby: msRest.OperationQueryParameter = { } } }; -export const resourceGroupName: msRest.OperationURLParameter = { - parameterPath: "resourceGroupName", - mapper: { - required: true, - serializedName: "resourceGroupName", - type: { - name: "String" - } - } -}; -export const sourceId: msRest.OperationQueryParameter = { - parameterPath: "sourceId", - mapper: { - required: true, - serializedName: "sourceId", - type: { - name: "String" - } - } -}; -export const subscriptionId: msRest.OperationURLParameter = { - parameterPath: "subscriptionId", - mapper: { - required: true, - serializedName: "subscriptionId", - type: { - name: "String" - } - } -}; diff --git a/sdk/resourcemover/arm-resourcemover/src/operations/index.ts b/sdk/resourcemover/arm-resourcemover/src/operations/index.ts index 4577ae3ec10..ef4256fdd91 100644 --- a/sdk/resourcemover/arm-resourcemover/src/operations/index.ts +++ b/sdk/resourcemover/arm-resourcemover/src/operations/index.ts @@ -3,8 +3,7 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ export * from "./moveCollections"; diff --git a/sdk/resourcemover/arm-resourcemover/src/operations/moveCollections.ts b/sdk/resourcemover/arm-resourcemover/src/operations/moveCollections.ts index 936708ced17..cfa36898ad8 100644 --- a/sdk/resourcemover/arm-resourcemover/src/operations/moveCollections.ts +++ b/sdk/resourcemover/arm-resourcemover/src/operations/moveCollections.ts @@ -3,276 +3,880 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/moveCollectionsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { MoveCollections } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { ResourceMoverServiceAPIContext } from "../resourceMoverServiceAPIContext"; +import { ResourceMoverServiceAPI } from "../resourceMoverServiceAPI"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + MoveCollection, + MoveCollectionsListMoveCollectionsBySubscriptionNextOptionalParams, + MoveCollectionsListMoveCollectionsBySubscriptionOptionalParams, + MoveCollectionsListMoveCollectionsByResourceGroupNextOptionalParams, + MoveCollectionsListMoveCollectionsByResourceGroupOptionalParams, + MoveCollectionsCreateOptionalParams, + MoveCollectionsCreateResponse, + MoveCollectionsUpdateOptionalParams, + MoveCollectionsUpdateResponse, + MoveCollectionsDeleteOptionalParams, + MoveCollectionsDeleteResponse, + MoveCollectionsGetOptionalParams, + MoveCollectionsGetResponse, + MoveCollectionsPrepareOptionalParams, + MoveCollectionsPrepareResponse, + MoveCollectionsInitiateMoveOptionalParams, + MoveCollectionsInitiateMoveResponse, + MoveCollectionsCommitOptionalParams, + MoveCollectionsCommitResponse, + MoveCollectionsDiscardOptionalParams, + MoveCollectionsDiscardResponse, + MoveCollectionsResolveDependenciesOptionalParams, + MoveCollectionsResolveDependenciesResponse, + MoveCollectionsBulkRemoveOptionalParams, + MoveCollectionsBulkRemoveResponse, + MoveCollectionsListMoveCollectionsBySubscriptionResponse, + MoveCollectionsListMoveCollectionsByResourceGroupResponse, + MoveCollectionsListRequiredForOptionalParams, + MoveCollectionsListRequiredForResponse, + MoveCollectionsListMoveCollectionsBySubscriptionNextResponse, + MoveCollectionsListMoveCollectionsByResourceGroupNextResponse +} from "../models"; -/** Class representing a MoveCollections. */ -export class MoveCollections { - private readonly client: ResourceMoverServiceAPIContext; +/// +/** Class containing MoveCollections operations. */ +export class MoveCollectionsImpl implements MoveCollections { + private readonly client: ResourceMoverServiceAPI; /** - * Create a MoveCollections. - * @param {ResourceMoverServiceAPIContext} client Reference to the service client. + * Initialize a new instance of the class MoveCollections class. + * @param client Reference to the service client */ - constructor(client: ResourceMoverServiceAPIContext) { + constructor(client: ResourceMoverServiceAPI) { this.client = client; } + /** + * Get all the Move Collections in the subscription. + * @param options The options parameters. + */ + public listMoveCollectionsBySubscription( + options?: MoveCollectionsListMoveCollectionsBySubscriptionOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listMoveCollectionsBySubscriptionPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listMoveCollectionsBySubscriptionPagingPage(options); + } + }; + } + + private async *listMoveCollectionsBySubscriptionPagingPage( + options?: MoveCollectionsListMoveCollectionsBySubscriptionOptionalParams + ): AsyncIterableIterator { + let result = await this._listMoveCollectionsBySubscription(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listMoveCollectionsBySubscriptionNext( + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listMoveCollectionsBySubscriptionPagingAll( + options?: MoveCollectionsListMoveCollectionsBySubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listMoveCollectionsBySubscriptionPagingPage( + options + )) { + yield* page; + } + } + + /** + * Get all the Move Collections in the resource group. + * @param resourceGroupName The Resource Group Name. + * @param options The options parameters. + */ + public listMoveCollectionsByResourceGroup( + resourceGroupName: string, + options?: MoveCollectionsListMoveCollectionsByResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listMoveCollectionsByResourceGroupPagingAll( + resourceGroupName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listMoveCollectionsByResourceGroupPagingPage( + resourceGroupName, + options + ); + } + }; + } + + private async *listMoveCollectionsByResourceGroupPagingPage( + resourceGroupName: string, + options?: MoveCollectionsListMoveCollectionsByResourceGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listMoveCollectionsByResourceGroup( + resourceGroupName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listMoveCollectionsByResourceGroupNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listMoveCollectionsByResourceGroupPagingAll( + resourceGroupName: string, + options?: MoveCollectionsListMoveCollectionsByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listMoveCollectionsByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + /** * Creates or updates a move collection. * @param resourceGroupName The Resource Group Name. * @param moveCollectionName The Move Collection Name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - create(resourceGroupName: string, moveCollectionName: string, options?: Models.MoveCollectionsCreateOptionalParams): Promise; - /** - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param callback The callback - */ - create(resourceGroupName: string, moveCollectionName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param options The optional parameters - * @param callback The callback - */ - create(resourceGroupName: string, moveCollectionName: string, options: Models.MoveCollectionsCreateOptionalParams, callback: msRest.ServiceCallback): void; - create(resourceGroupName: string, moveCollectionName: string, options?: Models.MoveCollectionsCreateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + create( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsCreateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - moveCollectionName, - options - }, - createOperationSpec, - callback) as Promise; + { resourceGroupName, moveCollectionName, options }, + createOperationSpec + ); } /** * Updates a move collection. * @param resourceGroupName The Resource Group Name. * @param moveCollectionName The Move Collection Name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - update(resourceGroupName: string, moveCollectionName: string, options?: Models.MoveCollectionsUpdateOptionalParams): Promise; - /** - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param callback The callback - */ - update(resourceGroupName: string, moveCollectionName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param options The optional parameters - * @param callback The callback - */ - update(resourceGroupName: string, moveCollectionName: string, options: Models.MoveCollectionsUpdateOptionalParams, callback: msRest.ServiceCallback): void; - update(resourceGroupName: string, moveCollectionName: string, options?: Models.MoveCollectionsUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + update( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsUpdateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - moveCollectionName, - options - }, - updateOperationSpec, - callback) as Promise; + { resourceGroupName, moveCollectionName, options }, + updateOperationSpec + ); } /** * Deletes a move collection. * @param resourceGroupName The Resource Group Name. * @param moveCollectionName The Move Collection Name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - deleteMethod(resourceGroupName: string, moveCollectionName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginDeleteMethod(resourceGroupName,moveCollectionName,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginDelete( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsDeleteOptionalParams + ): Promise< + PollerLike< + PollOperationState, + MoveCollectionsDeleteResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, moveCollectionName, options }, + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Deletes a move collection. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + moveCollectionName, + options + ); + return poller.pollUntilDone(); } /** * Gets the move collection. * @param resourceGroupName The Resource Group Name. * @param moveCollectionName The Move Collection Name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, moveCollectionName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param callback The callback - */ - get(resourceGroupName: string, moveCollectionName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, moveCollectionName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, moveCollectionName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - moveCollectionName, - options - }, - getOperationSpec, - callback) as Promise; + { resourceGroupName, moveCollectionName, options }, + getOperationSpec + ); } /** - * Initiates prepare for the set of resources included in the request body. The prepare operation - * is on the moveResources that are in the moveState 'PreparePending' or 'PrepareFailed', on a - * successful completion the moveResource moveState do a transition to MovePending. To aid the user - * to prerequisite the operation the client can call operation with validateOnly property set to - * true. - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param [options] The optional parameters - * @returns Promise - */ - prepare(resourceGroupName: string, moveCollectionName: string, options?: Models.MoveCollectionsPrepareOptionalParams): Promise { - return this.beginPrepare(resourceGroupName,moveCollectionName,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; - } - - /** - * Moves the set of resources included in the request body. The move operation is triggered after - * the moveResources are in the moveState 'MovePending' or 'MoveFailed', on a successful completion - * the moveResource moveState do a transition to CommitPending. To aid the user to prerequisite the - * operation the client can call operation with validateOnly property set to true. - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param [options] The optional parameters - * @returns Promise - */ - initiateMove(resourceGroupName: string, moveCollectionName: string, options?: Models.MoveCollectionsInitiateMoveOptionalParams): Promise { - return this.beginInitiateMove(resourceGroupName,moveCollectionName,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; - } - - /** - * Commits the set of resources included in the request body. The commit operation is triggered on - * the moveResources in the moveState 'CommitPending' or 'CommitFailed', on a successful completion - * the moveResource moveState do a transition to Committed. To aid the user to prerequisite the - * operation the client can call operation with validateOnly property set to true. - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param [options] The optional parameters - * @returns Promise - */ - commit(resourceGroupName: string, moveCollectionName: string, options?: Models.MoveCollectionsCommitOptionalParams): Promise { - return this.beginCommit(resourceGroupName,moveCollectionName,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; - } - - /** - * Discards the set of resources included in the request body. The discard operation is triggered - * on the moveResources in the moveState 'CommitPending' or 'DiscardFailed', on a successful + * Initiates prepare for the set of resources included in the request body. The prepare operation is on + * the moveResources that are in the moveState 'PreparePending' or 'PrepareFailed', on a successful * completion the moveResource moveState do a transition to MovePending. To aid the user to * prerequisite the operation the client can call operation with validateOnly property set to true. * @param resourceGroupName The Resource Group Name. * @param moveCollectionName The Move Collection Name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - discard(resourceGroupName: string, moveCollectionName: string, options?: Models.MoveCollectionsDiscardOptionalParams): Promise { - return this.beginDiscard(resourceGroupName,moveCollectionName,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginPrepare( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsPrepareOptionalParams + ): Promise< + PollerLike< + PollOperationState, + MoveCollectionsPrepareResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, moveCollectionName, options }, + prepareOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Initiates prepare for the set of resources included in the request body. The prepare operation is on + * the moveResources that are in the moveState 'PreparePending' or 'PrepareFailed', on a successful + * completion the moveResource moveState do a transition to MovePending. To aid the user to + * prerequisite the operation the client can call operation with validateOnly property set to true. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + async beginPrepareAndWait( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsPrepareOptionalParams + ): Promise { + const poller = await this.beginPrepare( + resourceGroupName, + moveCollectionName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Moves the set of resources included in the request body. The move operation is triggered after the + * moveResources are in the moveState 'MovePending' or 'MoveFailed', on a successful completion the + * moveResource moveState do a transition to CommitPending. To aid the user to prerequisite the + * operation the client can call operation with validateOnly property set to true. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + async beginInitiateMove( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsInitiateMoveOptionalParams + ): Promise< + PollerLike< + PollOperationState, + MoveCollectionsInitiateMoveResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, moveCollectionName, options }, + initiateMoveOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Moves the set of resources included in the request body. The move operation is triggered after the + * moveResources are in the moveState 'MovePending' or 'MoveFailed', on a successful completion the + * moveResource moveState do a transition to CommitPending. To aid the user to prerequisite the + * operation the client can call operation with validateOnly property set to true. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + async beginInitiateMoveAndWait( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsInitiateMoveOptionalParams + ): Promise { + const poller = await this.beginInitiateMove( + resourceGroupName, + moveCollectionName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Commits the set of resources included in the request body. The commit operation is triggered on the + * moveResources in the moveState 'CommitPending' or 'CommitFailed', on a successful completion the + * moveResource moveState do a transition to Committed. To aid the user to prerequisite the operation + * the client can call operation with validateOnly property set to true. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + async beginCommit( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsCommitOptionalParams + ): Promise< + PollerLike< + PollOperationState, + MoveCollectionsCommitResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, moveCollectionName, options }, + commitOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Commits the set of resources included in the request body. The commit operation is triggered on the + * moveResources in the moveState 'CommitPending' or 'CommitFailed', on a successful completion the + * moveResource moveState do a transition to Committed. To aid the user to prerequisite the operation + * the client can call operation with validateOnly property set to true. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + async beginCommitAndWait( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsCommitOptionalParams + ): Promise { + const poller = await this.beginCommit( + resourceGroupName, + moveCollectionName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Discards the set of resources included in the request body. The discard operation is triggered on + * the moveResources in the moveState 'CommitPending' or 'DiscardFailed', on a successful completion + * the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the + * operation the client can call operation with validateOnly property set to true. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + async beginDiscard( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsDiscardOptionalParams + ): Promise< + PollerLike< + PollOperationState, + MoveCollectionsDiscardResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, moveCollectionName, options }, + discardOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Discards the set of resources included in the request body. The discard operation is triggered on + * the moveResources in the moveState 'CommitPending' or 'DiscardFailed', on a successful completion + * the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the + * operation the client can call operation with validateOnly property set to true. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + async beginDiscardAndWait( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsDiscardOptionalParams + ): Promise { + const poller = await this.beginDiscard( + resourceGroupName, + moveCollectionName, + options + ); + return poller.pollUntilDone(); } /** * Computes, resolves and validate the dependencies of the moveResources in the move collection. * @param resourceGroupName The Resource Group Name. * @param moveCollectionName The Move Collection Name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - resolveDependencies(resourceGroupName: string, moveCollectionName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginResolveDependencies(resourceGroupName,moveCollectionName,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginResolveDependencies( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsResolveDependenciesOptionalParams + ): Promise< + PollerLike< + PollOperationState, + MoveCollectionsResolveDependenciesResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, moveCollectionName, options }, + resolveDependenciesOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Computes, resolves and validate the dependencies of the moveResources in the move collection. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + async beginResolveDependenciesAndWait( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsResolveDependenciesOptionalParams + ): Promise { + const poller = await this.beginResolveDependencies( + resourceGroupName, + moveCollectionName, + options + ); + return poller.pollUntilDone(); } /** * Removes the set of move resources included in the request body from move collection. The - * orchestration is done by service. To aid the user to prerequisite the operation the client can - * call operation with validateOnly property set to true. + * orchestration is done by service. To aid the user to prerequisite the operation the client can call + * operation with validateOnly property set to true. * @param resourceGroupName * @param moveCollectionName - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - bulkRemove(resourceGroupName: string, moveCollectionName: string, options?: Models.MoveCollectionsBulkRemoveOptionalParams): Promise { - return this.beginBulkRemove(resourceGroupName,moveCollectionName,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginBulkRemove( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsBulkRemoveOptionalParams + ): Promise< + PollerLike< + PollOperationState, + MoveCollectionsBulkRemoveResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, moveCollectionName, options }, + bulkRemoveOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Removes the set of move resources included in the request body from move collection. The + * orchestration is done by service. To aid the user to prerequisite the operation the client can call + * operation with validateOnly property set to true. + * @param resourceGroupName + * @param moveCollectionName + * @param options The options parameters. + */ + async beginBulkRemoveAndWait( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsBulkRemoveOptionalParams + ): Promise { + const poller = await this.beginBulkRemove( + resourceGroupName, + moveCollectionName, + options + ); + return poller.pollUntilDone(); } /** * Get all the Move Collections in the subscription. - * @summary Get all Move Collections. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listMoveCollectionsBySubscription(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - listMoveCollectionsBySubscription(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - listMoveCollectionsBySubscription(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listMoveCollectionsBySubscription(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listMoveCollectionsBySubscription( + options?: MoveCollectionsListMoveCollectionsBySubscriptionOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - options - }, - listMoveCollectionsBySubscriptionOperationSpec, - callback) as Promise; + { options }, + listMoveCollectionsBySubscriptionOperationSpec + ); } /** * Get all the Move Collections in the resource group. - * @summary Get all Move Collections. * @param resourceGroupName The Resource Group Name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listMoveCollectionsByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The Resource Group Name. - * @param callback The callback - */ - listMoveCollectionsByResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The Resource Group Name. - * @param options The optional parameters - * @param callback The callback - */ - listMoveCollectionsByResourceGroup(resourceGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listMoveCollectionsByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listMoveCollectionsByResourceGroup( + resourceGroupName: string, + options?: MoveCollectionsListMoveCollectionsByResourceGroupOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - options - }, - listMoveCollectionsByResourceGroupOperationSpec, - callback) as Promise; + { resourceGroupName, options }, + listMoveCollectionsByResourceGroupOperationSpec + ); } /** @@ -280,260 +884,61 @@ export class MoveCollections { * @param resourceGroupName The Resource Group Name. * @param moveCollectionName The Move Collection Name. * @param sourceId The sourceId for which the api is invoked. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listRequiredFor(resourceGroupName: string, moveCollectionName: string, sourceId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param sourceId The sourceId for which the api is invoked. - * @param callback The callback - */ - listRequiredFor(resourceGroupName: string, moveCollectionName: string, sourceId: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param sourceId The sourceId for which the api is invoked. - * @param options The optional parameters - * @param callback The callback - */ - listRequiredFor(resourceGroupName: string, moveCollectionName: string, sourceId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listRequiredFor(resourceGroupName: string, moveCollectionName: string, sourceId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + listRequiredFor( + resourceGroupName: string, + moveCollectionName: string, + sourceId: string, + options?: MoveCollectionsListRequiredForOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - moveCollectionName, - sourceId, - options - }, - listRequiredForOperationSpec, - callback) as Promise; + { resourceGroupName, moveCollectionName, sourceId, options }, + listRequiredForOperationSpec + ); } /** - * Deletes a move collection. - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param [options] The optional parameters - * @returns Promise + * ListMoveCollectionsBySubscriptionNext + * @param nextLink The nextLink from the previous successful call to the + * ListMoveCollectionsBySubscription method. + * @param options The options parameters. */ - beginDeleteMethod(resourceGroupName: string, moveCollectionName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - moveCollectionName, - options - }, - beginDeleteMethodOperationSpec, - options); - } - - /** - * Initiates prepare for the set of resources included in the request body. The prepare operation - * is on the moveResources that are in the moveState 'PreparePending' or 'PrepareFailed', on a - * successful completion the moveResource moveState do a transition to MovePending. To aid the user - * to prerequisite the operation the client can call operation with validateOnly property set to - * true. - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param [options] The optional parameters - * @returns Promise - */ - beginPrepare(resourceGroupName: string, moveCollectionName: string, options?: Models.MoveCollectionsBeginPrepareOptionalParams): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - moveCollectionName, - options - }, - beginPrepareOperationSpec, - options); - } - - /** - * Moves the set of resources included in the request body. The move operation is triggered after - * the moveResources are in the moveState 'MovePending' or 'MoveFailed', on a successful completion - * the moveResource moveState do a transition to CommitPending. To aid the user to prerequisite the - * operation the client can call operation with validateOnly property set to true. - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param [options] The optional parameters - * @returns Promise - */ - beginInitiateMove(resourceGroupName: string, moveCollectionName: string, options?: Models.MoveCollectionsBeginInitiateMoveOptionalParams): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - moveCollectionName, - options - }, - beginInitiateMoveOperationSpec, - options); - } - - /** - * Commits the set of resources included in the request body. The commit operation is triggered on - * the moveResources in the moveState 'CommitPending' or 'CommitFailed', on a successful completion - * the moveResource moveState do a transition to Committed. To aid the user to prerequisite the - * operation the client can call operation with validateOnly property set to true. - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param [options] The optional parameters - * @returns Promise - */ - beginCommit(resourceGroupName: string, moveCollectionName: string, options?: Models.MoveCollectionsBeginCommitOptionalParams): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - moveCollectionName, - options - }, - beginCommitOperationSpec, - options); - } - - /** - * Discards the set of resources included in the request body. The discard operation is triggered - * on the moveResources in the moveState 'CommitPending' or 'DiscardFailed', on a successful - * completion the moveResource moveState do a transition to MovePending. To aid the user to - * prerequisite the operation the client can call operation with validateOnly property set to true. - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param [options] The optional parameters - * @returns Promise - */ - beginDiscard(resourceGroupName: string, moveCollectionName: string, options?: Models.MoveCollectionsBeginDiscardOptionalParams): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - moveCollectionName, - options - }, - beginDiscardOperationSpec, - options); - } - - /** - * Computes, resolves and validate the dependencies of the moveResources in the move collection. - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param [options] The optional parameters - * @returns Promise - */ - beginResolveDependencies(resourceGroupName: string, moveCollectionName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - moveCollectionName, - options - }, - beginResolveDependenciesOperationSpec, - options); - } - - /** - * Removes the set of move resources included in the request body from move collection. The - * orchestration is done by service. To aid the user to prerequisite the operation the client can - * call operation with validateOnly property set to true. - * @param resourceGroupName - * @param moveCollectionName - * @param [options] The optional parameters - * @returns Promise - */ - beginBulkRemove(resourceGroupName: string, moveCollectionName: string, options?: Models.MoveCollectionsBeginBulkRemoveOptionalParams): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - moveCollectionName, - options - }, - beginBulkRemoveOperationSpec, - options); - } - - /** - * Get all the Move Collections in the subscription. - * @summary Get all Move Collections. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listMoveCollectionsBySubscriptionNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listMoveCollectionsBySubscriptionNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listMoveCollectionsBySubscriptionNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listMoveCollectionsBySubscriptionNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listMoveCollectionsBySubscriptionNext( + nextLink: string, + options?: MoveCollectionsListMoveCollectionsBySubscriptionNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listMoveCollectionsBySubscriptionNextOperationSpec, - callback) as Promise; + { nextLink, options }, + listMoveCollectionsBySubscriptionNextOperationSpec + ); } /** - * Get all the Move Collections in the resource group. - * @summary Get all Move Collections. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * ListMoveCollectionsByResourceGroupNext + * @param resourceGroupName The Resource Group Name. + * @param nextLink The nextLink from the previous successful call to the + * ListMoveCollectionsByResourceGroup method. + * @param options The options parameters. */ - listMoveCollectionsByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listMoveCollectionsByResourceGroupNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listMoveCollectionsByResourceGroupNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listMoveCollectionsByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listMoveCollectionsByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: MoveCollectionsListMoveCollectionsByResourceGroupNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listMoveCollectionsByResourceGroupNextOperationSpec, - callback) as Promise; + { resourceGroupName, nextLink, options }, + listMoveCollectionsByResourceGroupNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const createOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}", httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.moveCollectionName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: [ - "options", - "body" - ], - mapper: Mappers.MoveCollection - }, responses: { 200: { bodyMapper: Mappers.MoveCollection @@ -545,30 +950,22 @@ const createOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + requestBody: Parameters.body, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.moveCollectionName + ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", serializer }; - -const updateOperationSpec: msRest.OperationSpec = { +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}", httpMethod: "PATCH", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.moveCollectionName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: [ - "options", - "body" - ], - mapper: Mappers.UpdateMoveCollectionRequest - }, responses: { 200: { bodyMapper: Mappers.MoveCollection @@ -577,23 +974,53 @@ const updateOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}", + requestBody: Parameters.body1, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.moveCollectionName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}", + httpMethod: "DELETE", + responses: { + 200: { + bodyMapper: Mappers.OperationStatus + }, + 201: { + bodyMapper: Mappers.OperationStatus + }, + 202: { + bodyMapper: Mappers.OperationStatus + }, + 204: { + bodyMapper: Mappers.OperationStatus + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.moveCollectionName ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.MoveCollection @@ -602,21 +1029,216 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.moveCollectionName + ], + headerParameters: [Parameters.accept], serializer }; - -const listMoveCollectionsBySubscriptionOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.Migrate/moveCollections", +const prepareOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/prepare", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.OperationStatus + }, + 201: { + bodyMapper: Mappers.OperationStatus + }, + 202: { + bodyMapper: Mappers.OperationStatus + }, + 204: { + bodyMapper: Mappers.OperationStatus + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.body2, + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.subscriptionId + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.moveCollectionName ], - queryParameters: [ - Parameters.apiVersion + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const initiateMoveOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/initiateMove", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.OperationStatus + }, + 201: { + bodyMapper: Mappers.OperationStatus + }, + 202: { + bodyMapper: Mappers.OperationStatus + }, + 204: { + bodyMapper: Mappers.OperationStatus + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.body3, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.moveCollectionName ], - headerParameters: [ - Parameters.acceptLanguage + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const commitOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/commit", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.OperationStatus + }, + 201: { + bodyMapper: Mappers.OperationStatus + }, + 202: { + bodyMapper: Mappers.OperationStatus + }, + 204: { + bodyMapper: Mappers.OperationStatus + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.body4, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.moveCollectionName ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const discardOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/discard", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.OperationStatus + }, + 201: { + bodyMapper: Mappers.OperationStatus + }, + 202: { + bodyMapper: Mappers.OperationStatus + }, + 204: { + bodyMapper: Mappers.OperationStatus + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.body5, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.moveCollectionName + ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const resolveDependenciesOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/resolveDependencies", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.OperationStatus + }, + 201: { + bodyMapper: Mappers.OperationStatus + }, + 202: { + bodyMapper: Mappers.OperationStatus + }, + 204: { + bodyMapper: Mappers.OperationStatus + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.moveCollectionName + ], + headerParameters: [Parameters.accept], + serializer +}; +const bulkRemoveOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/bulkRemove", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.OperationStatus + }, + 201: { + bodyMapper: Mappers.OperationStatus + }, + 202: { + bodyMapper: Mappers.OperationStatus + }, + 204: { + bodyMapper: Mappers.OperationStatus + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.body6, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.moveCollectionName + ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const listMoveCollectionsBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.Migrate/moveCollections", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.MoveCollectionResultList @@ -625,48 +1247,36 @@ const listMoveCollectionsBySubscriptionOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], serializer }; - -const listMoveCollectionsByResourceGroupOperationSpec: msRest.OperationSpec = { +const listMoveCollectionsByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections", + responses: { + 200: { + bodyMapper: Mappers.MoveCollectionResultList + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.MoveCollectionResultList - }, - default: { - bodyMapper: Mappers.CloudError - } - }, + headerParameters: [Parameters.accept], serializer }; - -const listRequiredForOperationSpec: msRest.OperationSpec = { +const listRequiredForOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/requiredFor", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/requiredFor", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.moveCollectionName - ], - queryParameters: [ - Parameters.sourceId, - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.RequiredForResourcesCollection @@ -675,240 +1285,19 @@ const listRequiredForOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const beginDeleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}", + queryParameters: [Parameters.apiVersion, Parameters.sourceId], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.moveCollectionName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.OperationStatus - }, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.CloudError - } - }, + headerParameters: [Parameters.accept], serializer }; - -const beginPrepareOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/prepare", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.moveCollectionName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: [ - "options", - "body" - ], - mapper: Mappers.PrepareRequest - }, - responses: { - 200: { - bodyMapper: Mappers.OperationStatus - }, - 202: {}, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const beginInitiateMoveOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/initiateMove", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.moveCollectionName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: [ - "options", - "body" - ], - mapper: Mappers.ResourceMoveRequest - }, - responses: { - 200: { - bodyMapper: Mappers.OperationStatus - }, - 202: {}, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const beginCommitOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/commit", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.moveCollectionName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: [ - "options", - "body" - ], - mapper: Mappers.CommitRequest - }, - responses: { - 200: { - bodyMapper: Mappers.OperationStatus - }, - 202: {}, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const beginDiscardOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/discard", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.moveCollectionName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: [ - "options", - "body" - ], - mapper: Mappers.DiscardRequest - }, - responses: { - 200: { - bodyMapper: Mappers.OperationStatus - }, - 202: {}, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const beginResolveDependenciesOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/resolveDependencies", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.moveCollectionName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.OperationStatus - }, - 202: {}, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const beginBulkRemoveOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/bulkRemove", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.moveCollectionName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: [ - "options", - "body" - ], - mapper: Mappers.BulkRemoveRequest - }, - responses: { - 200: { - bodyMapper: Mappers.OperationStatus - }, - 202: {}, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listMoveCollectionsBySubscriptionNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listMoveCollectionsBySubscriptionNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.MoveCollectionResultList @@ -917,22 +1306,18 @@ const listMoveCollectionsBySubscriptionNextOperationSpec: msRest.OperationSpec = bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; - -const listMoveCollectionsByResourceGroupNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listMoveCollectionsByResourceGroupNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.MoveCollectionResultList @@ -941,5 +1326,13 @@ const listMoveCollectionsByResourceGroupNextOperationSpec: msRest.OperationSpec bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/resourcemover/arm-resourcemover/src/operations/moveResources.ts b/sdk/resourcemover/arm-resourcemover/src/operations/moveResources.ts index 27eb9af0315..10cbd06ef19 100644 --- a/sdk/resourcemover/arm-resourcemover/src/operations/moveResources.ts +++ b/sdk/resourcemover/arm-resourcemover/src/operations/moveResources.ts @@ -3,26 +3,41 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/moveResourcesMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { MoveResources } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { ResourceMoverServiceAPIContext } from "../resourceMoverServiceAPIContext"; +import { ResourceMoverServiceAPI } from "../resourceMoverServiceAPI"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + MoveResource, + MoveResourcesListNextOptionalParams, + MoveResourcesListOptionalParams, + MoveResourcesListResponse, + MoveResourcesCreateOptionalParams, + MoveResourcesCreateResponse, + MoveResourcesDeleteOptionalParams, + MoveResourcesDeleteResponse, + MoveResourcesGetOptionalParams, + MoveResourcesGetResponse, + MoveResourcesListNextResponse +} from "../models"; -/** Class representing a MoveResources. */ -export class MoveResources { - private readonly client: ResourceMoverServiceAPIContext; +/// +/** Class containing MoveResources operations. */ +export class MoveResourcesImpl implements MoveResources { + private readonly client: ResourceMoverServiceAPI; /** - * Create a MoveResources. - * @param {ResourceMoverServiceAPIContext} client Reference to the service client. + * Initialize a new instance of the class MoveResources class. + * @param client Reference to the service client */ - constructor(client: ResourceMoverServiceAPIContext) { + constructor(client: ResourceMoverServiceAPI) { this.client = client; } @@ -30,32 +45,88 @@ export class MoveResources { * Lists the Move Resources in the move collection. * @param resourceGroupName The Resource Group Name. * @param moveCollectionName The Move Collection Name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(resourceGroupName: string, moveCollectionName: string, options?: Models.MoveResourcesListOptionalParams): Promise; - /** - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param callback The callback - */ - list(resourceGroupName: string, moveCollectionName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param options The optional parameters - * @param callback The callback - */ - list(resourceGroupName: string, moveCollectionName: string, options: Models.MoveResourcesListOptionalParams, callback: msRest.ServiceCallback): void; - list(resourceGroupName: string, moveCollectionName: string, options?: Models.MoveResourcesListOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { + public list( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveResourcesListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll( + resourceGroupName, + moveCollectionName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage( + resourceGroupName, + moveCollectionName, + options + ); + } + }; + } + + private async *listPagingPage( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveResourcesListOptionalParams + ): AsyncIterableIterator { + let result = await this._list( + resourceGroupName, + moveCollectionName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext( resourceGroupName, moveCollectionName, + continuationToken, options - }, - listOperationSpec, - callback) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveResourcesListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + moveCollectionName, + options + )) { + yield* page; + } + } + + /** + * Lists the Move Resources in the move collection. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveResourcesListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, moveCollectionName, options }, + listOperationSpec + ); } /** @@ -63,12 +134,90 @@ export class MoveResources { * @param resourceGroupName The Resource Group Name. * @param moveCollectionName The Move Collection Name. * @param moveResourceName The Move Resource Name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - create(resourceGroupName: string, moveCollectionName: string, moveResourceName: string, options?: Models.MoveResourcesCreateOptionalParams): Promise { - return this.beginCreate(resourceGroupName,moveCollectionName,moveResourceName,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginCreate( + resourceGroupName: string, + moveCollectionName: string, + moveResourceName: string, + options?: MoveResourcesCreateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + MoveResourcesCreateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, moveCollectionName, moveResourceName, options }, + createOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Creates or updates a Move Resource in the move collection. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param moveResourceName The Move Resource Name. + * @param options The options parameters. + */ + async beginCreateAndWait( + resourceGroupName: string, + moveCollectionName: string, + moveResourceName: string, + options?: MoveResourcesCreateOptionalParams + ): Promise { + const poller = await this.beginCreate( + resourceGroupName, + moveCollectionName, + moveResourceName, + options + ); + return poller.pollUntilDone(); } /** @@ -76,12 +225,90 @@ export class MoveResources { * @param resourceGroupName The Resource Group Name. * @param moveCollectionName The Move Collection Name. * @param moveResourceName The Move Resource Name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - deleteMethod(resourceGroupName: string, moveCollectionName: string, moveResourceName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginDeleteMethod(resourceGroupName,moveCollectionName,moveResourceName,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginDelete( + resourceGroupName: string, + moveCollectionName: string, + moveResourceName: string, + options?: MoveResourcesDeleteOptionalParams + ): Promise< + PollerLike< + PollOperationState, + MoveResourcesDeleteResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, moveCollectionName, moveResourceName, options }, + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Deletes a Move Resource from the move collection. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param moveResourceName The Move Resource Name. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + moveCollectionName: string, + moveResourceName: string, + options?: MoveResourcesDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + moveCollectionName, + moveResourceName, + options + ); + return poller.pollUntilDone(); } /** @@ -89,238 +316,156 @@ export class MoveResources { * @param resourceGroupName The Resource Group Name. * @param moveCollectionName The Move Collection Name. * @param moveResourceName The Move Resource Name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, moveCollectionName: string, moveResourceName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param moveResourceName The Move Resource Name. - * @param callback The callback - */ - get(resourceGroupName: string, moveCollectionName: string, moveResourceName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param moveResourceName The Move Resource Name. - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, moveCollectionName: string, moveResourceName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, moveCollectionName: string, moveResourceName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + moveCollectionName: string, + moveResourceName: string, + options?: MoveResourcesGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - moveCollectionName, - moveResourceName, - options - }, - getOperationSpec, - callback) as Promise; + { resourceGroupName, moveCollectionName, moveResourceName, options }, + getOperationSpec + ); } /** - * Creates or updates a Move Resource in the move collection. + * ListNext * @param resourceGroupName The Resource Group Name. * @param moveCollectionName The Move Collection Name. - * @param moveResourceName The Move Resource Name. - * @param [options] The optional parameters - * @returns Promise + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - beginCreate(resourceGroupName: string, moveCollectionName: string, moveResourceName: string, options?: Models.MoveResourcesBeginCreateOptionalParams): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - moveCollectionName, - moveResourceName, - options - }, - beginCreateOperationSpec, - options); - } - - /** - * Deletes a Move Resource from the move collection. - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param moveResourceName The Move Resource Name. - * @param [options] The optional parameters - * @returns Promise - */ - beginDeleteMethod(resourceGroupName: string, moveCollectionName: string, moveResourceName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - moveCollectionName, - moveResourceName, - options - }, - beginDeleteMethodOperationSpec, - options); - } - - /** - * Lists the Move Resources in the move collection. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listNext(nextPageLink: string, options?: Models.MoveResourcesListNextOptionalParams): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listNext(nextPageLink: string, options: Models.MoveResourcesListNextOptionalParams, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: Models.MoveResourcesListNextOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + resourceGroupName: string, + moveCollectionName: string, + nextLink: string, + options?: MoveResourcesListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { resourceGroupName, moveCollectionName, nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources", + responses: { + 200: { + bodyMapper: Mappers.MoveResourceCollection + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion, Parameters.filter], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.moveCollectionName ], - queryParameters: [ - Parameters.apiVersion, - Parameters.filter - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.MoveResourceCollection - }, - default: { - bodyMapper: Mappers.CloudError - } - }, + headerParameters: [Parameters.accept], serializer }; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources/{moveResourceName}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.moveCollectionName, - Parameters.moveResourceName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.MoveResource - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const beginCreateOperationSpec: msRest.OperationSpec = { +const createOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources/{moveResourceName}", httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources/{moveResourceName}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.moveCollectionName, - Parameters.moveResourceName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: { - properties: [ - "options", - "properties" - ] - }, - mapper: Mappers.MoveResource - }, responses: { 200: { bodyMapper: Mappers.MoveResource }, - 202: {}, + 201: { + bodyMapper: Mappers.MoveResource + }, + 202: { + bodyMapper: Mappers.MoveResource + }, + 204: { + bodyMapper: Mappers.MoveResource + }, default: { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const beginDeleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources/{moveResourceName}", + requestBody: Parameters.body7, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.moveCollectionName, Parameters.moveResourceName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.contentType, Parameters.accept], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources/{moveResourceName}", + httpMethod: "DELETE", responses: { 200: { bodyMapper: Mappers.OperationStatus }, - 202: {}, - 204: {}, + 201: { + bodyMapper: Mappers.OperationStatus + }, + 202: { + bodyMapper: Mappers.OperationStatus + }, + 204: { + bodyMapper: Mappers.OperationStatus + }, default: { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.moveCollectionName, + Parameters.moveResourceName + ], + headerParameters: [Parameters.accept], serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/moveResources/{moveResourceName}", httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", + responses: { + 200: { + bodyMapper: Mappers.MoveResource + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion, - Parameters.filter - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.moveCollectionName, + Parameters.moveResourceName ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.MoveResourceCollection @@ -329,5 +474,14 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion, Parameters.filter], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.moveCollectionName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/resourcemover/arm-resourcemover/src/operations/operationsDiscoveryOperations.ts b/sdk/resourcemover/arm-resourcemover/src/operations/operationsDiscoveryOperations.ts index 716c13a90b3..43c1e8b7453 100644 --- a/sdk/resourcemover/arm-resourcemover/src/operations/operationsDiscoveryOperations.ts +++ b/sdk/resourcemover/arm-resourcemover/src/operations/operationsDiscoveryOperations.ts @@ -3,63 +3,45 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/operationsDiscoveryOperationsMappers"; +import { OperationsDiscoveryOperations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { ResourceMoverServiceAPIContext } from "../resourceMoverServiceAPIContext"; +import { ResourceMoverServiceAPI } from "../resourceMoverServiceAPI"; +import { + OperationsDiscoveryGetOptionalParams, + OperationsDiscoveryGetResponse +} from "../models"; -/** Class representing a OperationsDiscoveryOperations. */ -export class OperationsDiscoveryOperations { - private readonly client: ResourceMoverServiceAPIContext; +/** Class containing OperationsDiscoveryOperations operations. */ +export class OperationsDiscoveryOperationsImpl + implements OperationsDiscoveryOperations { + private readonly client: ResourceMoverServiceAPI; /** - * Create a OperationsDiscoveryOperations. - * @param {ResourceMoverServiceAPIContext} client Reference to the service client. + * Initialize a new instance of the class OperationsDiscoveryOperations class. + * @param client Reference to the service client */ - constructor(client: ResourceMoverServiceAPIContext) { + constructor(client: ResourceMoverServiceAPI) { this.client = client; } - /** - * @param [options] The optional parameters - * @returns Promise - */ - get(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - get(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - get(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - getOperationSpec, - callback) as Promise; + /** @param options The options parameters. */ + get( + options?: OperationsDiscoveryGetOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, getOperationSpec); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.Migrate/operations", httpMethod: "GET", - path: "providers/Microsoft.Migrate/operations", - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.OperationsDiscoveryCollection @@ -68,5 +50,8 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/resourcemover/arm-resourcemover/src/operations/unresolvedDependencies.ts b/sdk/resourcemover/arm-resourcemover/src/operations/unresolvedDependencies.ts index 6742ef5e16b..594abe55e6e 100644 --- a/sdk/resourcemover/arm-resourcemover/src/operations/unresolvedDependencies.ts +++ b/sdk/resourcemover/arm-resourcemover/src/operations/unresolvedDependencies.ts @@ -3,25 +3,33 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/unresolvedDependenciesMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { UnresolvedDependencies } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { ResourceMoverServiceAPIContext } from "../resourceMoverServiceAPIContext"; +import { ResourceMoverServiceAPI } from "../resourceMoverServiceAPI"; +import { + UnresolvedDependency, + UnresolvedDependenciesGetNextOptionalParams, + UnresolvedDependenciesGetOptionalParams, + UnresolvedDependenciesGetResponse, + UnresolvedDependenciesGetNextResponse +} from "../models"; -/** Class representing a UnresolvedDependencies. */ -export class UnresolvedDependencies { - private readonly client: ResourceMoverServiceAPIContext; +/// +/** Class containing UnresolvedDependencies operations. */ +export class UnresolvedDependenciesImpl implements UnresolvedDependencies { + private readonly client: ResourceMoverServiceAPI; /** - * Create a UnresolvedDependencies. - * @param {ResourceMoverServiceAPIContext} client Reference to the service client. + * Initialize a new instance of the class UnresolvedDependencies class. + * @param client Reference to the service client */ - constructor(client: ResourceMoverServiceAPIContext) { + constructor(client: ResourceMoverServiceAPI) { this.client = client; } @@ -29,109 +37,142 @@ export class UnresolvedDependencies { * Gets a list of unresolved dependencies. * @param resourceGroupName The Resource Group Name. * @param moveCollectionName The Move Collection Name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, moveCollectionName: string, options?: Models.UnresolvedDependenciesGetOptionalParams): Promise; - /** - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param callback The callback - */ - get(resourceGroupName: string, moveCollectionName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The Resource Group Name. - * @param moveCollectionName The Move Collection Name. - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, moveCollectionName: string, options: Models.UnresolvedDependenciesGetOptionalParams, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, moveCollectionName: string, options?: Models.UnresolvedDependenciesGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { + public list( + resourceGroupName: string, + moveCollectionName: string, + options?: UnresolvedDependenciesGetOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.getPagingAll( + resourceGroupName, + moveCollectionName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.getPagingPage( + resourceGroupName, + moveCollectionName, + options + ); + } + }; + } + + private async *getPagingPage( + resourceGroupName: string, + moveCollectionName: string, + options?: UnresolvedDependenciesGetOptionalParams + ): AsyncIterableIterator { + let result = await this._get( + resourceGroupName, + moveCollectionName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._getNext( resourceGroupName, moveCollectionName, + continuationToken, options - }, - getOperationSpec, - callback) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *getPagingAll( + resourceGroupName: string, + moveCollectionName: string, + options?: UnresolvedDependenciesGetOptionalParams + ): AsyncIterableIterator { + for await (const page of this.getPagingPage( + resourceGroupName, + moveCollectionName, + options + )) { + yield* page; + } } /** * Gets a list of unresolved dependencies. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. */ - getNext(nextPageLink: string, options?: Models.UnresolvedDependenciesGetNextOptionalParams): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - getNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - getNext(nextPageLink: string, options: Models.UnresolvedDependenciesGetNextOptionalParams, callback: msRest.ServiceCallback): void; - getNext(nextPageLink: string, options?: Models.UnresolvedDependenciesGetNextOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _get( + resourceGroupName: string, + moveCollectionName: string, + options?: UnresolvedDependenciesGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - getNextOperationSpec, - callback) as Promise; + { resourceGroupName, moveCollectionName, options }, + getOperationSpec + ); + } + + /** + * GetNext + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param nextLink The nextLink from the previous successful call to the Get method. + * @param options The options parameters. + */ + private _getNext( + resourceGroupName: string, + moveCollectionName: string, + nextLink: string, + options?: UnresolvedDependenciesGetNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, moveCollectionName, nextLink, options }, + getNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/unresolvedDependencies", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Migrate/moveCollections/{moveCollectionName}/unresolvedDependencies", + responses: { + 200: { + bodyMapper: Mappers.UnresolvedDependencyCollection + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.dependencyLevel, + Parameters.orderby + ], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.moveCollectionName ], - queryParameters: [ - Parameters.dependencyLevel, - Parameters.orderby, - Parameters.apiVersion, - Parameters.filter - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.UnresolvedDependencyCollection - }, - default: { - bodyMapper: Mappers.CloudError - } - }, + headerParameters: [Parameters.accept], serializer }; - -const getNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const getNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.dependencyLevel, - Parameters.orderby, - Parameters.apiVersion, - Parameters.filter - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.UnresolvedDependencyCollection @@ -140,5 +181,19 @@ const getNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [ + Parameters.apiVersion, + Parameters.filter, + Parameters.dependencyLevel, + Parameters.orderby + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.moveCollectionName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/resourcegraph/arm-resourcegraph/src/models/operationsMappers.ts b/sdk/resourcemover/arm-resourcemover/src/operationsInterfaces/index.ts similarity index 59% rename from sdk/resourcegraph/arm-resourcegraph/src/models/operationsMappers.ts rename to sdk/resourcemover/arm-resourcemover/src/operationsInterfaces/index.ts index 654f4183efa..ef4256fdd91 100644 --- a/sdk/resourcegraph/arm-resourcegraph/src/models/operationsMappers.ts +++ b/sdk/resourcemover/arm-resourcemover/src/operationsInterfaces/index.ts @@ -6,12 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -export { - discriminators, - ErrorDetails, - ErrorModel, - ErrorResponse, - Operation, - OperationDisplay, - OperationListResult -} from "../models/mappers"; +export * from "./moveCollections"; +export * from "./moveResources"; +export * from "./unresolvedDependencies"; +export * from "./operationsDiscoveryOperations"; diff --git a/sdk/resourcemover/arm-resourcemover/src/operationsInterfaces/moveCollections.ts b/sdk/resourcemover/arm-resourcemover/src/operationsInterfaces/moveCollections.ts new file mode 100644 index 00000000000..f7f1b8e0283 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/src/operationsInterfaces/moveCollections.ts @@ -0,0 +1,321 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + MoveCollection, + MoveCollectionsListMoveCollectionsBySubscriptionOptionalParams, + MoveCollectionsListMoveCollectionsByResourceGroupOptionalParams, + MoveCollectionsCreateOptionalParams, + MoveCollectionsCreateResponse, + MoveCollectionsUpdateOptionalParams, + MoveCollectionsUpdateResponse, + MoveCollectionsDeleteOptionalParams, + MoveCollectionsDeleteResponse, + MoveCollectionsGetOptionalParams, + MoveCollectionsGetResponse, + MoveCollectionsPrepareOptionalParams, + MoveCollectionsPrepareResponse, + MoveCollectionsInitiateMoveOptionalParams, + MoveCollectionsInitiateMoveResponse, + MoveCollectionsCommitOptionalParams, + MoveCollectionsCommitResponse, + MoveCollectionsDiscardOptionalParams, + MoveCollectionsDiscardResponse, + MoveCollectionsResolveDependenciesOptionalParams, + MoveCollectionsResolveDependenciesResponse, + MoveCollectionsBulkRemoveOptionalParams, + MoveCollectionsBulkRemoveResponse, + MoveCollectionsListRequiredForOptionalParams, + MoveCollectionsListRequiredForResponse +} from "../models"; + +/// +/** Interface representing a MoveCollections. */ +export interface MoveCollections { + /** + * Get all the Move Collections in the subscription. + * @param options The options parameters. + */ + listMoveCollectionsBySubscription( + options?: MoveCollectionsListMoveCollectionsBySubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get all the Move Collections in the resource group. + * @param resourceGroupName The Resource Group Name. + * @param options The options parameters. + */ + listMoveCollectionsByResourceGroup( + resourceGroupName: string, + options?: MoveCollectionsListMoveCollectionsByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Creates or updates a move collection. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + create( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsCreateOptionalParams + ): Promise; + /** + * Updates a move collection. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsUpdateOptionalParams + ): Promise; + /** + * Deletes a move collection. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsDeleteOptionalParams + ): Promise< + PollerLike< + PollOperationState, + MoveCollectionsDeleteResponse + > + >; + /** + * Deletes a move collection. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsDeleteOptionalParams + ): Promise; + /** + * Gets the move collection. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsGetOptionalParams + ): Promise; + /** + * Initiates prepare for the set of resources included in the request body. The prepare operation is on + * the moveResources that are in the moveState 'PreparePending' or 'PrepareFailed', on a successful + * completion the moveResource moveState do a transition to MovePending. To aid the user to + * prerequisite the operation the client can call operation with validateOnly property set to true. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + beginPrepare( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsPrepareOptionalParams + ): Promise< + PollerLike< + PollOperationState, + MoveCollectionsPrepareResponse + > + >; + /** + * Initiates prepare for the set of resources included in the request body. The prepare operation is on + * the moveResources that are in the moveState 'PreparePending' or 'PrepareFailed', on a successful + * completion the moveResource moveState do a transition to MovePending. To aid the user to + * prerequisite the operation the client can call operation with validateOnly property set to true. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + beginPrepareAndWait( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsPrepareOptionalParams + ): Promise; + /** + * Moves the set of resources included in the request body. The move operation is triggered after the + * moveResources are in the moveState 'MovePending' or 'MoveFailed', on a successful completion the + * moveResource moveState do a transition to CommitPending. To aid the user to prerequisite the + * operation the client can call operation with validateOnly property set to true. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + beginInitiateMove( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsInitiateMoveOptionalParams + ): Promise< + PollerLike< + PollOperationState, + MoveCollectionsInitiateMoveResponse + > + >; + /** + * Moves the set of resources included in the request body. The move operation is triggered after the + * moveResources are in the moveState 'MovePending' or 'MoveFailed', on a successful completion the + * moveResource moveState do a transition to CommitPending. To aid the user to prerequisite the + * operation the client can call operation with validateOnly property set to true. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + beginInitiateMoveAndWait( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsInitiateMoveOptionalParams + ): Promise; + /** + * Commits the set of resources included in the request body. The commit operation is triggered on the + * moveResources in the moveState 'CommitPending' or 'CommitFailed', on a successful completion the + * moveResource moveState do a transition to Committed. To aid the user to prerequisite the operation + * the client can call operation with validateOnly property set to true. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + beginCommit( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsCommitOptionalParams + ): Promise< + PollerLike< + PollOperationState, + MoveCollectionsCommitResponse + > + >; + /** + * Commits the set of resources included in the request body. The commit operation is triggered on the + * moveResources in the moveState 'CommitPending' or 'CommitFailed', on a successful completion the + * moveResource moveState do a transition to Committed. To aid the user to prerequisite the operation + * the client can call operation with validateOnly property set to true. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + beginCommitAndWait( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsCommitOptionalParams + ): Promise; + /** + * Discards the set of resources included in the request body. The discard operation is triggered on + * the moveResources in the moveState 'CommitPending' or 'DiscardFailed', on a successful completion + * the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the + * operation the client can call operation with validateOnly property set to true. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + beginDiscard( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsDiscardOptionalParams + ): Promise< + PollerLike< + PollOperationState, + MoveCollectionsDiscardResponse + > + >; + /** + * Discards the set of resources included in the request body. The discard operation is triggered on + * the moveResources in the moveState 'CommitPending' or 'DiscardFailed', on a successful completion + * the moveResource moveState do a transition to MovePending. To aid the user to prerequisite the + * operation the client can call operation with validateOnly property set to true. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + beginDiscardAndWait( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsDiscardOptionalParams + ): Promise; + /** + * Computes, resolves and validate the dependencies of the moveResources in the move collection. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + beginResolveDependencies( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsResolveDependenciesOptionalParams + ): Promise< + PollerLike< + PollOperationState, + MoveCollectionsResolveDependenciesResponse + > + >; + /** + * Computes, resolves and validate the dependencies of the moveResources in the move collection. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + beginResolveDependenciesAndWait( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsResolveDependenciesOptionalParams + ): Promise; + /** + * Removes the set of move resources included in the request body from move collection. The + * orchestration is done by service. To aid the user to prerequisite the operation the client can call + * operation with validateOnly property set to true. + * @param resourceGroupName + * @param moveCollectionName + * @param options The options parameters. + */ + beginBulkRemove( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsBulkRemoveOptionalParams + ): Promise< + PollerLike< + PollOperationState, + MoveCollectionsBulkRemoveResponse + > + >; + /** + * Removes the set of move resources included in the request body from move collection. The + * orchestration is done by service. To aid the user to prerequisite the operation the client can call + * operation with validateOnly property set to true. + * @param resourceGroupName + * @param moveCollectionName + * @param options The options parameters. + */ + beginBulkRemoveAndWait( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveCollectionsBulkRemoveOptionalParams + ): Promise; + /** + * List of the move resources for which an arm resource is required for. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param sourceId The sourceId for which the api is invoked. + * @param options The options parameters. + */ + listRequiredFor( + resourceGroupName: string, + moveCollectionName: string, + sourceId: string, + options?: MoveCollectionsListRequiredForOptionalParams + ): Promise; +} diff --git a/sdk/resourcemover/arm-resourcemover/src/operationsInterfaces/moveResources.ts b/sdk/resourcemover/arm-resourcemover/src/operationsInterfaces/moveResources.ts new file mode 100644 index 00000000000..d6f47f9e823 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/src/operationsInterfaces/moveResources.ts @@ -0,0 +1,111 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + MoveResource, + MoveResourcesListOptionalParams, + MoveResourcesCreateOptionalParams, + MoveResourcesCreateResponse, + MoveResourcesDeleteOptionalParams, + MoveResourcesDeleteResponse, + MoveResourcesGetOptionalParams, + MoveResourcesGetResponse +} from "../models"; + +/// +/** Interface representing a MoveResources. */ +export interface MoveResources { + /** + * Lists the Move Resources in the move collection. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + moveCollectionName: string, + options?: MoveResourcesListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Creates or updates a Move Resource in the move collection. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param moveResourceName The Move Resource Name. + * @param options The options parameters. + */ + beginCreate( + resourceGroupName: string, + moveCollectionName: string, + moveResourceName: string, + options?: MoveResourcesCreateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + MoveResourcesCreateResponse + > + >; + /** + * Creates or updates a Move Resource in the move collection. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param moveResourceName The Move Resource Name. + * @param options The options parameters. + */ + beginCreateAndWait( + resourceGroupName: string, + moveCollectionName: string, + moveResourceName: string, + options?: MoveResourcesCreateOptionalParams + ): Promise; + /** + * Deletes a Move Resource from the move collection. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param moveResourceName The Move Resource Name. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + moveCollectionName: string, + moveResourceName: string, + options?: MoveResourcesDeleteOptionalParams + ): Promise< + PollerLike< + PollOperationState, + MoveResourcesDeleteResponse + > + >; + /** + * Deletes a Move Resource from the move collection. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param moveResourceName The Move Resource Name. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + moveCollectionName: string, + moveResourceName: string, + options?: MoveResourcesDeleteOptionalParams + ): Promise; + /** + * Gets the Move Resource. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param moveResourceName The Move Resource Name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + moveCollectionName: string, + moveResourceName: string, + options?: MoveResourcesGetOptionalParams + ): Promise; +} diff --git a/sdk/resourcemover/arm-resourcemover/src/operationsInterfaces/operationsDiscoveryOperations.ts b/sdk/resourcemover/arm-resourcemover/src/operationsInterfaces/operationsDiscoveryOperations.ts new file mode 100644 index 00000000000..fc2937ed2e2 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/src/operationsInterfaces/operationsDiscoveryOperations.ts @@ -0,0 +1,20 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + OperationsDiscoveryGetOptionalParams, + OperationsDiscoveryGetResponse +} from "../models"; + +/** Interface representing a OperationsDiscoveryOperations. */ +export interface OperationsDiscoveryOperations { + /** @param options The options parameters. */ + get( + options?: OperationsDiscoveryGetOptionalParams + ): Promise; +} diff --git a/sdk/resourcemover/arm-resourcemover/src/operationsInterfaces/unresolvedDependencies.ts b/sdk/resourcemover/arm-resourcemover/src/operationsInterfaces/unresolvedDependencies.ts new file mode 100644 index 00000000000..6a0bd212c5b --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/src/operationsInterfaces/unresolvedDependencies.ts @@ -0,0 +1,29 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + UnresolvedDependency, + UnresolvedDependenciesGetOptionalParams +} from "../models"; + +/// +/** Interface representing a UnresolvedDependencies. */ +export interface UnresolvedDependencies { + /** + * Gets a list of unresolved dependencies. + * @param resourceGroupName The Resource Group Name. + * @param moveCollectionName The Move Collection Name. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + moveCollectionName: string, + options?: UnresolvedDependenciesGetOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/resourcemover/arm-resourcemover/src/resourceMoverServiceAPI.ts b/sdk/resourcemover/arm-resourcemover/src/resourceMoverServiceAPI.ts index 4733943ad50..c916621eaa2 100644 --- a/sdk/resourcemover/arm-resourcemover/src/resourceMoverServiceAPI.ts +++ b/sdk/resourcemover/arm-resourcemover/src/resourceMoverServiceAPI.ts @@ -3,45 +3,91 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "./models"; -import * as Mappers from "./models/mappers"; -import * as operations from "./operations"; -import { ResourceMoverServiceAPIContext } from "./resourceMoverServiceAPIContext"; +import * as coreClient from "@azure/core-client"; +import * as coreAuth from "@azure/core-auth"; +import { + MoveCollectionsImpl, + MoveResourcesImpl, + UnresolvedDependenciesImpl, + OperationsDiscoveryOperationsImpl +} from "./operations"; +import { + MoveCollections, + MoveResources, + UnresolvedDependencies, + OperationsDiscoveryOperations +} from "./operationsInterfaces"; +import { ResourceMoverServiceAPIOptionalParams } from "./models"; - -class ResourceMoverServiceAPI extends ResourceMoverServiceAPIContext { - // Operation groups - moveCollections: operations.MoveCollections; - moveResources: operations.MoveResources; - unresolvedDependencies: operations.UnresolvedDependencies; - operationsDiscovery: operations.OperationsDiscoveryOperations; +export class ResourceMoverServiceAPI extends coreClient.ServiceClient { + $host: string; + subscriptionId: string; + apiVersion: string; /** * Initializes a new instance of the ResourceMoverServiceAPI class. - * @param credentials Credentials needed for the client to connect to Azure. + * @param credentials Subscription credentials which uniquely identify client subscription. * @param subscriptionId The Subscription ID. - * @param [options] The parameter options + * @param options The parameter options */ - constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.ResourceMoverServiceAPIOptions) { - super(credentials, subscriptionId, options); - this.moveCollections = new operations.MoveCollections(this); - this.moveResources = new operations.MoveResources(this); - this.unresolvedDependencies = new operations.UnresolvedDependencies(this); - this.operationsDiscovery = new operations.OperationsDiscoveryOperations(this); + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: ResourceMoverServiceAPIOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (subscriptionId === undefined) { + throw new Error("'subscriptionId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: ResourceMoverServiceAPIOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-resourcemover/2.0.0`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + if (!options.credentialScopes) { + options.credentialScopes = ["https://management.azure.com/.default"]; + } + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: options.endpoint || "https://management.azure.com" + }; + super(optionsWithDefaults); + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2021-08-01"; + this.moveCollections = new MoveCollectionsImpl(this); + this.moveResources = new MoveResourcesImpl(this); + this.unresolvedDependencies = new UnresolvedDependenciesImpl(this); + this.operationsDiscoveryOperations = new OperationsDiscoveryOperationsImpl( + this + ); } + + moveCollections: MoveCollections; + moveResources: MoveResources; + unresolvedDependencies: UnresolvedDependencies; + operationsDiscoveryOperations: OperationsDiscoveryOperations; } - -// Operation Specifications - -export { - ResourceMoverServiceAPI, - ResourceMoverServiceAPIContext, - Models as ResourceMoverServiceAPIModels, - Mappers as ResourceMoverServiceAPIMappers -}; -export * from "./operations"; diff --git a/sdk/resourcemover/arm-resourcemover/src/resourceMoverServiceAPIContext.ts b/sdk/resourcemover/arm-resourcemover/src/resourceMoverServiceAPIContext.ts deleted file mode 100644 index 8243af0fc77..00000000000 --- a/sdk/resourcemover/arm-resourcemover/src/resourceMoverServiceAPIContext.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import * as Models from "./models"; -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; - -const packageName = "@azure/arm-resourcemover"; -const packageVersion = "1.0.0"; - -export class ResourceMoverServiceAPIContext extends msRestAzure.AzureServiceClient { - credentials: msRest.ServiceClientCredentials; - subscriptionId: string; - apiVersion?: string; - - /** - * Initializes a new instance of the ResourceMoverServiceAPI class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param subscriptionId The Subscription ID. - * @param [options] The parameter options - */ - constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.ResourceMoverServiceAPIOptions) { - if (credentials == undefined) { - throw new Error('\'credentials\' cannot be null.'); - } - if (subscriptionId == undefined) { - throw new Error('\'subscriptionId\' cannot be null.'); - } - - if (!options) { - options = {}; - } - if(!options.userAgent) { - const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); - options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; - } - - super(credentials, options); - - this.apiVersion = '2021-01-01'; - this.acceptLanguage = 'en-US'; - this.longRunningOperationRetryTimeout = 30; - this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; - this.requestContentType = "application/json; charset=utf-8"; - this.credentials = credentials; - this.subscriptionId = subscriptionId; - - if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { - this.acceptLanguage = options.acceptLanguage; - } - if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { - this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; - } - } -} diff --git a/sdk/resourcemover/arm-resourcemover/test/sampleTest.ts b/sdk/resourcemover/arm-resourcemover/test/sampleTest.ts new file mode 100644 index 00000000000..7ed89b043e1 --- /dev/null +++ b/sdk/resourcemover/arm-resourcemover/test/sampleTest.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + env, + record, + RecorderEnvironmentSetup, + Recorder +} from "@azure-tools/test-recorder"; +import * as assert from "assert"; + +const recorderEnvSetup: RecorderEnvironmentSetup = { + replaceableVariables: { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" + }, + customizationsOnRecordings: [ + (recording: any): any => + recording.replace( + /"access_token":"[^"]*"/g, + `"access_token":"access_token"` + ) + ], + queryParametersToSkip: [] +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function() { + recorder = record(this, recorderEnvSetup); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/resourcemover/arm-resourcemover/tsconfig.json b/sdk/resourcemover/arm-resourcemover/tsconfig.json index 422b584abd5..51b7ff318a8 100644 --- a/sdk/resourcemover/arm-resourcemover/tsconfig.json +++ b/sdk/resourcemover/arm-resourcemover/tsconfig.json @@ -3,7 +3,7 @@ "module": "es6", "moduleResolution": "node", "strict": true, - "target": "es5", + "target": "es6", "sourceMap": true, "declarationMap": true, "esModuleInterop": true, @@ -11,9 +11,10 @@ "forceConsistentCasingInFileNames": true, "lib": ["es6", "dom"], "declaration": true, - "outDir": "./esm", - "importHelpers": true + "outDir": "./dist-esm", + "importHelpers": true, + "paths": { "@azure/arm-resourcemover": ["./src/index"] } }, - "include": ["./src/**/*.ts"], + "include": ["./src/**/*.ts", "./test/**/*.ts", "samples-dev/**/*.ts"], "exclude": ["node_modules"] } diff --git a/sdk/resourcemover/ci.yml b/sdk/resourcemover/ci.yml new file mode 100644 index 00000000000..465080cd6ce --- /dev/null +++ b/sdk/resourcemover/ci.yml @@ -0,0 +1,30 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/resourcemover/ + +pr: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/resourcemover/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: resourcemover + Artifacts: + - name: azure-arm-resourcemover + safeName: azurearmresourcemover + \ No newline at end of file diff --git a/sdk/serialconsole/arm-serialconsole/CHANGELOG.md b/sdk/serialconsole/arm-serialconsole/CHANGELOG.md new file mode 100644 index 00000000000..34e0757f687 --- /dev/null +++ b/sdk/serialconsole/arm-serialconsole/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 2.0.0 (2022-01-21) + +The package of @azure/arm-serialconsole is using our next generation design principles since version 2.0.0, which contains breaking changes. + +To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog). + +To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/serialconsole/arm-serialconsole/LICENSE b/sdk/serialconsole/arm-serialconsole/LICENSE new file mode 100644 index 00000000000..5d1d36e0af8 --- /dev/null +++ b/sdk/serialconsole/arm-serialconsole/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/serialconsole/arm-serialconsole/README.md b/sdk/serialconsole/arm-serialconsole/README.md index d340a645673..7149c268f5d 100644 --- a/sdk/serialconsole/arm-serialconsole/README.md +++ b/sdk/serialconsole/arm-serialconsole/README.md @@ -1,99 +1,98 @@ -## Azure MicrosoftSerialConsoleClient SDK for JavaScript +# Azure MicrosoftSerialConsole client library for JavaScript -This package contains an isomorphic SDK for MicrosoftSerialConsoleClient. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure MicrosoftSerialConsole client. + +The Azure Serial Console allows you to access the serial console of a Virtual Machine or VM scale set instance + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/serialconsole/arm-serialconsole) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-serialconsole) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-serialconsole) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started ### Currently supported environments - [LTS versions of Node.js](https://nodejs.org/about/releases/) -- Latest versions of Safari, Chrome, Edge, and Firefox. +- Latest versions of Safari, Chrome, Edge and Firefox. -### How to Install +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-serialconsole` package + +Install the Azure MicrosoftSerialConsole client library for JavaScript with `npm`: ```bash npm install @azure/arm-serialconsole ``` -### How to use +### Create and authenticate a `MicrosoftSerialConsoleClient` -#### nodejs - Authentication, client creation and operations list as an example written in TypeScript. +To create a client object to access the Azure MicrosoftSerialConsole API, you will need the `endpoint` of your Azure MicrosoftSerialConsole resource and a `credential`. The Azure MicrosoftSerialConsole client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure MicrosoftSerialConsole resource in the [Azure Portal][azure_portal]. -##### Install @azure/ms-rest-nodeauth +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/ms-rest-nodeauth +npm install @azure/identity ``` -##### Sample code +You will also need to **register a new AAD application and grant access to Azure MicrosoftSerialConsole** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. -```typescript -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; -import { MicrosoftSerialConsoleClient, MicrosoftSerialConsoleModels, MicrosoftSerialConsoleMappers } from "@azure/arm-serialconsole"; -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). -msRestNodeAuth.interactiveLogin().then((creds) => { - const client = new MicrosoftSerialConsoleClient(creds, subscriptionId); - client.list.operations().then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.error(err); -}); +```javascript +const { MicrosoftSerialConsoleClient } = require("@azure/arm-serialconsole"); +const { DefaultAzureCredential } = require("@azure/identity"); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new MicrosoftSerialConsoleClient(new DefaultAzureCredential(), subscriptionId); ``` -#### browser - Authentication, client creation and operations list as an example written in JavaScript. -##### Install @azure/ms-rest-browserauth +### 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). -```bash -npm install @azure/ms-rest-browserauth +## Key concepts + +### MicrosoftSerialConsoleClient + +`MicrosoftSerialConsoleClient` is the primary interface for developers using the Azure MicrosoftSerialConsole client library. Explore the methods on this client object to understand the different features of the Azure MicrosoftSerialConsole 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"); ``` -##### Sample code +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). -See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. +## Next steps -- index.html -```html - - - - @azure/arm-serialconsole sample - - - - - - - - -``` +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. ## Related projects -- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) - +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fserialconsole%2Farm-serialconsole%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/serialconsole/arm-serialconsole/_meta.json b/sdk/serialconsole/arm-serialconsole/_meta.json new file mode 100644 index 00000000000..6795fa4f87a --- /dev/null +++ b/sdk/serialconsole/arm-serialconsole/_meta.json @@ -0,0 +1,7 @@ +{ + "commit": "f9a6cb686bcc0f1b23761db19f2491c5c4df95cb", + "readme": "specification/serialconsole/resource-manager/readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/serialconsole/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20220114.1", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "use": "@autorest/typescript@6.0.0-alpha.16.20220114.1" +} \ No newline at end of file diff --git a/sdk/serialconsole/arm-serialconsole/api-extractor.json b/sdk/serialconsole/arm-serialconsole/api-extractor.json new file mode 100644 index 00000000000..88404412053 --- /dev/null +++ b/sdk/serialconsole/arm-serialconsole/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-serialconsole.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/serialconsole/arm-serialconsole/package.json b/sdk/serialconsole/arm-serialconsole/package.json index f2093c23c83..116272a7b92 100644 --- a/sdk/serialconsole/arm-serialconsole/package.json +++ b/sdk/serialconsole/arm-serialconsole/package.json @@ -1,58 +1,97 @@ { "name": "@azure/arm-serialconsole", + "sdk-type": "mgmt", "author": "Microsoft Corporation", - "description": "MicrosoftSerialConsoleClient Library with typescript type definitions for node.js and browser.", - "version": "1.0.0", + "description": "A generated SDK for MicrosoftSerialConsoleClient.", + "version": "2.0.0", + "engines": { "node": ">=12.0.0" }, "dependencies": { - "@azure/ms-rest-azure-js": "^1.3.2", - "@azure/ms-rest-js": "^1.8.1", - "tslib": "^1.9.3" + "@azure/core-client": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.1.0", + "tslib": "^2.2.0" }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], + "keywords": ["node", "azure", "typescript", "browser", "isomorphic"], "license": "MIT", - "main": "./dist/arm-serialconsole.js", - "module": "./esm/microsoftSerialConsoleClient.js", - "types": "./esm/microsoftSerialConsoleClient.d.ts", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-serialconsole.d.ts", "devDependencies": { - "typescript": "^3.1.1", - "rollup": "^0.66.2", - "rollup-plugin-node-resolve": "^3.4.0", + "@microsoft/api-extractor": "^7.18.11", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "mkdirp": "^1.0.4", + "rollup": "^1.16.3", "rollup-plugin-sourcemaps": "^0.4.2", - "uglify-js": "^3.4.9" + "typescript": "~4.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^1.0.0", + "mocha": "^7.1.1", + "cross-env": "^7.0.2" }, - "homepage": "https://github.com/azure/azure-sdk-for-js", + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/serialconsole/arm-serialconsole", "repository": { "type": "git", - "url": "https://github.com/azure/azure-sdk-for-js.git" - }, - "bugs": { - "url": "https://github.com/azure/azure-sdk-for-js/issues" + "url": "https://github.com/Azure/azure-sdk-for-js.git" }, + "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, "files": [ "dist/**/*.js", "dist/**/*.js.map", "dist/**/*.d.ts", "dist/**/*.d.ts.map", - "esm/**/*.js", - "esm/**/*.js.map", - "esm/**/*.d.ts", - "esm/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", "src/**/*.ts", "README.md", + "LICENSE", "rollup.config.js", - "tsconfig.json" + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" ], "scripts": { - "build": "tsc && rollup -c rollup.config.js && npm run minify", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-serialconsole.js.map'\" -o ./dist/arm-serialconsole.min.js ./dist/arm-serialconsole.js", - "prepack": "npm install && npm run build" + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" }, "sideEffects": false, + "//metadata": { + "constantPaths": [ + { + "path": "src/MicrosoftSerialConsoleClient.ts", + "prefix": "packageDetails" + } + ] + }, "autoPublish": true } diff --git a/sdk/serialconsole/arm-serialconsole/recordings/node/my_test/recording_sample_test.js b/sdk/serialconsole/arm-serialconsole/recordings/node/my_test/recording_sample_test.js new file mode 100644 index 00000000000..0f6ecb857ac --- /dev/null +++ b/sdk/serialconsole/arm-serialconsole/recordings/node/my_test/recording_sample_test.js @@ -0,0 +1,5 @@ +let nock = require('nock'); + +module.exports.hash = "7a6be38bb8cb644d64b4094802301751"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} diff --git a/sdk/serialconsole/arm-serialconsole/review/arm-serialconsole.api.md b/sdk/serialconsole/arm-serialconsole/review/arm-serialconsole.api.md new file mode 100644 index 00000000000..50b78116266 --- /dev/null +++ b/sdk/serialconsole/arm-serialconsole/review/arm-serialconsole.api.md @@ -0,0 +1,202 @@ +## API Report File for "@azure/arm-serialconsole" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; + +// @public +export interface CloudError { + error?: CloudErrorBody; +} + +// @public +export interface CloudErrorBody { + code?: string; + details?: CloudErrorBody[]; + message?: string; + target?: string; +} + +// @public +export interface DisableConsoleOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type DisableConsoleResponse = DisableSerialConsoleResult; + +// @public +export interface DisableSerialConsoleResult { + disabled?: boolean; +} + +// @public +export interface EnableConsoleOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type EnableConsoleResponse = EnableSerialConsoleResult; + +// @public +export interface EnableSerialConsoleResult { + disabled?: boolean; +} + +// @public +export interface GetConsoleStatusOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type GetConsoleStatusResponse = SerialConsoleStatus; + +// @public +export interface GetSerialConsoleSubscriptionNotFound { + code?: string; + message?: string; +} + +// @public +export interface ListOperationsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ListOperationsResponse = SerialConsoleOperations; + +// @public (undocumented) +export class MicrosoftSerialConsoleClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: MicrosoftSerialConsoleClientOptionalParams); + // (undocumented) + apiVersion: string; + disableConsole(defaultParam: string, options?: DisableConsoleOptionalParams): Promise; + enableConsole(defaultParam: string, options?: EnableConsoleOptionalParams): Promise; + getConsoleStatus(defaultParam: string, options?: GetConsoleStatusOptionalParams): Promise; + listOperations(options?: ListOperationsOptionalParams): Promise; + // (undocumented) + serialPorts: SerialPorts; + // (undocumented) + subscriptionId: string; +} + +// @public +export interface MicrosoftSerialConsoleClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export type ProxyResource = Resource & {}; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +// @public +export interface SerialConsoleOperations { + value?: SerialConsoleOperationsValueItem[]; +} + +// @public (undocumented) +export interface SerialConsoleOperationsValueItem { + // (undocumented) + display?: SerialConsoleOperationsValueItemDisplay; + // (undocumented) + isDataAction?: string; + // (undocumented) + name?: string; +} + +// @public (undocumented) +export interface SerialConsoleOperationsValueItemDisplay { + // (undocumented) + description?: string; + // (undocumented) + operation?: string; + // (undocumented) + provider?: string; + // (undocumented) + resource?: string; +} + +// @public +export interface SerialConsoleStatus { + disabled?: boolean; +} + +// @public +export type SerialPort = ProxyResource & { + state?: SerialPortState; +}; + +// @public +export interface SerialPortConnectResult { + connectionString?: string; +} + +// @public +export interface SerialPortListResult { + value?: SerialPort[]; +} + +// @public +export interface SerialPorts { + connect(resourceGroupName: string, resourceProviderNamespace: string, parentResourceType: string, parentResource: string, serialPort: string, options?: SerialPortsConnectOptionalParams): Promise; + create(resourceGroupName: string, resourceProviderNamespace: string, parentResourceType: string, parentResource: string, serialPort: string, parameters: SerialPort, options?: SerialPortsCreateOptionalParams): Promise; + delete(resourceGroupName: string, resourceProviderNamespace: string, parentResourceType: string, parentResource: string, serialPort: string, options?: SerialPortsDeleteOptionalParams): Promise; + get(resourceGroupName: string, resourceProviderNamespace: string, parentResourceType: string, parentResource: string, serialPort: string, options?: SerialPortsGetOptionalParams): Promise; + list(resourceGroupName: string, resourceProviderNamespace: string, parentResourceType: string, parentResource: string, options?: SerialPortsListOptionalParams): Promise; + listBySubscriptions(options?: SerialPortsListBySubscriptionsOptionalParams): Promise; +} + +// @public +export interface SerialPortsConnectOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SerialPortsConnectResponse = SerialPortConnectResult; + +// @public +export interface SerialPortsCreateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SerialPortsCreateResponse = SerialPort; + +// @public +export interface SerialPortsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface SerialPortsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SerialPortsGetResponse = SerialPort; + +// @public +export interface SerialPortsListBySubscriptionsOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SerialPortsListBySubscriptionsResponse = SerialPortListResult; + +// @public +export interface SerialPortsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SerialPortsListResponse = SerialPortListResult; + +// @public +export type SerialPortState = "enabled" | "disabled"; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/serialconsole/arm-serialconsole/rollup.config.js b/sdk/serialconsole/arm-serialconsole/rollup.config.js index b09f9ebf49d..9be1955eb7f 100644 --- a/sdk/serialconsole/arm-serialconsole/rollup.config.js +++ b/sdk/serialconsole/arm-serialconsole/rollup.config.js @@ -1,37 +1,188 @@ -import rollup from "rollup"; -import nodeResolve from "rollup-plugin-node-resolve"; -import sourcemaps from "rollup-plugin-sourcemaps"; - -/** - * @type {rollup.RollupFileOptions} - */ -const config = { - input: "./esm/microsoftSerialConsoleClient.js", - external: [ - "@azure/ms-rest-js", - "@azure/ms-rest-azure-js" - ], - output: { - file: "./dist/arm-serialconsole.js", - format: "umd", - name: "Azure.ArmSerialconsole", - sourcemap: true, - globals: { - "@azure/ms-rest-js": "msRest", - "@azure/ms-rest-azure-js": "msRestAzure" - }, - banner: `/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */` - }, - plugins: [ - nodeResolve({ module: true }), - sourcemaps() - ] + */ + +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"; + +/** + * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. + * + * NOTE: this manual configuration is only needed because OpenTelemetry uses an + * __exportStar downleveled helper function to declare its exports which confuses + * rollup's automatic discovery mechanism. + * + * @returns an object reference that can be `...`'d into your cjs() configuration. + */ +export function openTelemetryCommonJs() { + const namedExports = {}; + + for (const key of [ + "@opentelemetry/api", + "@azure/core-tracing/node_modules/@opentelemetry/api" + ]) { + namedExports[key] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "SpanStatusCode", + "getSpanContext", + "setSpanContext" + ]; + } + + const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; + + for (const version of releasedOpenTelemetryVersions) { + namedExports[ + // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. + `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` + ] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "StatusCode", + "CanonicalCode", + "getSpanContext", + "setSpanContext" + ]; + } + + return namedExports; +} + +// #region Warning Handler + +/** + * A function that can determine whether a rollupwarning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEvalWarnings(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependencyWarnings(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ + ignoreChaiCircularDependencyWarnings, + ignoreNiseSinonEvalWarnings +]; + +/** + * 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({ + namedExports: { + // Chai's strange internal architecture makes it impossible to statically + // analyze its exports. + chai: [ + "version", + "use", + "util", + "config", + "expect", + "should", + "assert" + ], + ...openTelemetryCommonJs() + } + }), + 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 default config; +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(), cjs()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/resourcemover/arm-resourcemover/src/models/operationsDiscoveryOperationsMappers.ts b/sdk/serialconsole/arm-serialconsole/src/index.ts similarity index 61% rename from sdk/resourcemover/arm-resourcemover/src/models/operationsDiscoveryOperationsMappers.ts rename to sdk/serialconsole/arm-serialconsole/src/index.ts index c87b0d47feb..17a826646cb 100644 --- a/sdk/resourcemover/arm-resourcemover/src/models/operationsDiscoveryOperationsMappers.ts +++ b/sdk/serialconsole/arm-serialconsole/src/index.ts @@ -6,10 +6,6 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -export { - discriminators, - CloudError, - Display, - OperationsDiscovery, - OperationsDiscoveryCollection -} from "../models/mappers"; +export * from "./models"; +export { MicrosoftSerialConsoleClient } from "./microsoftSerialConsoleClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/serialconsole/arm-serialconsole/src/microsoftSerialConsoleClient.ts b/sdk/serialconsole/arm-serialconsole/src/microsoftSerialConsoleClient.ts index ba521794b23..86bbb1be417 100644 --- a/sdk/serialconsole/arm-serialconsole/src/microsoftSerialConsoleClient.ts +++ b/sdk/serialconsole/arm-serialconsole/src/microsoftSerialConsoleClient.ts @@ -1,46 +1,222 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "./models"; +import * as coreClient from "@azure/core-client"; +import * as coreAuth from "@azure/core-auth"; +import { SerialPortsImpl } from "./operations"; +import { SerialPorts } from "./operationsInterfaces"; +import * as Parameters from "./models/parameters"; import * as Mappers from "./models/mappers"; -import * as operations from "./operations"; -import { MicrosoftSerialConsoleClientContext } from "./microsoftSerialConsoleClientContext"; +import { + MicrosoftSerialConsoleClientOptionalParams, + ListOperationsOptionalParams, + ListOperationsResponse, + GetConsoleStatusOptionalParams, + GetConsoleStatusResponse, + DisableConsoleOptionalParams, + DisableConsoleResponse, + EnableConsoleOptionalParams, + EnableConsoleResponse +} from "./models"; - -class MicrosoftSerialConsoleClient extends MicrosoftSerialConsoleClientContext { - // Operation groups - list: operations.List; - listConsole: operations.ListConsole; - console: operations.Console; +export class MicrosoftSerialConsoleClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; /** * Initializes a new instance of the MicrosoftSerialConsoleClient class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param subscriptionId The ID of the target subscription. - * @param [options] The parameter options + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId Subscription ID which uniquely identifies the Microsoft Azure subscription. + * The subscription ID forms part of the URI for every service call requiring it. + * @param options The parameter options */ - constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.MicrosoftSerialConsoleClientOptions) { - super(credentials, subscriptionId, options); - this.list = new operations.List(this); - this.listConsole = new operations.ListConsole(this); - this.console = new operations.Console(this); + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: MicrosoftSerialConsoleClientOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (subscriptionId === undefined) { + throw new Error("'subscriptionId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: MicrosoftSerialConsoleClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-serialconsole/2.0.0`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + if (!options.credentialScopes) { + options.credentialScopes = ["https://management.azure.com/.default"]; + } + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: options.endpoint || "https://management.azure.com" + }; + super(optionsWithDefaults); + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2018-05-01"; + this.serialPorts = new SerialPortsImpl(this); } + + /** + * Gets a list of Serial Console API operations. + * @param options The options parameters. + */ + listOperations( + options?: ListOperationsOptionalParams + ): Promise { + return this.sendOperationRequest({ options }, listOperationsOperationSpec); + } + + /** + * Gets whether or not Serial Console is disabled for a given subscription + * @param defaultParam Default parameter. Leave the value as "default". + * @param options The options parameters. + */ + getConsoleStatus( + defaultParam: string, + options?: GetConsoleStatusOptionalParams + ): Promise { + return this.sendOperationRequest( + { defaultParam, options }, + getConsoleStatusOperationSpec + ); + } + + /** + * Disables the Serial Console service for all VMs and VM scale sets in the provided subscription + * @param defaultParam Default parameter. Leave the value as "default". + * @param options The options parameters. + */ + disableConsole( + defaultParam: string, + options?: DisableConsoleOptionalParams + ): Promise { + return this.sendOperationRequest( + { defaultParam, options }, + disableConsoleOperationSpec + ); + } + + /** + * Enables the Serial Console service for all VMs and VM scale sets in the provided subscription + * @param defaultParam Default parameter. Leave the value as "default". + * @param options The options parameters. + */ + enableConsole( + defaultParam: string, + options?: EnableConsoleOptionalParams + ): Promise { + return this.sendOperationRequest( + { defaultParam, options }, + enableConsoleOperationSpec + ); + } + + serialPorts: SerialPorts; } - // Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); -export { - MicrosoftSerialConsoleClient, - MicrosoftSerialConsoleClientContext, - Models as MicrosoftSerialConsoleModels, - Mappers as MicrosoftSerialConsoleMappers +const listOperationsOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.SerialConsole/operations", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SerialConsoleOperations + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const getConsoleStatusOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/consoleServices/{default}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SerialConsoleStatus + }, + 404: { + bodyMapper: Mappers.GetSerialConsoleSubscriptionNotFound + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.defaultParam + ], + headerParameters: [Parameters.accept], + serializer +}; +const disableConsoleOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/consoleServices/{default}/disableConsole", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.DisableSerialConsoleResult + }, + 404: { + bodyMapper: Mappers.GetSerialConsoleSubscriptionNotFound + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.defaultParam + ], + headerParameters: [Parameters.accept], + serializer +}; +const enableConsoleOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/consoleServices/{default}/enableConsole", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.EnableSerialConsoleResult + }, + 404: { + bodyMapper: Mappers.GetSerialConsoleSubscriptionNotFound + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.defaultParam + ], + headerParameters: [Parameters.accept], + serializer }; -export * from "./operations"; diff --git a/sdk/serialconsole/arm-serialconsole/src/microsoftSerialConsoleClientContext.ts b/sdk/serialconsole/arm-serialconsole/src/microsoftSerialConsoleClientContext.ts deleted file mode 100644 index 1478ee9b10b..00000000000 --- a/sdk/serialconsole/arm-serialconsole/src/microsoftSerialConsoleClientContext.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import * as Models from "./models"; -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; - -const packageName = "@azure/arm-serialconsole"; -const packageVersion = "1.0.0"; - -export class MicrosoftSerialConsoleClientContext extends msRestAzure.AzureServiceClient { - credentials: msRest.ServiceClientCredentials; - subscriptionId: string; - apiVersion?: string; - - /** - * Initializes a new instance of the MicrosoftSerialConsoleClient class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param subscriptionId The ID of the target subscription. - * @param [options] The parameter options - */ - constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.MicrosoftSerialConsoleClientOptions) { - if (credentials == undefined) { - throw new Error('\'credentials\' cannot be null.'); - } - if (subscriptionId == undefined) { - throw new Error('\'subscriptionId\' cannot be null.'); - } - - if (!options) { - options = {}; - } - if(!options.userAgent) { - const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); - options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; - } - - super(credentials, options); - - this.apiVersion = '2018-05-01'; - this.acceptLanguage = 'en-US'; - this.longRunningOperationRetryTimeout = 30; - this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; - this.requestContentType = "application/json; charset=utf-8"; - this.credentials = credentials; - this.subscriptionId = subscriptionId; - - if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { - this.acceptLanguage = options.acceptLanguage; - } - if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { - this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; - } - } -} diff --git a/sdk/serialconsole/arm-serialconsole/src/models/consoleMappers.ts b/sdk/serialconsole/arm-serialconsole/src/models/consoleMappers.ts deleted file mode 100644 index 5fe4edc4587..00000000000 --- a/sdk/serialconsole/arm-serialconsole/src/models/consoleMappers.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - DeploymentValidateResult, - SetDisabledResult -} from "../models/mappers"; diff --git a/sdk/serialconsole/arm-serialconsole/src/models/index.ts b/sdk/serialconsole/arm-serialconsole/src/models/index.ts index df79d29cef1..4d8656a5932 100644 --- a/sdk/serialconsole/arm-serialconsole/src/models/index.ts +++ b/sdk/serialconsole/arm-serialconsole/src/models/index.ts @@ -1,155 +1,192 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export { BaseResource, CloudError }; - -/** - * Returns whether or not Serial Console is disabled. - * @summary Serial Console GET Result - */ -export interface SerialConsoleGetResult { - /** - * Whether or not Serial Console is disabled. - */ - value?: boolean; -} - -/** - * Returns whether or not Serial Console is disabled for this given subscription - * @summary Get Disabled result - */ -export interface GetDisabledResult { - /** - * Disabled result - */ - disabled?: boolean; -} - -/** - * Sets disable status and returns whether or not Serial Console is now disabled for this given - * subscription - * @summary Set Disabled result - */ -export interface SetDisabledResult { - /** - * Disabled result - */ - disabled?: boolean; -} - -/** - * Details on Failure - * @summary Details on Failure - */ -export interface DeploymentValidateResult { - /** - * Error message - */ - errorMessage?: string; -} - -/** - * Serial Console operations - * @summary Serial Console operations - */ +/** Serial Console operations */ export interface SerialConsoleOperations { - /** - * Serial Console operations - */ - value?: string; + /** A list of Serial Console operations */ + value?: SerialConsoleOperationsValueItem[]; } -/** - * An interface representing MicrosoftSerialConsoleClientOptions. - */ -export interface MicrosoftSerialConsoleClientOptions extends AzureServiceClientOptions { - baseUri?: string; +export interface SerialConsoleOperationsValueItem { + name?: string; + isDataAction?: string; + display?: SerialConsoleOperationsValueItemDisplay; } -/** - * Contains response data for the operations operation. - */ -export type ListOperationsResponse = SerialConsoleOperations & { +export interface SerialConsoleOperationsValueItemDisplay { + provider?: string; + resource?: string; + operation?: string; + description?: string; +} + +/** Returns whether or not Serial Console is disabled. */ +export interface SerialConsoleStatus { + /** Whether or not Serial Console is disabled. */ + disabled?: boolean; +} + +/** Error saying that the provided subscription could not be found */ +export interface GetSerialConsoleSubscriptionNotFound { + /** Error code */ + code?: string; + /** Subscription not found message */ + message?: string; +} + +/** Returns whether or not Serial Console is disabled. */ +export interface DisableSerialConsoleResult { + /** Whether or not Serial Console is disabled. */ + disabled?: boolean; +} + +/** Returns whether or not Serial Console is disabled (enabled). */ +export interface EnableSerialConsoleResult { + /** Whether or not Serial Console is disabled (enabled). */ + disabled?: boolean; +} + +/** The list serial ports operation response. */ +export interface SerialPortListResult { + /** The list of serial ports. */ + value?: SerialPort[]; +} + +/** The Resource model definition. */ +export interface Resource { /** - * The underlying HTTP response. + * Resource Id + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SerialConsoleOperations; - }; -}; - -/** - * Contains response data for the disabled operation. - */ -export type ListConsoleDisabledResponse = GetDisabledResult & { + readonly id?: string; /** - * The underlying HTTP response. + * Resource name + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: GetDisabledResult; - }; -}; - -/** - * Contains response data for the enableConsole operation. - */ -export type ConsoleEnableConsoleResponse = SetDisabledResult & { + readonly name?: string; /** - * The underlying HTTP response. + * Resource type + * NOTE: This property will not be serialized. It can only be populated by the server. */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; + readonly type?: string; +} - /** - * The response body as parsed JSON or XML - */ - parsedBody: SetDisabledResult; - }; +/** An error response from the service. */ +export interface CloudError { + /** Cloud error body. */ + error?: CloudErrorBody; +} + +/** An error response from the Batch service. */ +export interface CloudErrorBody { + /** An identifier for the error. Codes are invariant and are intended to be consumed programmatically. */ + code?: string; + /** A message describing the error, intended to be suitable for display in a user interface. */ + message?: string; + /** The target of the particular error. For example, the name of the property in error. */ + target?: string; + /** A list of additional details about the error. */ + details?: CloudErrorBody[]; +} + +/** Returns a connection string to the serial port of the resource. */ +export interface SerialPortConnectResult { + /** Connection string to the serial port of the resource. */ + connectionString?: string; +} + +/** The resource model definition for a ARM proxy resource. It will have everything other than required location and tags */ +export type ProxyResource = Resource & {}; + +/** Represents the serial port of the parent resource. */ +export type SerialPort = ProxyResource & { + /** Specifies whether the port is enabled for a serial console connection. */ + state?: SerialPortState; }; +/** Defines values for SerialPortState. */ +export type SerialPortState = "enabled" | "disabled"; -/** - * Contains response data for the disableConsole operation. - */ -export type ConsoleDisableConsoleResponse = SetDisabledResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; +/** Optional parameters. */ +export interface ListOperationsOptionalParams + extends coreClient.OperationOptions {} - /** - * The response body as parsed JSON or XML - */ - parsedBody: SetDisabledResult; - }; -}; +/** Contains response data for the listOperations operation. */ +export type ListOperationsResponse = SerialConsoleOperations; + +/** Optional parameters. */ +export interface GetConsoleStatusOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the getConsoleStatus operation. */ +export type GetConsoleStatusResponse = SerialConsoleStatus; + +/** Optional parameters. */ +export interface DisableConsoleOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the disableConsole operation. */ +export type DisableConsoleResponse = DisableSerialConsoleResult; + +/** Optional parameters. */ +export interface EnableConsoleOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the enableConsole operation. */ +export type EnableConsoleResponse = EnableSerialConsoleResult; + +/** Optional parameters. */ +export interface SerialPortsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type SerialPortsListResponse = SerialPortListResult; + +/** Optional parameters. */ +export interface SerialPortsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type SerialPortsGetResponse = SerialPort; + +/** Optional parameters. */ +export interface SerialPortsCreateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the create operation. */ +export type SerialPortsCreateResponse = SerialPort; + +/** Optional parameters. */ +export interface SerialPortsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface SerialPortsListBySubscriptionsOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptions operation. */ +export type SerialPortsListBySubscriptionsResponse = SerialPortListResult; + +/** Optional parameters. */ +export interface SerialPortsConnectOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the connect operation. */ +export type SerialPortsConnectResponse = SerialPortConnectResult; + +/** Optional parameters. */ +export interface MicrosoftSerialConsoleClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/serialconsole/arm-serialconsole/src/models/listConsoleMappers.ts b/sdk/serialconsole/arm-serialconsole/src/models/listConsoleMappers.ts deleted file mode 100644 index 760e7a1f3ef..00000000000 --- a/sdk/serialconsole/arm-serialconsole/src/models/listConsoleMappers.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - DeploymentValidateResult, - GetDisabledResult -} from "../models/mappers"; diff --git a/sdk/serialconsole/arm-serialconsole/src/models/listMappers.ts b/sdk/serialconsole/arm-serialconsole/src/models/listMappers.ts deleted file mode 100644 index 148587eca7f..00000000000 --- a/sdk/serialconsole/arm-serialconsole/src/models/listMappers.ts +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - CloudError, - SerialConsoleOperations -} from "../models/mappers"; diff --git a/sdk/serialconsole/arm-serialconsole/src/models/mappers.ts b/sdk/serialconsole/arm-serialconsole/src/models/mappers.ts index dac7558d28b..ca70a9e96cb 100644 --- a/sdk/serialconsole/arm-serialconsole/src/models/mappers.ts +++ b/sdk/serialconsole/arm-serialconsole/src/models/mappers.ts @@ -1,89 +1,87 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export const CloudError = CloudErrorMapper; -export const BaseResource = BaseResourceMapper; - -export const SerialConsoleGetResult: msRest.CompositeMapper = { - serializedName: "SerialConsoleGetResult", - type: { - name: "Composite", - className: "SerialConsoleGetResult", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "Boolean" - } - } - } - } -}; - -export const GetDisabledResult: msRest.CompositeMapper = { - serializedName: "GetDisabledResult", - type: { - name: "Composite", - className: "GetDisabledResult", - modelProperties: { - disabled: { - serializedName: "disabled", - type: { - name: "Boolean" - } - } - } - } -}; - -export const SetDisabledResult: msRest.CompositeMapper = { - serializedName: "SetDisabledResult", - type: { - name: "Composite", - className: "SetDisabledResult", - modelProperties: { - disabled: { - serializedName: "disabled", - type: { - name: "Boolean" - } - } - } - } -}; - -export const DeploymentValidateResult: msRest.CompositeMapper = { - serializedName: "DeploymentValidateResult", - type: { - name: "Composite", - className: "DeploymentValidateResult", - modelProperties: { - errorMessage: { - serializedName: "errorMessage", - type: { - name: "String" - } - } - } - } -}; - -export const SerialConsoleOperations: msRest.CompositeMapper = { - serializedName: "SerialConsoleOperations", +export const SerialConsoleOperations: coreClient.CompositeMapper = { type: { name: "Composite", className: "SerialConsoleOperations", modelProperties: { value: { serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SerialConsoleOperationsValueItem" + } + } + } + } + } + } +}; + +export const SerialConsoleOperationsValueItem: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SerialConsoleOperationsValueItem", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + isDataAction: { + serializedName: "isDataAction", + type: { + name: "String" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "SerialConsoleOperationsValueItemDisplay" + } + } + } + } +}; + +export const SerialConsoleOperationsValueItemDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SerialConsoleOperationsValueItemDisplay", + modelProperties: { + provider: { + serializedName: "provider", + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + type: { + name: "String" + } + }, + description: { + serializedName: "description", type: { name: "String" } @@ -91,3 +89,217 @@ export const SerialConsoleOperations: msRest.CompositeMapper = { } } }; + +export const SerialConsoleStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SerialConsoleStatus", + modelProperties: { + disabled: { + serializedName: "disabled", + type: { + name: "Boolean" + } + } + } + } +}; + +export const GetSerialConsoleSubscriptionNotFound: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "GetSerialConsoleSubscriptionNotFound", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const DisableSerialConsoleResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "DisableSerialConsoleResult", + modelProperties: { + disabled: { + serializedName: "disabled", + type: { + name: "Boolean" + } + } + } + } +}; + +export const EnableSerialConsoleResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "EnableSerialConsoleResult", + modelProperties: { + disabled: { + serializedName: "disabled", + type: { + name: "Boolean" + } + } + } + } +}; + +export const SerialPortListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SerialPortListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SerialPort" + } + } + } + } + } + } +}; + +export const Resource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const CloudError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CloudError", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "CloudErrorBody" + } + } + } + } +}; + +export const CloudErrorBody: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CloudErrorBody", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + }, + target: { + serializedName: "target", + type: { + name: "String" + } + }, + details: { + serializedName: "details", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CloudErrorBody" + } + } + } + } + } + } +}; + +export const SerialPortConnectResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SerialPortConnectResult", + modelProperties: { + connectionString: { + serializedName: "connectionString", + type: { + name: "String" + } + } + } + } +}; + +export const ProxyResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties + } + } +}; + +export const SerialPort: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SerialPort", + modelProperties: { + ...ProxyResource.type.modelProperties, + state: { + serializedName: "properties.state", + type: { + name: "Enum", + allowedValues: ["enabled", "disabled"] + } + } + } + } +}; diff --git a/sdk/serialconsole/arm-serialconsole/src/models/parameters.ts b/sdk/serialconsole/arm-serialconsole/src/models/parameters.ts index cfa66a79cc4..b5f261624b5 100644 --- a/sdk/serialconsole/arm-serialconsole/src/models/parameters.ts +++ b/sdk/serialconsole/arm-serialconsole/src/models/parameters.ts @@ -1,54 +1,145 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { SerialPort as SerialPortMapper } from "../models/mappers"; -export const acceptLanguage: msRest.OperationParameter = { - parameterPath: "acceptLanguage", +export const accept: OperationParameter = { + parameterPath: "accept", mapper: { - serializedName: "accept-language", - defaultValue: 'en-US', + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", type: { name: "String" } } }; -export const apiVersion: msRest.OperationQueryParameter = { + +export const $host: OperationURLParameter = { + parameterPath: "$host", + mapper: { + serializedName: "$host", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const apiVersion: OperationQueryParameter = { parameterPath: "apiVersion", mapper: { - required: true, + defaultValue: "2018-05-01", + isConstant: true, serializedName: "api-version", type: { name: "String" } } }; -export const defaultParameter: msRest.OperationURLParameter = { - parameterPath: "defaultParameter", - mapper: { - required: true, - isConstant: true, - serializedName: "default", - defaultValue: 'default', - type: { - name: "String" - } - } -}; -export const subscriptionId: msRest.OperationURLParameter = { + +export const subscriptionId: OperationURLParameter = { parameterPath: "subscriptionId", mapper: { - required: true, serializedName: "subscriptionId", + required: true, type: { name: "String" } } }; + +export const defaultParam: OperationURLParameter = { + parameterPath: "defaultParam", + mapper: { + serializedName: "default", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + serializedName: "resourceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceProviderNamespace: OperationURLParameter = { + parameterPath: "resourceProviderNamespace", + mapper: { + serializedName: "resourceProviderNamespace", + required: true, + type: { + name: "String" + } + } +}; + +export const parentResourceType: OperationURLParameter = { + parameterPath: "parentResourceType", + mapper: { + serializedName: "parentResourceType", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const parentResource: OperationURLParameter = { + parameterPath: "parentResource", + mapper: { + serializedName: "parentResource", + required: true, + type: { + name: "String" + } + } +}; + +export const serialPort: OperationURLParameter = { + parameterPath: "serialPort", + mapper: { + serializedName: "serialPort", + required: true, + type: { + name: "String" + } + } +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const parameters: OperationParameter = { + parameterPath: "parameters", + mapper: SerialPortMapper +}; diff --git a/sdk/serialconsole/arm-serialconsole/src/operations/console.ts b/sdk/serialconsole/arm-serialconsole/src/operations/console.ts deleted file mode 100644 index 5fc39b8dbe5..00000000000 --- a/sdk/serialconsole/arm-serialconsole/src/operations/console.ts +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/consoleMappers"; -import * as Parameters from "../models/parameters"; -import { MicrosoftSerialConsoleClientContext } from "../microsoftSerialConsoleClientContext"; - -/** Class representing a Console. */ -export class Console { - private readonly client: MicrosoftSerialConsoleClientContext; - - /** - * Create a Console. - * @param {MicrosoftSerialConsoleClientContext} client Reference to the service client. - */ - constructor(client: MicrosoftSerialConsoleClientContext) { - this.client = client; - } - - /** - * Enables Serial Console for a subscription - * @param [options] The optional parameters - * @returns Promise - */ - enableConsole(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - enableConsole(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - enableConsole(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - enableConsole(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - enableConsoleOperationSpec, - callback) as Promise; - } - - /** - * Disables Serial Console for a subscription - * @param [options] The optional parameters - * @returns Promise - */ - disableConsole(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - disableConsole(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - disableConsole(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - disableConsole(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - disableConsoleOperationSpec, - callback) as Promise; - } -} - -// Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const enableConsoleOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/consoleServices/{default}/enableConsole", - urlParameters: [ - Parameters.subscriptionId, - Parameters.defaultParameter - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.SetDisabledResult - }, - default: { - bodyMapper: Mappers.DeploymentValidateResult - } - }, - serializer -}; - -const disableConsoleOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/consoleServices/{default}/disableConsole", - urlParameters: [ - Parameters.subscriptionId, - Parameters.defaultParameter - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.SetDisabledResult - }, - default: { - bodyMapper: Mappers.DeploymentValidateResult - } - }, - serializer -}; diff --git a/sdk/serialconsole/arm-serialconsole/src/operations/index.ts b/sdk/serialconsole/arm-serialconsole/src/operations/index.ts index e3293772d3e..ae410fbeecf 100644 --- a/sdk/serialconsole/arm-serialconsole/src/operations/index.ts +++ b/sdk/serialconsole/arm-serialconsole/src/operations/index.ts @@ -1,13 +1,9 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -export * from "./list"; -export * from "./listConsole"; -export * from "./console"; +export * from "./serialPorts"; diff --git a/sdk/serialconsole/arm-serialconsole/src/operations/list.ts b/sdk/serialconsole/arm-serialconsole/src/operations/list.ts deleted file mode 100644 index 29bbdc3a732..00000000000 --- a/sdk/serialconsole/arm-serialconsole/src/operations/list.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/listMappers"; -import * as Parameters from "../models/parameters"; -import { MicrosoftSerialConsoleClientContext } from "../microsoftSerialConsoleClientContext"; - -/** Class representing a List. */ -export class List { - private readonly client: MicrosoftSerialConsoleClientContext; - - /** - * Create a List. - * @param {MicrosoftSerialConsoleClientContext} client Reference to the service client. - */ - constructor(client: MicrosoftSerialConsoleClientContext) { - this.client = client; - } - - /** - * Gets a list of Serial Console API operations. - * @param [options] The optional parameters - * @returns Promise - */ - operations(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - operations(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - operations(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - operations(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - operationsOperationSpec, - callback) as Promise; - } -} - -// Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const operationsOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/operations", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.SerialConsoleOperations - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; diff --git a/sdk/serialconsole/arm-serialconsole/src/operations/listConsole.ts b/sdk/serialconsole/arm-serialconsole/src/operations/listConsole.ts deleted file mode 100644 index 2e69bc92a0a..00000000000 --- a/sdk/serialconsole/arm-serialconsole/src/operations/listConsole.ts +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/listConsoleMappers"; -import * as Parameters from "../models/parameters"; -import { MicrosoftSerialConsoleClientContext } from "../microsoftSerialConsoleClientContext"; - -/** Class representing a ListConsole. */ -export class ListConsole { - private readonly client: MicrosoftSerialConsoleClientContext; - - /** - * Create a ListConsole. - * @param {MicrosoftSerialConsoleClientContext} client Reference to the service client. - */ - constructor(client: MicrosoftSerialConsoleClientContext) { - this.client = client; - } - - /** - * Gets if Serial Console is disabled for a subscription. - * @param [options] The optional parameters - * @returns Promise - */ - disabled(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - disabled(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - disabled(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - disabled(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options - }, - disabledOperationSpec, - callback) as Promise; - } -} - -// Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const disabledOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/consoleServices/{default}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.defaultParameter - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.GetDisabledResult - }, - default: { - bodyMapper: Mappers.DeploymentValidateResult - } - }, - serializer -}; diff --git a/sdk/serialconsole/arm-serialconsole/src/operations/serialPorts.ts b/sdk/serialconsole/arm-serialconsole/src/operations/serialPorts.ts new file mode 100644 index 00000000000..b711710a1a0 --- /dev/null +++ b/sdk/serialconsole/arm-serialconsole/src/operations/serialPorts.ts @@ -0,0 +1,357 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { SerialPorts } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MicrosoftSerialConsoleClient } from "../microsoftSerialConsoleClient"; +import { + SerialPortsListOptionalParams, + SerialPortsListResponse, + SerialPortsGetOptionalParams, + SerialPortsGetResponse, + SerialPort, + SerialPortsCreateOptionalParams, + SerialPortsCreateResponse, + SerialPortsDeleteOptionalParams, + SerialPortsListBySubscriptionsOptionalParams, + SerialPortsListBySubscriptionsResponse, + SerialPortsConnectOptionalParams, + SerialPortsConnectResponse +} from "../models"; + +/** Class containing SerialPorts operations. */ +export class SerialPortsImpl implements SerialPorts { + private readonly client: MicrosoftSerialConsoleClient; + + /** + * Initialize a new instance of the class SerialPorts class. + * @param client Reference to the service client + */ + constructor(client: MicrosoftSerialConsoleClient) { + this.client = client; + } + + /** + * Lists all of the configured serial ports for a parent resource + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourceType The resource type of the parent resource. For example: 'virtualMachines' + * or 'virtualMachineScaleSets' + * @param parentResource The resource name, or subordinate path, for the parent of the serial port. For + * example: the name of the virtual machine. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourceType: string, + parentResource: string, + options?: SerialPortsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + resourceProviderNamespace, + parentResourceType, + parentResource, + options + }, + listOperationSpec + ); + } + + /** + * Gets the configured settings for a serial port + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourceType The resource type of the parent resource. For example: 'virtualMachines' + * or 'virtualMachineScaleSets' + * @param parentResource The resource name, or subordinate path, for the parent of the serial port. For + * example: the name of the virtual machine. + * @param serialPort The name of the serial port to connect to. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourceType: string, + parentResource: string, + serialPort: string, + options?: SerialPortsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + resourceProviderNamespace, + parentResourceType, + parentResource, + serialPort, + options + }, + getOperationSpec + ); + } + + /** + * Creates or updates a serial port + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourceType The resource type of the parent resource. For example: 'virtualMachines' + * or 'virtualMachineScaleSets' + * @param parentResource The resource name, or subordinate path, for the parent of the serial port. For + * example: the name of the virtual machine. + * @param serialPort The name of the serial port to create. + * @param parameters Parameters supplied to create the serial port. + * @param options The options parameters. + */ + create( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourceType: string, + parentResource: string, + serialPort: string, + parameters: SerialPort, + options?: SerialPortsCreateOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + resourceProviderNamespace, + parentResourceType, + parentResource, + serialPort, + parameters, + options + }, + createOperationSpec + ); + } + + /** + * Deletes a serial port + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourceType The resource type of the parent resource. For example: 'virtualMachines' + * or 'virtualMachineScaleSets' + * @param parentResource The resource name, or subordinate path, for the parent of the serial port. For + * example: the name of the virtual machine. + * @param serialPort The name of the serial port to delete. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourceType: string, + parentResource: string, + serialPort: string, + options?: SerialPortsDeleteOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + resourceProviderNamespace, + parentResourceType, + parentResource, + serialPort, + options + }, + deleteOperationSpec + ); + } + + /** + * Handles requests to list all SerialPort resources in a subscription. + * @param options The options parameters. + */ + listBySubscriptions( + options?: SerialPortsListBySubscriptionsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { options }, + listBySubscriptionsOperationSpec + ); + } + + /** + * Connect to serial port of the target resource + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourceType The resource type of the parent resource. For example: 'virtualMachines' + * or 'virtualMachineScaleSets' + * @param parentResource The resource name, or subordinate path, for the parent of the serial port. For + * example: the name of the virtual machine. + * @param serialPort The name of the serial port to connect to. + * @param options The options parameters. + */ + connect( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourceType: string, + parentResource: string, + serialPort: string, + options?: SerialPortsConnectOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + resourceProviderNamespace, + parentResourceType, + parentResource, + serialPort, + options + }, + connectOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourceType}/{parentResource}/providers/Microsoft.SerialConsole/serialPorts", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SerialPortListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceProviderNamespace, + Parameters.parentResourceType, + Parameters.parentResource + ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourceType}/{parentResource}/providers/Microsoft.SerialConsole/serialPorts/{serialPort}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SerialPort + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceProviderNamespace, + Parameters.parentResourceType, + Parameters.parentResource, + Parameters.serialPort + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourceType}/{parentResource}/providers/Microsoft.SerialConsole/serialPorts/{serialPort}", + httpMethod: "PUT", + responses: { + 201: { + bodyMapper: Mappers.SerialPort + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceProviderNamespace, + Parameters.parentResourceType, + Parameters.parentResource, + Parameters.serialPort + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourceType}/{parentResource}/providers/Microsoft.SerialConsole/serialPorts/{serialPort}", + httpMethod: "DELETE", + responses: { + 200: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceProviderNamespace, + Parameters.parentResourceType, + Parameters.parentResource, + Parameters.serialPort + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.SerialConsole/serialPorts", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SerialPortListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const connectOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourceType}/{parentResource}/providers/Microsoft.SerialConsole/serialPorts/{serialPort}/connect", + httpMethod: "POST", + responses: { + 200: { + bodyMapper: Mappers.SerialPortConnectResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceProviderNamespace, + Parameters.parentResourceType, + Parameters.parentResource, + Parameters.serialPort + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/storagecache/arm-storagecache/src/models/usageModelsMappers.ts b/sdk/serialconsole/arm-serialconsole/src/operationsInterfaces/index.ts similarity index 68% rename from sdk/storagecache/arm-storagecache/src/models/usageModelsMappers.ts rename to sdk/serialconsole/arm-serialconsole/src/operationsInterfaces/index.ts index 2693d7cf34c..ae410fbeecf 100644 --- a/sdk/storagecache/arm-storagecache/src/models/usageModelsMappers.ts +++ b/sdk/serialconsole/arm-serialconsole/src/operationsInterfaces/index.ts @@ -6,9 +6,4 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -export { - CloudError, - UsageModel, - UsageModelDisplay, - UsageModelsResult -} from "../models/mappers"; +export * from "./serialPorts"; diff --git a/sdk/serialconsole/arm-serialconsole/src/operationsInterfaces/serialPorts.ts b/sdk/serialconsole/arm-serialconsole/src/operationsInterfaces/serialPorts.ts new file mode 100644 index 00000000000..6b8b8d8d01a --- /dev/null +++ b/sdk/serialconsole/arm-serialconsole/src/operationsInterfaces/serialPorts.ts @@ -0,0 +1,128 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + SerialPortsListOptionalParams, + SerialPortsListResponse, + SerialPortsGetOptionalParams, + SerialPortsGetResponse, + SerialPort, + SerialPortsCreateOptionalParams, + SerialPortsCreateResponse, + SerialPortsDeleteOptionalParams, + SerialPortsListBySubscriptionsOptionalParams, + SerialPortsListBySubscriptionsResponse, + SerialPortsConnectOptionalParams, + SerialPortsConnectResponse +} from "../models"; + +/** Interface representing a SerialPorts. */ +export interface SerialPorts { + /** + * Lists all of the configured serial ports for a parent resource + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourceType The resource type of the parent resource. For example: 'virtualMachines' + * or 'virtualMachineScaleSets' + * @param parentResource The resource name, or subordinate path, for the parent of the serial port. For + * example: the name of the virtual machine. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourceType: string, + parentResource: string, + options?: SerialPortsListOptionalParams + ): Promise; + /** + * Gets the configured settings for a serial port + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourceType The resource type of the parent resource. For example: 'virtualMachines' + * or 'virtualMachineScaleSets' + * @param parentResource The resource name, or subordinate path, for the parent of the serial port. For + * example: the name of the virtual machine. + * @param serialPort The name of the serial port to connect to. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourceType: string, + parentResource: string, + serialPort: string, + options?: SerialPortsGetOptionalParams + ): Promise; + /** + * Creates or updates a serial port + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourceType The resource type of the parent resource. For example: 'virtualMachines' + * or 'virtualMachineScaleSets' + * @param parentResource The resource name, or subordinate path, for the parent of the serial port. For + * example: the name of the virtual machine. + * @param serialPort The name of the serial port to create. + * @param parameters Parameters supplied to create the serial port. + * @param options The options parameters. + */ + create( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourceType: string, + parentResource: string, + serialPort: string, + parameters: SerialPort, + options?: SerialPortsCreateOptionalParams + ): Promise; + /** + * Deletes a serial port + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourceType The resource type of the parent resource. For example: 'virtualMachines' + * or 'virtualMachineScaleSets' + * @param parentResource The resource name, or subordinate path, for the parent of the serial port. For + * example: the name of the virtual machine. + * @param serialPort The name of the serial port to delete. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourceType: string, + parentResource: string, + serialPort: string, + options?: SerialPortsDeleteOptionalParams + ): Promise; + /** + * Handles requests to list all SerialPort resources in a subscription. + * @param options The options parameters. + */ + listBySubscriptions( + options?: SerialPortsListBySubscriptionsOptionalParams + ): Promise; + /** + * Connect to serial port of the target resource + * @param resourceGroupName The name of the resource group. + * @param resourceProviderNamespace The namespace of the resource provider. + * @param parentResourceType The resource type of the parent resource. For example: 'virtualMachines' + * or 'virtualMachineScaleSets' + * @param parentResource The resource name, or subordinate path, for the parent of the serial port. For + * example: the name of the virtual machine. + * @param serialPort The name of the serial port to connect to. + * @param options The options parameters. + */ + connect( + resourceGroupName: string, + resourceProviderNamespace: string, + parentResourceType: string, + parentResource: string, + serialPort: string, + options?: SerialPortsConnectOptionalParams + ): Promise; +} diff --git a/sdk/serialconsole/arm-serialconsole/test/sampleTest.ts b/sdk/serialconsole/arm-serialconsole/test/sampleTest.ts new file mode 100644 index 00000000000..7ed89b043e1 --- /dev/null +++ b/sdk/serialconsole/arm-serialconsole/test/sampleTest.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + env, + record, + RecorderEnvironmentSetup, + Recorder +} from "@azure-tools/test-recorder"; +import * as assert from "assert"; + +const recorderEnvSetup: RecorderEnvironmentSetup = { + replaceableVariables: { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" + }, + customizationsOnRecordings: [ + (recording: any): any => + recording.replace( + /"access_token":"[^"]*"/g, + `"access_token":"access_token"` + ) + ], + queryParametersToSkip: [] +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function() { + recorder = record(this, recorderEnvSetup); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/serialconsole/arm-serialconsole/tsconfig.json b/sdk/serialconsole/arm-serialconsole/tsconfig.json index 87bbf5b5fa4..6e325119411 100644 --- a/sdk/serialconsole/arm-serialconsole/tsconfig.json +++ b/sdk/serialconsole/arm-serialconsole/tsconfig.json @@ -3,17 +3,17 @@ "module": "es6", "moduleResolution": "node", "strict": true, - "target": "es5", + "target": "es6", "sourceMap": true, "declarationMap": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "lib": ["es6"], + "lib": ["es6", "dom"], "declaration": true, - "outDir": "./esm", + "outDir": "./dist-esm", "importHelpers": true }, - "include": ["./src/**/*.ts"], + "include": ["./src/**/*.ts", "./test/**/*.ts"], "exclude": ["node_modules"] } diff --git a/sdk/serialconsole/ci.yml b/sdk/serialconsole/ci.yml new file mode 100644 index 00000000000..2307a9f0377 --- /dev/null +++ b/sdk/serialconsole/ci.yml @@ -0,0 +1,30 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/serialconsole/ + +pr: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/serialconsole/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: serialconsole + Artifacts: + - name: azure-arm-serialconsole + safeName: azurearmserialconsole + \ No newline at end of file diff --git a/sdk/service-map/arm-servicemap/CHANGELOG.md b/sdk/service-map/arm-servicemap/CHANGELOG.md new file mode 100644 index 00000000000..8b521c213eb --- /dev/null +++ b/sdk/service-map/arm-servicemap/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 3.0.0-beta.1 (2022-01-21) + +The package of @azure/arm-servicemap is using our next generation design principles since version 3.0.0-beta.1, which contains breaking changes. + +To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog). + +To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/service-map/arm-servicemap/LICENSE b/sdk/service-map/arm-servicemap/LICENSE new file mode 100644 index 00000000000..5d1d36e0af8 --- /dev/null +++ b/sdk/service-map/arm-servicemap/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/service-map/arm-servicemap/README.md b/sdk/service-map/arm-servicemap/README.md index eebb289c534..b182ff3b92e 100644 --- a/sdk/service-map/arm-servicemap/README.md +++ b/sdk/service-map/arm-servicemap/README.md @@ -1,112 +1,98 @@ -## Azure ServicemapManagementClient SDK for JavaScript +# Azure Service client library for JavaScript -This package contains an isomorphic SDK for ServicemapManagementClient. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Service client. + +Service Map API Reference + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/service-map/arm-servicemap) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-servicemap) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-servicemap?view=azure-node-preview) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started ### Currently supported environments - [LTS versions of Node.js](https://nodejs.org/about/releases/) -- Latest versions of Safari, Chrome, Edge, and Firefox. +- Latest versions of Safari, Chrome, Edge and Firefox. -### How to Install +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-servicemap` package + +Install the Azure Service client library for JavaScript with `npm`: ```bash npm install @azure/arm-servicemap ``` -### How to use +### Create and authenticate a `ServiceMap` -#### nodejs - Authentication, client creation and listByWorkspace machines as an example written in TypeScript. +To create a client object to access the Azure Service API, you will need the `endpoint` of your Azure Service resource and a `credential`. The Azure Service client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure Service resource in the [Azure Portal][azure_portal]. -##### Install @azure/ms-rest-nodeauth +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/ms-rest-nodeauth +npm install @azure/identity ``` -##### Sample code +You will also need to **register a new AAD application and grant access to Azure Service** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. -```typescript -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; -import { ServicemapManagementClient, ServicemapManagementModels, ServicemapManagementMappers } from "@azure/arm-servicemap"; -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). -msRestNodeAuth.interactiveLogin().then((creds) => { - const client = new ServicemapManagementClient(creds, subscriptionId); - const resourceGroupName = "testresourceGroupName"; - const workspaceName = "testworkspaceName"; - const live = true; - const startTime = new Date().toISOString(); - const endTime = new Date().toISOString(); - const timestamp = new Date().toISOString(); - const top = 1; - client.machines.listByWorkspace(resourceGroupName, workspaceName, live, startTime, endTime, timestamp, top).then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.error(err); -}); +```javascript +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new ServiceMap(new DefaultAzureCredential(), subscriptionId); ``` -#### browser - Authentication, client creation and listByWorkspace machines as an example written in JavaScript. -##### Install @azure/ms-rest-browserauth +### 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). -```bash -npm install @azure/ms-rest-browserauth +## Key concepts + +### ServiceMap + +`ServiceMap` is the primary interface for developers using the Azure Service client library. Explore the methods on this client object to understand the different features of the Azure Service 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"); ``` -##### Sample code +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). -See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. +## Next steps -- index.html -```html - - - - @azure/arm-servicemap sample - - - - - - - - -``` +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. ## Related projects -- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fservice-map%2Farm-servicemap%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/service-map/arm-servicemap/_meta.json b/sdk/service-map/arm-servicemap/_meta.json new file mode 100644 index 00000000000..01a36ccc33c --- /dev/null +++ b/sdk/service-map/arm-servicemap/_meta.json @@ -0,0 +1,7 @@ +{ + "commit": "f9a6cb686bcc0f1b23761db19f2491c5c4df95cb", + "readme": "specification/service-map/resource-manager/readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/service-map/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20220114.1 --generate-sample=true", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "use": "@autorest/typescript@6.0.0-alpha.16.20220114.1" +} \ No newline at end of file diff --git a/sdk/service-map/arm-servicemap/api-extractor.json b/sdk/service-map/arm-servicemap/api-extractor.json new file mode 100644 index 00000000000..91f9df34a2a --- /dev/null +++ b/sdk/service-map/arm-servicemap/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-servicemap.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/service-map/arm-servicemap/package.json b/sdk/service-map/arm-servicemap/package.json index 0fd1d7250ed..9b7aeba0814 100644 --- a/sdk/service-map/arm-servicemap/package.json +++ b/sdk/service-map/arm-servicemap/package.json @@ -1,58 +1,101 @@ { "name": "@azure/arm-servicemap", + "sdk-type": "mgmt", "author": "Microsoft Corporation", - "description": "ServicemapManagementClient Library with typescript type definitions for node.js and browser.", - "version": "2.2.0", + "description": "A generated SDK for ServiceMap.", + "version": "3.0.0-beta.1", + "engines": { "node": ">=12.0.0" }, "dependencies": { - "@azure/ms-rest-azure-js": "^2.0.0", - "@azure/ms-rest-js": "^2.0.3", - "tslib": "^1.10.0" + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.1.0", + "tslib": "^2.2.0" }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], + "keywords": ["node", "azure", "typescript", "browser", "isomorphic"], "license": "MIT", - "main": "./dist/arm-servicemap.js", - "module": "./esm/servicemapManagementClient.js", - "types": "./esm/servicemapManagementClient.d.ts", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-servicemap.d.ts", "devDependencies": { - "typescript": "^3.1.1", - "rollup": "^0.66.2", - "rollup-plugin-node-resolve": "^3.4.0", + "@microsoft/api-extractor": "^7.18.11", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "mkdirp": "^1.0.4", + "rollup": "^1.16.3", "rollup-plugin-sourcemaps": "^0.4.2", - "uglify-js": "^3.4.9" + "typescript": "~4.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^1.0.0", + "mocha": "^7.1.1", + "cross-env": "^7.0.2" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/service-map/arm-servicemap", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" }, - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, + "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, "files": [ "dist/**/*.js", "dist/**/*.js.map", "dist/**/*.d.ts", "dist/**/*.d.ts.map", - "esm/**/*.js", - "esm/**/*.js.map", - "esm/**/*.d.ts", - "esm/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", "src/**/*.ts", "README.md", + "LICENSE", "rollup.config.js", - "tsconfig.json" + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" ], "scripts": { - "build": "tsc && rollup -c rollup.config.js && npm run minify", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-servicemap.js.map'\" -o ./dist/arm-servicemap.min.js ./dist/arm-servicemap.js", - "prepack": "npm install && npm run build" + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" }, "sideEffects": false, - "autoPublish": true + "//metadata": { + "constantPaths": [ + { "path": "src/ServiceMap.ts", "prefix": "packageDetails" } + ] + }, + "autoPublish": true, + "//sampleConfiguration": { + "productName": "", + "productSlugs": ["azure"], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-servicemap?view=azure-node-preview" + } } diff --git a/sdk/service-map/arm-servicemap/recordings/node/my_test/recording_sample_test.js b/sdk/service-map/arm-servicemap/recordings/node/my_test/recording_sample_test.js new file mode 100644 index 00000000000..0f6ecb857ac --- /dev/null +++ b/sdk/service-map/arm-servicemap/recordings/node/my_test/recording_sample_test.js @@ -0,0 +1,5 @@ +let nock = require('nock'); + +module.exports.hash = "7a6be38bb8cb644d64b4094802301751"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} diff --git a/sdk/service-map/arm-servicemap/review/arm-servicemap.api.md b/sdk/service-map/arm-servicemap/review/arm-servicemap.api.md new file mode 100644 index 00000000000..faed7de500c --- /dev/null +++ b/sdk/service-map/arm-servicemap/review/arm-servicemap.api.md @@ -0,0 +1,1034 @@ +## API Report File for "@azure/arm-servicemap" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; + +// @public +export type Acceptor = Relationship & { + source?: PortReference; + destination?: ProcessReference; + startTime?: Date; + endTime?: Date; +}; + +// @public +export type Accuracy = "actual" | "estimated"; + +// @public +export interface AgentConfiguration { + agentId: string; + clockGranularity?: number; + dependencyAgentId?: string; + dependencyAgentRevision?: string; + dependencyAgentVersion?: string; + rebootStatus?: MachineRebootStatus; +} + +// @public +export interface AzureCloudServiceConfiguration { + deployment?: string; + instanceId?: string; + name?: string; + roleName?: string; + roleType?: AzureCloudServiceRoleType; +} + +// @public +export type AzureCloudServiceRoleType = "unknown" | "worker" | "web"; + +// @public +export type AzureHostingConfiguration = HostingConfiguration & { + kind: "provider:azure"; + vmId?: string; + location?: string; + name?: string; + size?: string; + updateDomain?: string; + faultDomain?: string; + subscriptionId?: string; + resourceGroup?: string; + resourceId?: string; + image?: ImageConfiguration; + cloudService?: AzureCloudServiceConfiguration; + vmScaleSet?: AzureVmScaleSetConfiguration; + serviceFabricCluster?: AzureServiceFabricClusterConfiguration; +}; + +// @public +export type AzureProcessHostingConfiguration = ProcessHostingConfiguration & { + kind: "provider:azure"; + cloudService?: AzureCloudServiceConfiguration; +}; + +// @public +export interface AzureServiceFabricClusterConfiguration { + clusterId?: string; + name?: string; +} + +// @public +export interface AzureVmScaleSetConfiguration { + deployment?: string; + instanceId?: string; + name?: string; + resourceId?: string; +} + +// @public +export type Bitness = "32bit" | "64bit"; + +// @public +export type ClientGroup = CoreResource & { + clientsOf?: ResourceReferenceUnion; +}; + +// @public +export type ClientGroupMember = Resource & { + ipAddress?: string; + port?: PortReference; + processes?: ProcessReference[]; +}; + +// @public +export interface ClientGroupMembersCollection { + nextLink?: string; + value?: ClientGroupMember[]; +} + +// @public +export interface ClientGroupMembersCount { + accuracy: Accuracy; + count: number; + endTime: Date; + groupId: string; + startTime: Date; +} + +// @public +export type ClientGroupReference = ResourceReference & { + kind: "ref:clientgroup"; +}; + +// @public +export interface ClientGroups { + get(resourceGroupName: string, workspaceName: string, clientGroupName: string, options?: ClientGroupsGetOptionalParams): Promise; + getMembersCount(resourceGroupName: string, workspaceName: string, clientGroupName: string, options?: ClientGroupsGetMembersCountOptionalParams): Promise; + listMembers(resourceGroupName: string, workspaceName: string, clientGroupName: string, options?: ClientGroupsListMembersOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ClientGroupsGetMembersCountOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type ClientGroupsGetMembersCountResponse = ClientGroupMembersCount; + +// @public +export interface ClientGroupsGetOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type ClientGroupsGetResponse = ClientGroup; + +// @public +export interface ClientGroupsListMembersNextOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; + top?: number; +} + +// @public +export type ClientGroupsListMembersNextResponse = ClientGroupMembersCollection; + +// @public +export interface ClientGroupsListMembersOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; + top?: number; +} + +// @public +export type ClientGroupsListMembersResponse = ClientGroupMembersCollection; + +// @public +export type Connection = Relationship & { + source?: ResourceReferenceUnion; + destination?: ResourceReferenceUnion; + startTime?: Date; + endTime?: Date; + serverPort?: PortReference; + failureState?: ConnectionFailureState; +}; + +// @public +export interface ConnectionCollection { + nextLink?: string; + value?: Connection[]; +} + +// @public +export type ConnectionFailureState = "ok" | "failed" | "mixed"; + +// @public +export type ConnectionProperties = RelationshipProperties & { + serverPort?: PortReference; + failureState?: ConnectionFailureState; +}; + +// @public +export type CoreResource = Resource & { + etag?: string; + kind: CoreResourceKind; +}; + +// @public +export type CoreResourceKind = string; + +// @public (undocumented) +export type CoreResourceUnion = CoreResource | Machine | Process | Port | MachineGroup | ClientGroup; + +// @public +export interface ErrorModel { + code: string; + message?: string; +} + +// @public +export interface ErrorResponse { + error: ErrorModel; +} + +// @public +export interface HostingConfiguration { + kind: "provider:azure"; + provider?: "azure"; +} + +// @public (undocumented) +export type HostingConfigurationUnion = HostingConfiguration | AzureHostingConfiguration; + +// @public +export interface HypervisorConfiguration { + hypervisorType?: HypervisorType; + nativeHostMachineId?: string; +} + +// @public +export type HypervisorType = "unknown" | "hyperv"; + +// @public +export interface ImageConfiguration { + offering?: string; + publisher?: string; + sku?: string; + version?: string; +} + +// @public +export interface Ipv4NetworkInterface { + ipAddress: string; + subnetMask?: string; +} + +// @public +export interface Ipv6NetworkInterface { + ipAddress: string; +} + +// @public +export enum KnownCoreResourceKind { + // (undocumented) + ClientGroup = "clientGroup", + // (undocumented) + Machine = "machine", + // (undocumented) + MachineGroup = "machineGroup", + // (undocumented) + Port = "port", + // (undocumented) + Process = "process" +} + +// @public +export enum KnownMachineGroupType { + // (undocumented) + AzureCs = "azure-cs", + // (undocumented) + AzureSf = "azure-sf", + // (undocumented) + AzureVmss = "azure-vmss", + // (undocumented) + Unknown = "unknown", + // (undocumented) + UserStatic = "user-static" +} + +// @public +export enum KnownMapRequestKind { + // (undocumented) + MapMachineGroupDependency = "map:machine-group-dependency", + // (undocumented) + MapMachineListDependency = "map:machine-list-dependency", + // (undocumented) + MapSingleMachineDependency = "map:single-machine-dependency" +} + +// @public +export enum KnownProcessRole { + // (undocumented) + AppServer = "appServer", + // (undocumented) + DatabaseServer = "databaseServer", + // (undocumented) + LdapServer = "ldapServer", + // (undocumented) + SmbServer = "smbServer", + // (undocumented) + WebServer = "webServer" +} + +// @public +export enum KnownRelationshipKind { + // (undocumented) + RelAcceptor = "rel:acceptor", + // (undocumented) + RelConnection = "rel:connection" +} + +// @public +export enum KnownResourceReferenceKind { + // (undocumented) + RefClientgroup = "ref:clientgroup", + // (undocumented) + RefMachine = "ref:machine", + // (undocumented) + RefMachinewithhints = "ref:machinewithhints", + // (undocumented) + RefOnmachine = "ref:onmachine", + // (undocumented) + RefPort = "ref:port", + // (undocumented) + RefProcess = "ref:process" +} + +// @public +export interface Liveness { + endTime: Date; + live: boolean; + startTime: Date; +} + +// @public +export type Machine = CoreResource & { + timestamp?: Date; + monitoringState?: MonitoringState; + virtualizationState?: VirtualizationState; + displayName?: string; + computerName?: string; + fullyQualifiedDomainName?: string; + bootTime?: Date; + timezone?: Timezone; + agent?: AgentConfiguration; + resources?: MachineResourcesConfiguration; + networking?: NetworkConfiguration; + operatingSystem?: OperatingSystemConfiguration; + virtualMachine?: VirtualMachineConfiguration; + hypervisor?: HypervisorConfiguration; + hosting?: HostingConfigurationUnion; +}; + +// @public +export interface MachineCollection { + nextLink?: string; + value?: Machine[]; +} + +// @public +export interface MachineCountsByOperatingSystem { + linux: number; + windows: number; +} + +// @public +export type MachineGroup = CoreResource & { + groupType?: MachineGroupType; + displayName?: string; + count?: number; + machines?: MachineReferenceWithHints[]; +}; + +// @public +export interface MachineGroupCollection { + nextLink?: string; + value?: MachineGroup[]; +} + +// @public +export type MachineGroupMapRequest = MultipleMachinesMapRequest & { + kind: "map:machine-group-dependency"; + machineGroupId: string; +}; + +// @public +export interface MachineGroups { + create(resourceGroupName: string, workspaceName: string, machineGroup: MachineGroup, options?: MachineGroupsCreateOptionalParams): Promise; + delete(resourceGroupName: string, workspaceName: string, machineGroupName: string, options?: MachineGroupsDeleteOptionalParams): Promise; + get(resourceGroupName: string, workspaceName: string, machineGroupName: string, options?: MachineGroupsGetOptionalParams): Promise; + listByWorkspace(resourceGroupName: string, workspaceName: string, options?: MachineGroupsListByWorkspaceOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, workspaceName: string, machineGroupName: string, machineGroup: MachineGroup, options?: MachineGroupsUpdateOptionalParams): Promise; +} + +// @public +export interface MachineGroupsCreateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MachineGroupsCreateResponse = MachineGroup; + +// @public +export interface MachineGroupsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export interface MachineGroupsGetOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type MachineGroupsGetResponse = MachineGroup; + +// @public +export interface MachineGroupsListByWorkspaceNextOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type MachineGroupsListByWorkspaceNextResponse = MachineGroupCollection; + +// @public +export interface MachineGroupsListByWorkspaceOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type MachineGroupsListByWorkspaceResponse = MachineGroupCollection; + +// @public +export interface MachineGroupsUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MachineGroupsUpdateResponse = MachineGroup; + +// @public +export type MachineGroupType = string; + +// @public +export type MachineListMapRequest = MultipleMachinesMapRequest & { + kind: "map:machine-list-dependency"; + machineIds: string[]; +}; + +// @public +export type MachineRebootStatus = "unknown" | "rebooted" | "notRebooted"; + +// @public +export type MachineReference = ResourceReference & { + kind: "ref:machine"; +}; + +// @public +export type MachineReferenceWithHints = ResourceReference & { + kind: "ref:machinewithhints"; + readonly displayNameHint?: string; + readonly osFamilyHint?: OperatingSystemFamily; +}; + +// @public +export interface MachineResourcesConfiguration { + cpus?: number; + cpuSpeed?: number; + cpuSpeedAccuracy?: Accuracy; + physicalMemory?: number; +} + +// @public +export interface Machines { + get(resourceGroupName: string, workspaceName: string, machineName: string, options?: MachinesGetOptionalParams): Promise; + getLiveness(resourceGroupName: string, workspaceName: string, machineName: string, options?: MachinesGetLivenessOptionalParams): Promise; + listByWorkspace(resourceGroupName: string, workspaceName: string, options?: MachinesListByWorkspaceOptionalParams): PagedAsyncIterableIterator; + listConnections(resourceGroupName: string, workspaceName: string, machineName: string, options?: MachinesListConnectionsOptionalParams): PagedAsyncIterableIterator; + listMachineGroupMembership(resourceGroupName: string, workspaceName: string, machineName: string, options?: MachinesListMachineGroupMembershipOptionalParams): PagedAsyncIterableIterator; + listPorts(resourceGroupName: string, workspaceName: string, machineName: string, options?: MachinesListPortsOptionalParams): PagedAsyncIterableIterator; + listProcesses(resourceGroupName: string, workspaceName: string, machineName: string, options?: MachinesListProcessesOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface MachinesGetLivenessOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type MachinesGetLivenessResponse = Liveness; + +// @public +export interface MachinesGetOptionalParams extends coreClient.OperationOptions { + timestamp?: Date; +} + +// @public +export type MachinesGetResponse = Machine; + +// @public +export interface MachinesListByWorkspaceNextOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + live?: boolean; + startTime?: Date; + timestamp?: Date; + top?: number; +} + +// @public +export type MachinesListByWorkspaceNextResponse = MachineCollection; + +// @public +export interface MachinesListByWorkspaceOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + live?: boolean; + startTime?: Date; + timestamp?: Date; + top?: number; +} + +// @public +export type MachinesListByWorkspaceResponse = MachineCollection; + +// @public +export interface MachinesListConnectionsNextOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type MachinesListConnectionsNextResponse = ConnectionCollection; + +// @public +export interface MachinesListConnectionsOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type MachinesListConnectionsResponse = ConnectionCollection; + +// @public +export interface MachinesListMachineGroupMembershipNextOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type MachinesListMachineGroupMembershipNextResponse = MachineGroupCollection; + +// @public +export interface MachinesListMachineGroupMembershipOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type MachinesListMachineGroupMembershipResponse = MachineGroupCollection; + +// @public +export interface MachinesListPortsNextOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type MachinesListPortsNextResponse = PortCollection; + +// @public +export interface MachinesListPortsOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type MachinesListPortsResponse = PortCollection; + +// @public +export interface MachinesListProcessesNextOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + live?: boolean; + startTime?: Date; + timestamp?: Date; +} + +// @public +export type MachinesListProcessesNextResponse = ProcessCollection; + +// @public +export interface MachinesListProcessesOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + live?: boolean; + startTime?: Date; + timestamp?: Date; +} + +// @public +export type MachinesListProcessesResponse = ProcessCollection; + +// @public +export type MachinesSummary = Summary & { + startTime?: Date; + endTime?: Date; + total?: number; + live?: number; + os?: MachineCountsByOperatingSystem; +}; + +// @public +export type MachinesSummaryProperties = SummaryProperties & { + total: number; + live: number; + os: MachineCountsByOperatingSystem; +}; + +// @public +interface Map_2 { + edges: MapEdges; + nodes: MapNodes; +} +export { Map_2 as Map } + +// @public +export interface MapEdges { + acceptors?: Acceptor[]; + connections?: Connection[]; +} + +// @public +export interface MapNodes { + clientGroups?: ClientGroup[]; + machines?: Machine[]; + ports?: Port[]; + processes?: Process[]; +} + +// @public +export interface MapRequest { + endTime?: Date; + kind: "map:single-machine-dependency" | "MultipleMachinesMapRequest" | "map:machine-list-dependency" | "map:machine-group-dependency"; + startTime?: Date; +} + +// @public +export type MapRequestKind = string; + +// @public (undocumented) +export type MapRequestUnion = MapRequest | SingleMachineDependencyMapRequest | MultipleMachinesMapRequestUnion; + +// @public +export interface MapResponse { + endTime: Date; + map: Map_2; + startTime: Date; +} + +// @public +export interface Maps { + generate(resourceGroupName: string, workspaceName: string, request: MapRequestUnion, options?: MapsGenerateOptionalParams): Promise; +} + +// @public +export interface MapsGenerateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type MapsGenerateResponse = MapResponse; + +// @public +export type MonitoringState = "monitored" | "discovered"; + +// @public +export type MultipleMachinesMapRequest = MapRequest & { + kind: "MultipleMachinesMapRequest" | "map:machine-list-dependency" | "map:machine-group-dependency"; + filterProcesses?: boolean; +}; + +// @public (undocumented) +export type MultipleMachinesMapRequestUnion = MultipleMachinesMapRequest | MachineListMapRequest | MachineGroupMapRequest; + +// @public +export interface NetworkConfiguration { + defaultIpv4Gateways?: string[]; + dnsNames?: string[]; + ipv4Interfaces?: Ipv4NetworkInterface[]; + ipv6Interfaces?: Ipv6NetworkInterface[]; + macAddresses?: string[]; +} + +// @public +export interface OperatingSystemConfiguration { + bitness: Bitness; + family: OperatingSystemFamily; + fullName: string; +} + +// @public +export type OperatingSystemFamily = "unknown" | "windows" | "linux" | "solaris" | "aix"; + +// @public +export type Port = CoreResource & { + monitoringState?: MonitoringState; + machine?: ResourceReferenceUnion; + displayName?: string; + ipAddress?: string; + portNumber?: number; +}; + +// @public +export interface PortCollection { + nextLink?: string; + value?: Port[]; +} + +// @public +export type PortReference = ResourceReference & { + kind: "ref:port"; + readonly machine?: MachineReference; + readonly ipAddress?: string; + portNumber?: number; +}; + +// @public +export interface Ports { + get(resourceGroupName: string, workspaceName: string, machineName: string, portName: string, options?: PortsGetOptionalParams): Promise; + getLiveness(resourceGroupName: string, workspaceName: string, machineName: string, portName: string, options?: PortsGetLivenessOptionalParams): Promise; + listAcceptingProcesses(resourceGroupName: string, workspaceName: string, machineName: string, portName: string, options?: PortsListAcceptingProcessesOptionalParams): PagedAsyncIterableIterator; + listConnections(resourceGroupName: string, workspaceName: string, machineName: string, portName: string, options?: PortsListConnectionsOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface PortsGetLivenessOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type PortsGetLivenessResponse = Liveness; + +// @public +export interface PortsGetOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type PortsGetResponse = Port; + +// @public +export interface PortsListAcceptingProcessesNextOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type PortsListAcceptingProcessesNextResponse = ProcessCollection; + +// @public +export interface PortsListAcceptingProcessesOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type PortsListAcceptingProcessesResponse = ProcessCollection; + +// @public +export interface PortsListConnectionsNextOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type PortsListConnectionsNextResponse = ConnectionCollection; + +// @public +export interface PortsListConnectionsOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type PortsListConnectionsResponse = ConnectionCollection; + +// @public +export type Process = CoreResource & { + timestamp?: Date; + monitoringState?: MonitoringState; + machine?: ResourceReferenceUnion; + executableName?: string; + displayName?: string; + startTime?: Date; + role?: ProcessRole; + group?: string; + details?: ProcessDetails; + user?: ProcessUser; + clientOf?: ResourceReferenceUnion; + acceptorOf?: ResourceReferenceUnion; + hosting?: ProcessHostingConfigurationUnion; +}; + +// @public +export interface ProcessCollection { + nextLink?: string; + value?: Process[]; +} + +// @public +export interface ProcessDetails { + commandLine?: string; + companyName?: string; + description?: string; + executablePath?: string; + fileVersion?: string; + firstPid?: number; + internalName?: string; + persistentKey?: string; + poolId?: number; + productName?: string; + productVersion?: string; + services?: ProcessHostedService[]; + workingDirectory?: string; + zoneName?: string; +} + +// @public +export interface Processes { + get(resourceGroupName: string, workspaceName: string, machineName: string, processName: string, options?: ProcessesGetOptionalParams): Promise; + getLiveness(resourceGroupName: string, workspaceName: string, machineName: string, processName: string, options?: ProcessesGetLivenessOptionalParams): Promise; + listAcceptingPorts(resourceGroupName: string, workspaceName: string, machineName: string, processName: string, options?: ProcessesListAcceptingPortsOptionalParams): PagedAsyncIterableIterator; + listConnections(resourceGroupName: string, workspaceName: string, machineName: string, processName: string, options?: ProcessesListConnectionsOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ProcessesGetLivenessOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type ProcessesGetLivenessResponse = Liveness; + +// @public +export interface ProcessesGetOptionalParams extends coreClient.OperationOptions { + timestamp?: Date; +} + +// @public +export type ProcessesGetResponse = Process; + +// @public +export interface ProcessesListAcceptingPortsNextOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type ProcessesListAcceptingPortsNextResponse = PortCollection; + +// @public +export interface ProcessesListAcceptingPortsOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type ProcessesListAcceptingPortsResponse = PortCollection; + +// @public +export interface ProcessesListConnectionsNextOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type ProcessesListConnectionsNextResponse = ConnectionCollection; + +// @public +export interface ProcessesListConnectionsOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type ProcessesListConnectionsResponse = ConnectionCollection; + +// @public +export interface ProcessHostedService { + displayName?: string; + name?: string; +} + +// @public +export interface ProcessHostingConfiguration { + kind: "provider:azure"; + provider?: "azure"; +} + +// @public (undocumented) +export type ProcessHostingConfigurationUnion = ProcessHostingConfiguration | AzureProcessHostingConfiguration; + +// @public +export type ProcessReference = ResourceReference & { + kind: "ref:process"; + readonly machine?: MachineReference; +}; + +// @public +export type ProcessRole = string; + +// @public +export interface ProcessUser { + userDomain?: string; + userName?: string; +} + +// @public +export type Relationship = Resource & { + kind: RelationshipKind; +}; + +// @public +export type RelationshipKind = string; + +// @public +export interface RelationshipProperties { + destination: ResourceReferenceUnion; + endTime?: Date; + source: ResourceReferenceUnion; + startTime?: Date; +} + +// @public (undocumented) +export type RelationshipUnion = Relationship | Connection | Acceptor; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +// @public +export interface ResourceReference { + id: string; + kind: "ref:machine" | "ref:port" | "ref:machinewithhints" | "ref:process" | "ref:clientgroup"; + readonly name?: string; + readonly type?: string; +} + +// @public +export type ResourceReferenceKind = string; + +// @public (undocumented) +export type ResourceReferenceUnion = ResourceReference | MachineReference | PortReference | MachineReferenceWithHints | ProcessReference | ClientGroupReference; + +// @public (undocumented) +export class ServiceMap extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: ServiceMapOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + clientGroups: ClientGroups; + // (undocumented) + machineGroups: MachineGroups; + // (undocumented) + machines: Machines; + // (undocumented) + maps: Maps; + // (undocumented) + ports: Ports; + // (undocumented) + processes: Processes; + // (undocumented) + subscriptionId: string; + // (undocumented) + summaries: Summaries; +} + +// @public +export interface ServiceMapOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export type SingleMachineDependencyMapRequest = MapRequest & { + kind: "map:single-machine-dependency"; + machineId: string; +}; + +// @public +export interface Summaries { + getMachines(resourceGroupName: string, workspaceName: string, options?: SummariesGetMachinesOptionalParams): Promise; +} + +// @public +export interface SummariesGetMachinesOptionalParams extends coreClient.OperationOptions { + endTime?: Date; + startTime?: Date; +} + +// @public +export type SummariesGetMachinesResponse = MachinesSummary; + +// @public +export type Summary = Resource & {}; + +// @public +export interface SummaryProperties { + endTime: Date; + startTime: Date; +} + +// @public +export interface Timezone { + fullName?: string; +} + +// @public +export type VirtualizationState = "unknown" | "physical" | "virtual" | "hypervisor"; + +// @public +export interface VirtualMachineConfiguration { + nativeHostMachineId?: string; + nativeMachineId?: string; + virtualMachineName?: string; + virtualMachineType?: VirtualMachineType; +} + +// @public +export type VirtualMachineType = "unknown" | "hyperv" | "ldom" | "lpar" | "vmware" | "virtualPc" | "xen"; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/service-map/arm-servicemap/rollup.config.js b/sdk/service-map/arm-servicemap/rollup.config.js index cffa953c5b0..9be1955eb7f 100644 --- a/sdk/service-map/arm-servicemap/rollup.config.js +++ b/sdk/service-map/arm-servicemap/rollup.config.js @@ -1,37 +1,188 @@ -import rollup from "rollup"; -import nodeResolve from "rollup-plugin-node-resolve"; -import sourcemaps from "rollup-plugin-sourcemaps"; - -/** - * @type {rollup.RollupFileOptions} - */ -const config = { - input: "./esm/servicemapManagementClient.js", - external: [ - "@azure/ms-rest-js", - "@azure/ms-rest-azure-js" - ], - output: { - file: "./dist/arm-servicemap.js", - format: "umd", - name: "Azure.ArmServicemap", - sourcemap: true, - globals: { - "@azure/ms-rest-js": "msRest", - "@azure/ms-rest-azure-js": "msRestAzure" - }, - banner: `/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */` - }, - plugins: [ - nodeResolve({ module: true }), - sourcemaps() - ] + */ + +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"; + +/** + * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. + * + * NOTE: this manual configuration is only needed because OpenTelemetry uses an + * __exportStar downleveled helper function to declare its exports which confuses + * rollup's automatic discovery mechanism. + * + * @returns an object reference that can be `...`'d into your cjs() configuration. + */ +export function openTelemetryCommonJs() { + const namedExports = {}; + + for (const key of [ + "@opentelemetry/api", + "@azure/core-tracing/node_modules/@opentelemetry/api" + ]) { + namedExports[key] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "SpanStatusCode", + "getSpanContext", + "setSpanContext" + ]; + } + + const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; + + for (const version of releasedOpenTelemetryVersions) { + namedExports[ + // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. + `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` + ] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "StatusCode", + "CanonicalCode", + "getSpanContext", + "setSpanContext" + ]; + } + + return namedExports; +} + +// #region Warning Handler + +/** + * A function that can determine whether a rollupwarning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEvalWarnings(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependencyWarnings(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ + ignoreChaiCircularDependencyWarnings, + ignoreNiseSinonEvalWarnings +]; + +/** + * 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({ + namedExports: { + // Chai's strange internal architecture makes it impossible to statically + // analyze its exports. + chai: [ + "version", + "use", + "util", + "config", + "expect", + "should", + "assert" + ], + ...openTelemetryCommonJs() + } + }), + 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 default config; +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(), cjs()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/service-map/arm-servicemap/sample.env b/sdk/service-map/arm-servicemap/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/service-map/arm-servicemap/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/service-map/arm-servicemap/samples-dev/smClientGroupsGet.ts b/sdk/service-map/arm-servicemap/samples-dev/smClientGroupsGet.ts new file mode 100644 index 00000000000..4142a991048 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smClientGroupsGet.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Retrieves the specified client group + * + * @summary Retrieves the specified client group + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/ClientGroups/SMClientGroupsGetGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smClientGroupsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const clientGroupName = + "m!m-A4AB1C69-03E9-42D2-B822-B42555569FB4!b!b-c0a8010a_10000"; + const startTime = new Date("2018-01-08T21:26:53.7181136Z"); + const endTime = new Date("2018-01-08T21:28:53.7181136Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.clientGroups.get( + resourceGroupName, + workspaceName, + clientGroupName, + options + ); + console.log(result); +} + +smClientGroupsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smClientGroupsGetMembersCountGet.ts b/sdk/service-map/arm-servicemap/samples-dev/smClientGroupsGetMembersCountGet.ts new file mode 100644 index 00000000000..2c76a3066f7 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smClientGroupsGetMembersCountGet.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns the approximate number of members in the client group. + * + * @summary Returns the approximate number of members in the client group. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/ClientGroups/SMClientGroupsGetMembersCountGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smClientGroupsGetMembersCountGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const clientGroupName = + "m!m-12bc33c3-31ad-42e0-a08b-bd1c2531776b!b!b-c0a8010a_8000"; + const startTime = new Date("2018-01-08T21:51:48.301Z"); + const endTime = new Date("2018-01-08T21:52:03.301Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.clientGroups.getMembersCount( + resourceGroupName, + workspaceName, + clientGroupName, + options + ); + console.log(result); +} + +smClientGroupsGetMembersCountGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smClientGroupsListMembersGet.ts b/sdk/service-map/arm-servicemap/samples-dev/smClientGroupsListMembersGet.ts new file mode 100644 index 00000000000..f16a0ea55d2 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smClientGroupsListMembersGet.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns the members of the client group during the specified time interval. + * + * @summary Returns the members of the client group during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/ClientGroups/SMClientGroupsListMembersGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smClientGroupsListMembersGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const clientGroupName = + "m!m-12bc33c3-31ad-42e0-a08b-bd1c2531776b!b!b-c0a8010a_8000"; + const startTime = new Date("2018-01-08T21:51:48.301Z"); + const endTime = new Date("2018-01-08T21:52:03.301Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.clientGroups.listMembers( + resourceGroupName, + workspaceName, + clientGroupName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smClientGroupsListMembersGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMachineGroupsCreatePost.ts b/sdk/service-map/arm-servicemap/samples-dev/smMachineGroupsCreatePost.ts new file mode 100644 index 00000000000..f8336d6e878 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMachineGroupsCreatePost.ts @@ -0,0 +1,47 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates a new machine group. + * + * @summary Creates a new machine group. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsCreatePost.json + */ +import { MachineGroup, ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachineGroupsCreatePost() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineGroup: MachineGroup = { + count: 1, + displayName: "Foo", + etag: "e20e75b5-5765-48a5-9503-9d1b7fd20925", + kind: "machineGroup", + machines: [ + { + id: + "/subscriptions/63BE4E24-FDF0-4E9C-9342-6A5D5A359722/resourceGroups/rg-sm/providers/Microsoft.OperationalInsights/workspaces/D6F79F14-E563-469B-84B5-9286D2803B2F/machines/m-2f2506f5-cf18-4dc6-98ba-d84ce2610ae0", + kind: "ref:machinewithhints" + } + ] + }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.machineGroups.create( + resourceGroupName, + workspaceName, + machineGroup + ); + console.log(result); +} + +smMachineGroupsCreatePost().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMachineGroupsDelete.ts b/sdk/service-map/arm-servicemap/samples-dev/smMachineGroupsDelete.ts new file mode 100644 index 00000000000..31ce14f52b1 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMachineGroupsDelete.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Deletes the specified Machine Group. + * + * @summary Deletes the specified Machine Group. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsDeleteDelete.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachineGroupsDelete() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineGroupName = "ccfbf4bf-dc08-4371-9e9b-00a8d875d45a"; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.machineGroups.delete( + resourceGroupName, + workspaceName, + machineGroupName + ); + console.log(result); +} + +smMachineGroupsDelete().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMachineGroupsGet.ts b/sdk/service-map/arm-servicemap/samples-dev/smMachineGroupsGet.ts new file mode 100644 index 00000000000..cd20387a3ff --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMachineGroupsGet.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns the specified machine group as it existed during the specified time interval. + * + * @summary Returns the specified machine group as it existed during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsGetGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachineGroupsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineGroupName = "07597c56-5395-4815-839c-c4e7bddbac18"; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.machineGroups.get( + resourceGroupName, + workspaceName, + machineGroupName + ); + console.log(result); +} + +smMachineGroupsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMachineGroupsListByWorkspaceGet.ts b/sdk/service-map/arm-servicemap/samples-dev/smMachineGroupsListByWorkspaceGet.ts new file mode 100644 index 00000000000..8e5b6e98d66 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMachineGroupsListByWorkspaceGet.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns all machine groups during the specified time interval. + * + * @summary Returns all machine groups during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsListByWorkspaceGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachineGroupsListByWorkspaceGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const startTime = new Date("2018-01-08T19:17:49.333139Z"); + const endTime = new Date("2018-01-08T19:19:49.333139Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.machineGroups.listByWorkspace( + resourceGroupName, + workspaceName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachineGroupsListByWorkspaceGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMachineGroupsUpdatePut.ts b/sdk/service-map/arm-servicemap/samples-dev/smMachineGroupsUpdatePut.ts new file mode 100644 index 00000000000..2a2b0dad20f --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMachineGroupsUpdatePut.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Updates a machine group. + * + * @summary Updates a machine group. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsUpdatePut.json + */ +import { MachineGroup, ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachineGroupsUpdatePut() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineGroupName = "ccfbf4bf-dc08-4371-9e9b-00a8d875d45a"; + const machineGroup: MachineGroup = { + count: 1, + displayName: "Foo", + etag: "8cd3a8a1-4b1f-43fc-ae3c-b2c092561444", + kind: "machineGroup", + machines: [ + { + id: + "/subscriptions/63BE4E24-FDF0-4E9C-9342-6A5D5A359722/resourceGroups/rg-sm/providers/Microsoft.OperationalInsights/workspaces/D6F79F14-E563-469B-84B5-9286D2803B2F/machines/m-0fe4b501-7ac9-41d7-a4e1-1591a0789519", + kind: "ref:machinewithhints" + } + ] + }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.machineGroups.update( + resourceGroupName, + workspaceName, + machineGroupName, + machineGroup + ); + console.log(result); +} + +smMachineGroupsUpdatePut().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMachinesGet.ts b/sdk/service-map/arm-servicemap/samples-dev/smMachinesGet.ts new file mode 100644 index 00000000000..df5fe93ea2a --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMachinesGet.ts @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns the specified machine. + * + * @summary Returns the specified machine. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/SMMachinesGetGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-A4AB1C69-03E9-42D2-B822-B42555569FB4"; + const timestamp = new Date("2018-01-07T07:01:16.1556059Z"); + const options = { timestamp: timestamp }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.machines.get( + resourceGroupName, + workspaceName, + machineName, + options + ); + console.log(result); +} + +smMachinesGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMachinesGetLivenessGet.ts b/sdk/service-map/arm-servicemap/samples-dev/smMachinesGetLivenessGet.ts new file mode 100644 index 00000000000..45c94d482c0 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMachinesGetLivenessGet.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Obtains the liveness status of the machine during the specified time interval. + * + * @summary Obtains the liveness status of the machine during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/SMMachinesGetLivenessGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesGetLivenessGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-A4AB1C69-03E9-42D2-B822-B42555569FB4"; + const startTime = new Date("2018-01-07T07:07:27.6026938Z"); + const endTime = new Date("2018-01-07T07:09:27.6026938Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.machines.getLiveness( + resourceGroupName, + workspaceName, + machineName, + options + ); + console.log(result); +} + +smMachinesGetLivenessGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMachinesListByWorkspaceGet.ts b/sdk/service-map/arm-servicemap/samples-dev/smMachinesListByWorkspaceGet.ts new file mode 100644 index 00000000000..6fa22c6e11e --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMachinesListByWorkspaceGet.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of machines matching the specified conditions. The returned collection represents either machines that are active/live during the specified interval of time (`live=true` and `startTime`/`endTime` are specified) or that are known to have existed at or some time prior to the specified point in time (`live=false` and `timestamp` is specified). + * + * @summary Returns a collection of machines matching the specified conditions. The returned collection represents either machines that are active/live during the specified interval of time (`live=true` and `startTime`/`endTime` are specified) or that are known to have existed at or some time prior to the specified point in time (`live=false` and `timestamp` is specified). + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/SMMachinesListByWorkspaceGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesListByWorkspaceGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const live = false; + const timestamp = new Date("2018-01-05T21:36:07.009Z"); + const options = { live: live, timestamp: timestamp }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.machines.listByWorkspace( + resourceGroupName, + workspaceName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesListByWorkspaceGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMachinesListConnectionsGet.ts b/sdk/service-map/arm-servicemap/samples-dev/smMachinesListConnectionsGet.ts new file mode 100644 index 00000000000..c0d69c307f1 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMachinesListConnectionsGet.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of connections terminating or originating at the specified machine + * + * @summary Returns a collection of connections terminating or originating at the specified machine + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/SMMachinesListConnectionsGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesListConnectionsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-A4AB1C69-03E9-42D2-B822-B42555569FB4"; + const startTime = new Date("2018-01-07T07:31:38.4041029Z"); + const endTime = new Date("2018-01-07T07:31:38.4041029Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.machines.listConnections( + resourceGroupName, + workspaceName, + machineName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesListConnectionsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMachinesListMachineGroupMembershipGet.ts b/sdk/service-map/arm-servicemap/samples-dev/smMachinesListMachineGroupMembershipGet.ts new file mode 100644 index 00000000000..ecdaa7dcee0 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMachinesListMachineGroupMembershipGet.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of machine groups this machine belongs to during the specified time interval. + * + * @summary Returns a collection of machine groups this machine belongs to during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/MachineGroups/SMMachinesListMachineGroupMembershipGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesListMachineGroupMembershipGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-A4AB1C69-03E9-42D2-B822-B42555569FB4"; + const startTime = new Date("2018-01-08T19:17:49.333139Z"); + const endTime = new Date("2018-01-08T19:19:49.333139Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.machines.listMachineGroupMembership( + resourceGroupName, + workspaceName, + machineName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesListMachineGroupMembershipGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMachinesListPortsGet.ts b/sdk/service-map/arm-servicemap/samples-dev/smMachinesListPortsGet.ts new file mode 100644 index 00000000000..7304b012d80 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMachinesListPortsGet.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of live ports on the specified machine during the specified time interval. + * + * @summary Returns a collection of live ports on the specified machine during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesListPortsGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesListPortsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-999066c5-38c5-4f2f-9ce0-51d738cdc432"; + const startTime = new Date("2018-01-07T08:01:48.525Z"); + const endTime = new Date("2018-01-07T08:01:48.525Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.machines.listPorts( + resourceGroupName, + workspaceName, + machineName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesListPortsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMachinesListProcessesGet.ts b/sdk/service-map/arm-servicemap/samples-dev/smMachinesListProcessesGet.ts new file mode 100644 index 00000000000..2f1b640b51e --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMachinesListProcessesGet.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of processes on the specified machine matching the specified conditions. The returned collection represents either processes that are active/live during the specified interval of time (`live=true` and `startTime`/`endTime` are specified) or that are known to have existed at or some time prior to the specified point in time (`live=false` and `timestamp` is specified). + * + * @summary Returns a collection of processes on the specified machine matching the specified conditions. The returned collection represents either processes that are active/live during the specified interval of time (`live=true` and `startTime`/`endTime` are specified) or that are known to have existed at or some time prior to the specified point in time (`live=false` and `timestamp` is specified). + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesListProcessesGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesListProcessesGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-36b83664-0822-4fb3-99a3-8332754f3eae"; + const live = false; + const timestamp = new Date("2018-01-07T07:45:45.1930000Z"); + const options = { live: live, timestamp: timestamp }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.machines.listProcesses( + resourceGroupName, + workspaceName, + machineName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesListProcessesGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMachinesPortsGet.ts b/sdk/service-map/arm-servicemap/samples-dev/smMachinesPortsGet.ts new file mode 100644 index 00000000000..25acb84faa5 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMachinesPortsGet.ts @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns the specified port. The port must be live during the specified time interval. If the port is not live during the interval, status 404 (Not Found) is returned. + * + * @summary Returns the specified port. The port must be live during the specified time interval. If the port is not live during the interval, status 404 (Not Found) is returned. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesPortsGetGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesPortsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-999066c5-38c5-4f2f-9ce0-51d738cdc432"; + const portName = "b-c0a80101_8000"; + const startTime = new Date("2018-01-07T08:01:48.525Z"); + const endTime = new Date("2018-01-07T08:01:48.525Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.ports.get( + resourceGroupName, + workspaceName, + machineName, + portName, + options + ); + console.log(result); +} + +smMachinesPortsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMachinesPortsGetLivenessGet.ts b/sdk/service-map/arm-servicemap/samples-dev/smMachinesPortsGetLivenessGet.ts new file mode 100644 index 00000000000..3f6698b4355 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMachinesPortsGetLivenessGet.ts @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Obtains the liveness status of the port during the specified time interval. + * + * @summary Obtains the liveness status of the port during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesPortsGetLivenessGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesPortsGetLivenessGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-999066c5-38c5-4f2f-9ce0-51d738cdc432"; + const portName = "b-c0a80101_8000"; + const startTime = new Date("2018-01-07T08:01:48.525Z"); + const endTime = new Date("2018-01-07T08:01:48.525Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.ports.getLiveness( + resourceGroupName, + workspaceName, + machineName, + portName, + options + ); + console.log(result); +} + +smMachinesPortsGetLivenessGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMachinesPortsListAcceptingProcessesGet.ts b/sdk/service-map/arm-servicemap/samples-dev/smMachinesPortsListAcceptingProcessesGet.ts new file mode 100644 index 00000000000..517837eff89 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMachinesPortsListAcceptingProcessesGet.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of processes accepting on the specified port + * + * @summary Returns a collection of processes accepting on the specified port + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesPortsListAcceptingProcessesGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesPortsListAcceptingProcessesGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-1bc28d72-0e81-4aff-b1e3-ae12e8da155e"; + const portName = "b-c0a80101_8000"; + const startTime = new Date("2018-01-08T18:37:39.936Z"); + const endTime = new Date("2018-01-08T18:37:54.936Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.ports.listAcceptingProcesses( + resourceGroupName, + workspaceName, + machineName, + portName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesPortsListAcceptingProcessesGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMachinesPortsListConnectionsGet.ts b/sdk/service-map/arm-servicemap/samples-dev/smMachinesPortsListConnectionsGet.ts new file mode 100644 index 00000000000..7831a627823 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMachinesPortsListConnectionsGet.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of connections established via the specified port. + * + * @summary Returns a collection of connections established via the specified port. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesPortsListConnectionsGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesPortsListConnectionsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-A4AB1C69-03E9-42D2-B822-B42555569FB4"; + const portName = "b-c0a8010a_10000"; + const startTime = new Date("2018-01-08T23:05:16.7985488Z"); + const endTime = new Date("2018-01-08T23:07:16.7985488Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.ports.listConnections( + resourceGroupName, + workspaceName, + machineName, + portName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesPortsListConnectionsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMachinesProcessesGet.ts b/sdk/service-map/arm-servicemap/samples-dev/smMachinesProcessesGet.ts new file mode 100644 index 00000000000..3c326008426 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMachinesProcessesGet.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns the specified process. + * + * @summary Returns the specified process. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesProcessesGetGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesProcessesGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-36b83664-0822-4fb3-99a3-8332754f3eae"; + const processName = "p-bbf99526b8fc5e7ee4f75568958a040d08489160"; + const timestamp = new Date("2018-01-10T22:45:45.1930000Z"); + const options = { timestamp: timestamp }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.processes.get( + resourceGroupName, + workspaceName, + machineName, + processName, + options + ); + console.log(result); +} + +smMachinesProcessesGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMachinesProcessesGetLivenessGet.ts b/sdk/service-map/arm-servicemap/samples-dev/smMachinesProcessesGetLivenessGet.ts new file mode 100644 index 00000000000..42acfb46d25 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMachinesProcessesGetLivenessGet.ts @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Obtains the liveness status of the process during the specified time interval. + * + * @summary Obtains the liveness status of the process during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesProcessesGetLivenessGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesProcessesGetLivenessGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-36b83664-0822-4fb3-99a3-8332754f3eae"; + const processName = "p-bbf99526b8fc5e7ee4f75568958a040d08489160"; + const startTime = new Date("2018-01-07T07:07:27.6026938Z"); + const endTime = new Date("2018-01-07T07:09:27.6026938Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.processes.getLiveness( + resourceGroupName, + workspaceName, + machineName, + processName, + options + ); + console.log(result); +} + +smMachinesProcessesGetLivenessGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMachinesProcessesListAcceptingPortsGet.ts b/sdk/service-map/arm-servicemap/samples-dev/smMachinesProcessesListAcceptingPortsGet.ts new file mode 100644 index 00000000000..ba696b14de6 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMachinesProcessesListAcceptingPortsGet.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of ports on which this process is accepting + * + * @summary Returns a collection of ports on which this process is accepting + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesProcessesListAcceptingPortsGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesProcessesListAcceptingPortsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-999066c5-38c5-4f2f-9ce0-51d738cdc432"; + const processName = "p-37d1761114556be465c44e2300bda03178a6189e"; + const startTime = new Date("2018-01-07T08:01:48.525Z"); + const endTime = new Date("2018-01-07T08:01:48.525Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.processes.listAcceptingPorts( + resourceGroupName, + workspaceName, + machineName, + processName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesProcessesListAcceptingPortsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMachinesProcessesListConnectionsGet.ts b/sdk/service-map/arm-servicemap/samples-dev/smMachinesProcessesListConnectionsGet.ts new file mode 100644 index 00000000000..c574e7c502c --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMachinesProcessesListConnectionsGet.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of connections terminating or originating at the specified process + * + * @summary Returns a collection of connections terminating or originating at the specified process + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesProcessesListConnectionsGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesProcessesListConnectionsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-A4AB1C69-03E9-42D2-B822-B42555569FB4"; + const processName = "p-f1dd514e73cda65d9a19a977aa4a9f6959427ab0"; + const startTime = new Date("2018-01-07T08:09:15.1682041Z"); + const endTime = new Date("2018-01-07T08:11:15.1682041Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.processes.listConnections( + resourceGroupName, + workspaceName, + machineName, + processName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesProcessesListConnectionsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMapsGenerateMachineGroupDependencyPost.ts b/sdk/service-map/arm-servicemap/samples-dev/smMapsGenerateMachineGroupDependencyPost.ts new file mode 100644 index 00000000000..3e59180f9e9 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMapsGenerateMachineGroupDependencyPost.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Generates the specified map. + * + * @summary Generates the specified map. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Maps/SMMapsGenerateMachineGroupDependencyPost.json + */ +import { MachineGroupMapRequest, ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMapsGenerateMachineGroupDependencyPost() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const request: MachineGroupMapRequest = { + endTime: new Date("2018-01-08T20:01:06.325Z"), + filterProcesses: false, + kind: "map:machine-group-dependency", + machineGroupId: + "/subscriptions/63BE4E24-FDF0-4E9C-9342-6A5D5A359722/resourceGroups/rg-sm/providers/Microsoft.OperationalInsights/workspaces/D6F79F14-E563-469B-84B5-9286D2803B2F/machineGroups/b90f6d8f-a9b9-4ac6-abeb-abd8fe10a6dc", + startTime: new Date("2018-01-08T20:00:51.325Z") + }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.maps.generate( + resourceGroupName, + workspaceName, + request + ); + console.log(result); +} + +smMapsGenerateMachineGroupDependencyPost().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMapsGenerateMachineListDependencyPost.ts b/sdk/service-map/arm-servicemap/samples-dev/smMapsGenerateMachineListDependencyPost.ts new file mode 100644 index 00000000000..87004af34e2 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMapsGenerateMachineListDependencyPost.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Generates the specified map. + * + * @summary Generates the specified map. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Maps/SMMapsGenerateMachineListDependencyPost.json + */ +import { MachineListMapRequest, ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMapsGenerateMachineListDependencyPost() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const request: MachineListMapRequest = { + endTime: new Date("2018-01-08T20:08:04.78Z"), + filterProcesses: false, + kind: "map:machine-list-dependency", + machineIds: [ + "/subscriptions/63BE4E24-FDF0-4E9C-9342-6A5D5A359722/resourceGroups/rg-sm/providers/Microsoft.OperationalInsights/workspaces/D6F79F14-E563-469B-84B5-9286D2803B2F/machines/m-d60cf4c2-047a-408e-a5ff-cf3d77928c9f", + "/subscriptions/63BE4E24-FDF0-4E9C-9342-6A5D5A359722/resourceGroups/rg-sm/providers/Microsoft.OperationalInsights/workspaces/D6F79F14-E563-469B-84B5-9286D2803B2F/machines/m-52d4f2f9-e684-4003-a774-9cf99898861b" + ], + startTime: new Date("2018-01-08T20:07:49.78Z") + }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.maps.generate( + resourceGroupName, + workspaceName, + request + ); + console.log(result); +} + +smMapsGenerateMachineListDependencyPost().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smMapsGenerateSingleMachineDependencyPost.ts b/sdk/service-map/arm-servicemap/samples-dev/smMapsGenerateSingleMachineDependencyPost.ts new file mode 100644 index 00000000000..1adb2ab8883 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smMapsGenerateSingleMachineDependencyPost.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Generates the specified map. + * + * @summary Generates the specified map. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Maps/SMMapsGenerateSingleMachineDependencyPost.json + */ +import { + SingleMachineDependencyMapRequest, + ServiceMap +} from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMapsGenerateSingleMachineDependencyPost() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const request: SingleMachineDependencyMapRequest = { + endTime: new Date("2018-01-08T19:52:39.0192315Z"), + kind: "map:single-machine-dependency", + machineId: + "/subscriptions/63BE4E24-FDF0-4E9C-9342-6A5D5A359722/resourceGroups/rg-sm/providers/Microsoft.OperationalInsights/workspaces/D6F79F14-E563-469B-84B5-9286D2803B2F/machines/m-A4AB1C69-03E9-42D2-B822-B42555569FB4", + startTime: new Date("2018-01-08T19:50:39.0192315Z") + }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.maps.generate( + resourceGroupName, + workspaceName, + request + ); + console.log(result); +} + +smMapsGenerateSingleMachineDependencyPost().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples-dev/smSummariesGetMachinesGet.ts b/sdk/service-map/arm-servicemap/samples-dev/smSummariesGetMachinesGet.ts new file mode 100644 index 00000000000..fd694921d5c --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples-dev/smSummariesGetMachinesGet.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns summary information about the machines in the workspace. + * + * @summary Returns summary information about the machines in the workspace. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Summaries/SMSummariesGetMachinesGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smSummariesGetMachinesGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const startTime = new Date("2018-01-08T19:41:59.3360000Z"); + const endTime = new Date("2018-01-08T19:42:14.3360000Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.summaries.getMachines( + resourceGroupName, + workspaceName, + options + ); + console.log(result); +} + +smSummariesGetMachinesGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/README.md b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/README.md new file mode 100644 index 00000000000..495a52ecac9 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/README.md @@ -0,0 +1,102 @@ +# client library samples for JavaScript (Beta) + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [smClientGroupsGet.js][smclientgroupsget] | Retrieves the specified client group x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/ClientGroups/SMClientGroupsGetGet.json | +| [smClientGroupsGetMembersCountGet.js][smclientgroupsgetmemberscountget] | Returns the approximate number of members in the client group. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/ClientGroups/SMClientGroupsGetMembersCountGet.json | +| [smClientGroupsListMembersGet.js][smclientgroupslistmembersget] | Returns the members of the client group during the specified time interval. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/ClientGroups/SMClientGroupsListMembersGet.json | +| [smMachineGroupsCreatePost.js][smmachinegroupscreatepost] | Creates a new machine group. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsCreatePost.json | +| [smMachineGroupsDelete.js][smmachinegroupsdelete] | Deletes the specified Machine Group. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsDeleteDelete.json | +| [smMachineGroupsGet.js][smmachinegroupsget] | Returns the specified machine group as it existed during the specified time interval. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsGetGet.json | +| [smMachineGroupsListByWorkspaceGet.js][smmachinegroupslistbyworkspaceget] | Returns all machine groups during the specified time interval. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsListByWorkspaceGet.json | +| [smMachineGroupsUpdatePut.js][smmachinegroupsupdateput] | Updates a machine group. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsUpdatePut.json | +| [smMachinesGet.js][smmachinesget] | Returns the specified machine. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/SMMachinesGetGet.json | +| [smMachinesGetLivenessGet.js][smmachinesgetlivenessget] | Obtains the liveness status of the machine during the specified time interval. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/SMMachinesGetLivenessGet.json | +| [smMachinesListByWorkspaceGet.js][smmachineslistbyworkspaceget] | Returns a collection of machines matching the specified conditions. The returned collection represents either machines that are active/live during the specified interval of time (`live=true` and `startTime`/`endTime` are specified) or that are known to have existed at or some time prior to the specified point in time (`live=false` and `timestamp` is specified). x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/SMMachinesListByWorkspaceGet.json | +| [smMachinesListConnectionsGet.js][smmachineslistconnectionsget] | Returns a collection of connections terminating or originating at the specified machine x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/SMMachinesListConnectionsGet.json | +| [smMachinesListMachineGroupMembershipGet.js][smmachineslistmachinegroupmembershipget] | Returns a collection of machine groups this machine belongs to during the specified time interval. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/MachineGroups/SMMachinesListMachineGroupMembershipGet.json | +| [smMachinesListPortsGet.js][smmachineslistportsget] | Returns a collection of live ports on the specified machine during the specified time interval. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesListPortsGet.json | +| [smMachinesListProcessesGet.js][smmachineslistprocessesget] | Returns a collection of processes on the specified machine matching the specified conditions. The returned collection represents either processes that are active/live during the specified interval of time (`live=true` and `startTime`/`endTime` are specified) or that are known to have existed at or some time prior to the specified point in time (`live=false` and `timestamp` is specified). x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesListProcessesGet.json | +| [smMachinesPortsGet.js][smmachinesportsget] | Returns the specified port. The port must be live during the specified time interval. If the port is not live during the interval, status 404 (Not Found) is returned. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesPortsGetGet.json | +| [smMachinesPortsGetLivenessGet.js][smmachinesportsgetlivenessget] | Obtains the liveness status of the port during the specified time interval. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesPortsGetLivenessGet.json | +| [smMachinesPortsListAcceptingProcessesGet.js][smmachinesportslistacceptingprocessesget] | Returns a collection of processes accepting on the specified port x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesPortsListAcceptingProcessesGet.json | +| [smMachinesPortsListConnectionsGet.js][smmachinesportslistconnectionsget] | Returns a collection of connections established via the specified port. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesPortsListConnectionsGet.json | +| [smMachinesProcessesGet.js][smmachinesprocessesget] | Returns the specified process. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesProcessesGetGet.json | +| [smMachinesProcessesGetLivenessGet.js][smmachinesprocessesgetlivenessget] | Obtains the liveness status of the process during the specified time interval. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesProcessesGetLivenessGet.json | +| [smMachinesProcessesListAcceptingPortsGet.js][smmachinesprocesseslistacceptingportsget] | Returns a collection of ports on which this process is accepting x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesProcessesListAcceptingPortsGet.json | +| [smMachinesProcessesListConnectionsGet.js][smmachinesprocesseslistconnectionsget] | Returns a collection of connections terminating or originating at the specified process x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesProcessesListConnectionsGet.json | +| [smMapsGenerateMachineGroupDependencyPost.js][smmapsgeneratemachinegroupdependencypost] | Generates the specified map. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Maps/SMMapsGenerateMachineGroupDependencyPost.json | +| [smMapsGenerateMachineListDependencyPost.js][smmapsgeneratemachinelistdependencypost] | Generates the specified map. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Maps/SMMapsGenerateMachineListDependencyPost.json | +| [smMapsGenerateSingleMachineDependencyPost.js][smmapsgeneratesinglemachinedependencypost] | Generates the specified map. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Maps/SMMapsGenerateSingleMachineDependencyPost.json | +| [smSummariesGetMachinesGet.js][smsummariesgetmachinesget] | Returns summary information about the machines in the workspace. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Summaries/SMSummariesGetMachinesGet.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node smClientGroupsGet.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node smClientGroupsGet.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[smclientgroupsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smClientGroupsGet.js +[smclientgroupsgetmemberscountget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smClientGroupsGetMembersCountGet.js +[smclientgroupslistmembersget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smClientGroupsListMembersGet.js +[smmachinegroupscreatepost]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsCreatePost.js +[smmachinegroupsdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsDelete.js +[smmachinegroupsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsGet.js +[smmachinegroupslistbyworkspaceget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsListByWorkspaceGet.js +[smmachinegroupsupdateput]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsUpdatePut.js +[smmachinesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesGet.js +[smmachinesgetlivenessget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesGetLivenessGet.js +[smmachineslistbyworkspaceget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListByWorkspaceGet.js +[smmachineslistconnectionsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListConnectionsGet.js +[smmachineslistmachinegroupmembershipget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListMachineGroupMembershipGet.js +[smmachineslistportsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListPortsGet.js +[smmachineslistprocessesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListProcessesGet.js +[smmachinesportsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesPortsGet.js +[smmachinesportsgetlivenessget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesPortsGetLivenessGet.js +[smmachinesportslistacceptingprocessesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesPortsListAcceptingProcessesGet.js +[smmachinesportslistconnectionsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesPortsListConnectionsGet.js +[smmachinesprocessesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesProcessesGet.js +[smmachinesprocessesgetlivenessget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesProcessesGetLivenessGet.js +[smmachinesprocesseslistacceptingportsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesProcessesListAcceptingPortsGet.js +[smmachinesprocesseslistconnectionsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesProcessesListConnectionsGet.js +[smmapsgeneratemachinegroupdependencypost]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMapsGenerateMachineGroupDependencyPost.js +[smmapsgeneratemachinelistdependencypost]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMapsGenerateMachineListDependencyPost.js +[smmapsgeneratesinglemachinedependencypost]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMapsGenerateSingleMachineDependencyPost.js +[smsummariesgetmachinesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smSummariesGetMachinesGet.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-servicemap?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/service-map/arm-servicemap/README.md diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/package.json b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/package.json new file mode 100644 index 00000000000..0cfa441f4ae --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "azure-arm-servicemap-samples-js-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript (Beta)", + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/service-map/arm-servicemap" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/service-map/arm-servicemap", + "dependencies": { + "@azure/arm-servicemap": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/sample.env b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smClientGroupsGet.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smClientGroupsGet.js new file mode 100644 index 00000000000..728e115402a --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smClientGroupsGet.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Retrieves the specified client group + * + * @summary Retrieves the specified client group + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/ClientGroups/SMClientGroupsGetGet.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smClientGroupsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const clientGroupName = "m!m-A4AB1C69-03E9-42D2-B822-B42555569FB4!b!b-c0a8010a_10000"; + const startTime = new Date("2018-01-08T21:26:53.7181136Z"); + const endTime = new Date("2018-01-08T21:28:53.7181136Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.clientGroups.get( + resourceGroupName, + workspaceName, + clientGroupName, + options + ); + console.log(result); +} + +smClientGroupsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smClientGroupsGetMembersCountGet.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smClientGroupsGetMembersCountGet.js new file mode 100644 index 00000000000..d6a98c3959f --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smClientGroupsGetMembersCountGet.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns the approximate number of members in the client group. + * + * @summary Returns the approximate number of members in the client group. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/ClientGroups/SMClientGroupsGetMembersCountGet.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smClientGroupsGetMembersCountGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const clientGroupName = "m!m-12bc33c3-31ad-42e0-a08b-bd1c2531776b!b!b-c0a8010a_8000"; + const startTime = new Date("2018-01-08T21:51:48.301Z"); + const endTime = new Date("2018-01-08T21:52:03.301Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.clientGroups.getMembersCount( + resourceGroupName, + workspaceName, + clientGroupName, + options + ); + console.log(result); +} + +smClientGroupsGetMembersCountGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smClientGroupsListMembersGet.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smClientGroupsListMembersGet.js new file mode 100644 index 00000000000..705cbda4c37 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smClientGroupsListMembersGet.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns the members of the client group during the specified time interval. + * + * @summary Returns the members of the client group during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/ClientGroups/SMClientGroupsListMembersGet.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smClientGroupsListMembersGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const clientGroupName = "m!m-12bc33c3-31ad-42e0-a08b-bd1c2531776b!b!b-c0a8010a_8000"; + const startTime = new Date("2018-01-08T21:51:48.301Z"); + const endTime = new Date("2018-01-08T21:52:03.301Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.clientGroups.listMembers( + resourceGroupName, + workspaceName, + clientGroupName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smClientGroupsListMembersGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsCreatePost.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsCreatePost.js new file mode 100644 index 00000000000..d5ce9929033 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsCreatePost.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates a new machine group. + * + * @summary Creates a new machine group. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsCreatePost.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMachineGroupsCreatePost() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineGroup = { + count: 1, + displayName: "Foo", + etag: "e20e75b5-5765-48a5-9503-9d1b7fd20925", + kind: "machineGroup", + machines: [ + { + id: "/subscriptions/63BE4E24-FDF0-4E9C-9342-6A5D5A359722/resourceGroups/rg-sm/providers/Microsoft.OperationalInsights/workspaces/D6F79F14-E563-469B-84B5-9286D2803B2F/machines/m-2f2506f5-cf18-4dc6-98ba-d84ce2610ae0", + kind: "ref:machinewithhints", + }, + ], + }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.machineGroups.create(resourceGroupName, workspaceName, machineGroup); + console.log(result); +} + +smMachineGroupsCreatePost().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsDelete.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsDelete.js new file mode 100644 index 00000000000..9890b427442 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsDelete.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Deletes the specified Machine Group. + * + * @summary Deletes the specified Machine Group. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsDeleteDelete.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMachineGroupsDelete() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineGroupName = "ccfbf4bf-dc08-4371-9e9b-00a8d875d45a"; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.machineGroups.delete( + resourceGroupName, + workspaceName, + machineGroupName + ); + console.log(result); +} + +smMachineGroupsDelete().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsGet.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsGet.js new file mode 100644 index 00000000000..fad5c86007a --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsGet.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns the specified machine group as it existed during the specified time interval. + * + * @summary Returns the specified machine group as it existed during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsGetGet.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMachineGroupsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineGroupName = "07597c56-5395-4815-839c-c4e7bddbac18"; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.machineGroups.get(resourceGroupName, workspaceName, machineGroupName); + console.log(result); +} + +smMachineGroupsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsListByWorkspaceGet.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsListByWorkspaceGet.js new file mode 100644 index 00000000000..6af93409da4 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsListByWorkspaceGet.js @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns all machine groups during the specified time interval. + * + * @summary Returns all machine groups during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsListByWorkspaceGet.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMachineGroupsListByWorkspaceGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const startTime = new Date("2018-01-08T19:17:49.333139Z"); + const endTime = new Date("2018-01-08T19:19:49.333139Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.machineGroups.listByWorkspace( + resourceGroupName, + workspaceName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachineGroupsListByWorkspaceGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsUpdatePut.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsUpdatePut.js new file mode 100644 index 00000000000..85b4501c44c --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachineGroupsUpdatePut.js @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Updates a machine group. + * + * @summary Updates a machine group. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsUpdatePut.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMachineGroupsUpdatePut() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineGroupName = "ccfbf4bf-dc08-4371-9e9b-00a8d875d45a"; + const machineGroup = { + count: 1, + displayName: "Foo", + etag: "8cd3a8a1-4b1f-43fc-ae3c-b2c092561444", + kind: "machineGroup", + machines: [ + { + id: "/subscriptions/63BE4E24-FDF0-4E9C-9342-6A5D5A359722/resourceGroups/rg-sm/providers/Microsoft.OperationalInsights/workspaces/D6F79F14-E563-469B-84B5-9286D2803B2F/machines/m-0fe4b501-7ac9-41d7-a4e1-1591a0789519", + kind: "ref:machinewithhints", + }, + ], + }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.machineGroups.update( + resourceGroupName, + workspaceName, + machineGroupName, + machineGroup + ); + console.log(result); +} + +smMachineGroupsUpdatePut().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesGet.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesGet.js new file mode 100644 index 00000000000..f3585410995 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesGet.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns the specified machine. + * + * @summary Returns the specified machine. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/SMMachinesGetGet.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMachinesGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-A4AB1C69-03E9-42D2-B822-B42555569FB4"; + const timestamp = new Date("2018-01-07T07:01:16.1556059Z"); + const options = { timestamp: timestamp }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.machines.get(resourceGroupName, workspaceName, machineName, options); + console.log(result); +} + +smMachinesGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesGetLivenessGet.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesGetLivenessGet.js new file mode 100644 index 00000000000..a72cf6ebd2b --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesGetLivenessGet.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Obtains the liveness status of the machine during the specified time interval. + * + * @summary Obtains the liveness status of the machine during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/SMMachinesGetLivenessGet.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMachinesGetLivenessGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-A4AB1C69-03E9-42D2-B822-B42555569FB4"; + const startTime = new Date("2018-01-07T07:07:27.6026938Z"); + const endTime = new Date("2018-01-07T07:09:27.6026938Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.machines.getLiveness( + resourceGroupName, + workspaceName, + machineName, + options + ); + console.log(result); +} + +smMachinesGetLivenessGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListByWorkspaceGet.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListByWorkspaceGet.js new file mode 100644 index 00000000000..deeb3b740d3 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListByWorkspaceGet.js @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of machines matching the specified conditions. The returned collection represents either machines that are active/live during the specified interval of time (`live=true` and `startTime`/`endTime` are specified) or that are known to have existed at or some time prior to the specified point in time (`live=false` and `timestamp` is specified). + * + * @summary Returns a collection of machines matching the specified conditions. The returned collection represents either machines that are active/live during the specified interval of time (`live=true` and `startTime`/`endTime` are specified) or that are known to have existed at or some time prior to the specified point in time (`live=false` and `timestamp` is specified). + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/SMMachinesListByWorkspaceGet.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMachinesListByWorkspaceGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const live = false; + const timestamp = new Date("2018-01-05T21:36:07.009Z"); + const options = { live: live, timestamp: timestamp }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.machines.listByWorkspace( + resourceGroupName, + workspaceName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesListByWorkspaceGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListConnectionsGet.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListConnectionsGet.js new file mode 100644 index 00000000000..5a46c9e5894 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListConnectionsGet.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of connections terminating or originating at the specified machine + * + * @summary Returns a collection of connections terminating or originating at the specified machine + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/SMMachinesListConnectionsGet.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMachinesListConnectionsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-A4AB1C69-03E9-42D2-B822-B42555569FB4"; + const startTime = new Date("2018-01-07T07:31:38.4041029Z"); + const endTime = new Date("2018-01-07T07:31:38.4041029Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.machines.listConnections( + resourceGroupName, + workspaceName, + machineName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesListConnectionsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListMachineGroupMembershipGet.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListMachineGroupMembershipGet.js new file mode 100644 index 00000000000..3f4590cb581 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListMachineGroupMembershipGet.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of machine groups this machine belongs to during the specified time interval. + * + * @summary Returns a collection of machine groups this machine belongs to during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/MachineGroups/SMMachinesListMachineGroupMembershipGet.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMachinesListMachineGroupMembershipGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-A4AB1C69-03E9-42D2-B822-B42555569FB4"; + const startTime = new Date("2018-01-08T19:17:49.333139Z"); + const endTime = new Date("2018-01-08T19:19:49.333139Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.machines.listMachineGroupMembership( + resourceGroupName, + workspaceName, + machineName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesListMachineGroupMembershipGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListPortsGet.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListPortsGet.js new file mode 100644 index 00000000000..fee9860daef --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListPortsGet.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of live ports on the specified machine during the specified time interval. + * + * @summary Returns a collection of live ports on the specified machine during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesListPortsGet.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMachinesListPortsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-999066c5-38c5-4f2f-9ce0-51d738cdc432"; + const startTime = new Date("2018-01-07T08:01:48.525Z"); + const endTime = new Date("2018-01-07T08:01:48.525Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.machines.listPorts( + resourceGroupName, + workspaceName, + machineName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesListPortsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListProcessesGet.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListProcessesGet.js new file mode 100644 index 00000000000..36979323c0b --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesListProcessesGet.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of processes on the specified machine matching the specified conditions. The returned collection represents either processes that are active/live during the specified interval of time (`live=true` and `startTime`/`endTime` are specified) or that are known to have existed at or some time prior to the specified point in time (`live=false` and `timestamp` is specified). + * + * @summary Returns a collection of processes on the specified machine matching the specified conditions. The returned collection represents either processes that are active/live during the specified interval of time (`live=true` and `startTime`/`endTime` are specified) or that are known to have existed at or some time prior to the specified point in time (`live=false` and `timestamp` is specified). + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesListProcessesGet.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMachinesListProcessesGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-36b83664-0822-4fb3-99a3-8332754f3eae"; + const live = false; + const timestamp = new Date("2018-01-07T07:45:45.1930000Z"); + const options = { live: live, timestamp: timestamp }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.machines.listProcesses( + resourceGroupName, + workspaceName, + machineName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesListProcessesGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesPortsGet.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesPortsGet.js new file mode 100644 index 00000000000..f618aa49849 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesPortsGet.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns the specified port. The port must be live during the specified time interval. If the port is not live during the interval, status 404 (Not Found) is returned. + * + * @summary Returns the specified port. The port must be live during the specified time interval. If the port is not live during the interval, status 404 (Not Found) is returned. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesPortsGetGet.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMachinesPortsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-999066c5-38c5-4f2f-9ce0-51d738cdc432"; + const portName = "b-c0a80101_8000"; + const startTime = new Date("2018-01-07T08:01:48.525Z"); + const endTime = new Date("2018-01-07T08:01:48.525Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.ports.get( + resourceGroupName, + workspaceName, + machineName, + portName, + options + ); + console.log(result); +} + +smMachinesPortsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesPortsGetLivenessGet.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesPortsGetLivenessGet.js new file mode 100644 index 00000000000..3f9cde93a91 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesPortsGetLivenessGet.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Obtains the liveness status of the port during the specified time interval. + * + * @summary Obtains the liveness status of the port during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesPortsGetLivenessGet.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMachinesPortsGetLivenessGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-999066c5-38c5-4f2f-9ce0-51d738cdc432"; + const portName = "b-c0a80101_8000"; + const startTime = new Date("2018-01-07T08:01:48.525Z"); + const endTime = new Date("2018-01-07T08:01:48.525Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.ports.getLiveness( + resourceGroupName, + workspaceName, + machineName, + portName, + options + ); + console.log(result); +} + +smMachinesPortsGetLivenessGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesPortsListAcceptingProcessesGet.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesPortsListAcceptingProcessesGet.js new file mode 100644 index 00000000000..77797dc6c0e --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesPortsListAcceptingProcessesGet.js @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of processes accepting on the specified port + * + * @summary Returns a collection of processes accepting on the specified port + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesPortsListAcceptingProcessesGet.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMachinesPortsListAcceptingProcessesGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-1bc28d72-0e81-4aff-b1e3-ae12e8da155e"; + const portName = "b-c0a80101_8000"; + const startTime = new Date("2018-01-08T18:37:39.936Z"); + const endTime = new Date("2018-01-08T18:37:54.936Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.ports.listAcceptingProcesses( + resourceGroupName, + workspaceName, + machineName, + portName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesPortsListAcceptingProcessesGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesPortsListConnectionsGet.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesPortsListConnectionsGet.js new file mode 100644 index 00000000000..b4abc98fbbd --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesPortsListConnectionsGet.js @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of connections established via the specified port. + * + * @summary Returns a collection of connections established via the specified port. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesPortsListConnectionsGet.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMachinesPortsListConnectionsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-A4AB1C69-03E9-42D2-B822-B42555569FB4"; + const portName = "b-c0a8010a_10000"; + const startTime = new Date("2018-01-08T23:05:16.7985488Z"); + const endTime = new Date("2018-01-08T23:07:16.7985488Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.ports.listConnections( + resourceGroupName, + workspaceName, + machineName, + portName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesPortsListConnectionsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesProcessesGet.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesProcessesGet.js new file mode 100644 index 00000000000..ab1188b48f1 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesProcessesGet.js @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns the specified process. + * + * @summary Returns the specified process. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesProcessesGetGet.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMachinesProcessesGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-36b83664-0822-4fb3-99a3-8332754f3eae"; + const processName = "p-bbf99526b8fc5e7ee4f75568958a040d08489160"; + const timestamp = new Date("2018-01-10T22:45:45.1930000Z"); + const options = { timestamp: timestamp }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.processes.get( + resourceGroupName, + workspaceName, + machineName, + processName, + options + ); + console.log(result); +} + +smMachinesProcessesGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesProcessesGetLivenessGet.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesProcessesGetLivenessGet.js new file mode 100644 index 00000000000..12a8dde55df --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesProcessesGetLivenessGet.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Obtains the liveness status of the process during the specified time interval. + * + * @summary Obtains the liveness status of the process during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesProcessesGetLivenessGet.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMachinesProcessesGetLivenessGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-36b83664-0822-4fb3-99a3-8332754f3eae"; + const processName = "p-bbf99526b8fc5e7ee4f75568958a040d08489160"; + const startTime = new Date("2018-01-07T07:07:27.6026938Z"); + const endTime = new Date("2018-01-07T07:09:27.6026938Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.processes.getLiveness( + resourceGroupName, + workspaceName, + machineName, + processName, + options + ); + console.log(result); +} + +smMachinesProcessesGetLivenessGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesProcessesListAcceptingPortsGet.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesProcessesListAcceptingPortsGet.js new file mode 100644 index 00000000000..4882243d2f7 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesProcessesListAcceptingPortsGet.js @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of ports on which this process is accepting + * + * @summary Returns a collection of ports on which this process is accepting + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesProcessesListAcceptingPortsGet.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMachinesProcessesListAcceptingPortsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-999066c5-38c5-4f2f-9ce0-51d738cdc432"; + const processName = "p-37d1761114556be465c44e2300bda03178a6189e"; + const startTime = new Date("2018-01-07T08:01:48.525Z"); + const endTime = new Date("2018-01-07T08:01:48.525Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.processes.listAcceptingPorts( + resourceGroupName, + workspaceName, + machineName, + processName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesProcessesListAcceptingPortsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesProcessesListConnectionsGet.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesProcessesListConnectionsGet.js new file mode 100644 index 00000000000..8213fe47fc8 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMachinesProcessesListConnectionsGet.js @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of connections terminating or originating at the specified process + * + * @summary Returns a collection of connections terminating or originating at the specified process + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesProcessesListConnectionsGet.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMachinesProcessesListConnectionsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-A4AB1C69-03E9-42D2-B822-B42555569FB4"; + const processName = "p-f1dd514e73cda65d9a19a977aa4a9f6959427ab0"; + const startTime = new Date("2018-01-07T08:09:15.1682041Z"); + const endTime = new Date("2018-01-07T08:11:15.1682041Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.processes.listConnections( + resourceGroupName, + workspaceName, + machineName, + processName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesProcessesListConnectionsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMapsGenerateMachineGroupDependencyPost.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMapsGenerateMachineGroupDependencyPost.js new file mode 100644 index 00000000000..2385d38f383 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMapsGenerateMachineGroupDependencyPost.js @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Generates the specified map. + * + * @summary Generates the specified map. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Maps/SMMapsGenerateMachineGroupDependencyPost.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMapsGenerateMachineGroupDependencyPost() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const request = { + endTime: new Date("2018-01-08T20:01:06.325Z"), + filterProcesses: false, + kind: "map:machine-group-dependency", + machineGroupId: + "/subscriptions/63BE4E24-FDF0-4E9C-9342-6A5D5A359722/resourceGroups/rg-sm/providers/Microsoft.OperationalInsights/workspaces/D6F79F14-E563-469B-84B5-9286D2803B2F/machineGroups/b90f6d8f-a9b9-4ac6-abeb-abd8fe10a6dc", + startTime: new Date("2018-01-08T20:00:51.325Z"), + }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.maps.generate(resourceGroupName, workspaceName, request); + console.log(result); +} + +smMapsGenerateMachineGroupDependencyPost().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMapsGenerateMachineListDependencyPost.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMapsGenerateMachineListDependencyPost.js new file mode 100644 index 00000000000..065a4ea9572 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMapsGenerateMachineListDependencyPost.js @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Generates the specified map. + * + * @summary Generates the specified map. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Maps/SMMapsGenerateMachineListDependencyPost.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMapsGenerateMachineListDependencyPost() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const request = { + endTime: new Date("2018-01-08T20:08:04.78Z"), + filterProcesses: false, + kind: "map:machine-list-dependency", + machineIds: [ + "/subscriptions/63BE4E24-FDF0-4E9C-9342-6A5D5A359722/resourceGroups/rg-sm/providers/Microsoft.OperationalInsights/workspaces/D6F79F14-E563-469B-84B5-9286D2803B2F/machines/m-d60cf4c2-047a-408e-a5ff-cf3d77928c9f", + "/subscriptions/63BE4E24-FDF0-4E9C-9342-6A5D5A359722/resourceGroups/rg-sm/providers/Microsoft.OperationalInsights/workspaces/D6F79F14-E563-469B-84B5-9286D2803B2F/machines/m-52d4f2f9-e684-4003-a774-9cf99898861b", + ], + startTime: new Date("2018-01-08T20:07:49.78Z"), + }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.maps.generate(resourceGroupName, workspaceName, request); + console.log(result); +} + +smMapsGenerateMachineListDependencyPost().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMapsGenerateSingleMachineDependencyPost.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMapsGenerateSingleMachineDependencyPost.js new file mode 100644 index 00000000000..dc895dcc335 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smMapsGenerateSingleMachineDependencyPost.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Generates the specified map. + * + * @summary Generates the specified map. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Maps/SMMapsGenerateSingleMachineDependencyPost.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smMapsGenerateSingleMachineDependencyPost() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const request = { + endTime: new Date("2018-01-08T19:52:39.0192315Z"), + kind: "map:single-machine-dependency", + machineId: + "/subscriptions/63BE4E24-FDF0-4E9C-9342-6A5D5A359722/resourceGroups/rg-sm/providers/Microsoft.OperationalInsights/workspaces/D6F79F14-E563-469B-84B5-9286D2803B2F/machines/m-A4AB1C69-03E9-42D2-B822-B42555569FB4", + startTime: new Date("2018-01-08T19:50:39.0192315Z"), + }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.maps.generate(resourceGroupName, workspaceName, request); + console.log(result); +} + +smMapsGenerateSingleMachineDependencyPost().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smSummariesGetMachinesGet.js b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smSummariesGetMachinesGet.js new file mode 100644 index 00000000000..eabeeece6fa --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/javascript/smSummariesGetMachinesGet.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns summary information about the machines in the workspace. + * + * @summary Returns summary information about the machines in the workspace. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Summaries/SMSummariesGetMachinesGet.json + */ +const { ServiceMap } = require("@azure/arm-servicemap"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function smSummariesGetMachinesGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const startTime = new Date("2018-01-08T19:41:59.3360000Z"); + const endTime = new Date("2018-01-08T19:42:14.3360000Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.summaries.getMachines(resourceGroupName, workspaceName, options); + console.log(result); +} + +smSummariesGetMachinesGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/README.md b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/README.md new file mode 100644 index 00000000000..720021b04ea --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/README.md @@ -0,0 +1,115 @@ +# client library samples for TypeScript (Beta) + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [smClientGroupsGet.ts][smclientgroupsget] | Retrieves the specified client group x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/ClientGroups/SMClientGroupsGetGet.json | +| [smClientGroupsGetMembersCountGet.ts][smclientgroupsgetmemberscountget] | Returns the approximate number of members in the client group. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/ClientGroups/SMClientGroupsGetMembersCountGet.json | +| [smClientGroupsListMembersGet.ts][smclientgroupslistmembersget] | Returns the members of the client group during the specified time interval. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/ClientGroups/SMClientGroupsListMembersGet.json | +| [smMachineGroupsCreatePost.ts][smmachinegroupscreatepost] | Creates a new machine group. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsCreatePost.json | +| [smMachineGroupsDelete.ts][smmachinegroupsdelete] | Deletes the specified Machine Group. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsDeleteDelete.json | +| [smMachineGroupsGet.ts][smmachinegroupsget] | Returns the specified machine group as it existed during the specified time interval. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsGetGet.json | +| [smMachineGroupsListByWorkspaceGet.ts][smmachinegroupslistbyworkspaceget] | Returns all machine groups during the specified time interval. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsListByWorkspaceGet.json | +| [smMachineGroupsUpdatePut.ts][smmachinegroupsupdateput] | Updates a machine group. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsUpdatePut.json | +| [smMachinesGet.ts][smmachinesget] | Returns the specified machine. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/SMMachinesGetGet.json | +| [smMachinesGetLivenessGet.ts][smmachinesgetlivenessget] | Obtains the liveness status of the machine during the specified time interval. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/SMMachinesGetLivenessGet.json | +| [smMachinesListByWorkspaceGet.ts][smmachineslistbyworkspaceget] | Returns a collection of machines matching the specified conditions. The returned collection represents either machines that are active/live during the specified interval of time (`live=true` and `startTime`/`endTime` are specified) or that are known to have existed at or some time prior to the specified point in time (`live=false` and `timestamp` is specified). x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/SMMachinesListByWorkspaceGet.json | +| [smMachinesListConnectionsGet.ts][smmachineslistconnectionsget] | Returns a collection of connections terminating or originating at the specified machine x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/SMMachinesListConnectionsGet.json | +| [smMachinesListMachineGroupMembershipGet.ts][smmachineslistmachinegroupmembershipget] | Returns a collection of machine groups this machine belongs to during the specified time interval. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/MachineGroups/SMMachinesListMachineGroupMembershipGet.json | +| [smMachinesListPortsGet.ts][smmachineslistportsget] | Returns a collection of live ports on the specified machine during the specified time interval. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesListPortsGet.json | +| [smMachinesListProcessesGet.ts][smmachineslistprocessesget] | Returns a collection of processes on the specified machine matching the specified conditions. The returned collection represents either processes that are active/live during the specified interval of time (`live=true` and `startTime`/`endTime` are specified) or that are known to have existed at or some time prior to the specified point in time (`live=false` and `timestamp` is specified). x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesListProcessesGet.json | +| [smMachinesPortsGet.ts][smmachinesportsget] | Returns the specified port. The port must be live during the specified time interval. If the port is not live during the interval, status 404 (Not Found) is returned. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesPortsGetGet.json | +| [smMachinesPortsGetLivenessGet.ts][smmachinesportsgetlivenessget] | Obtains the liveness status of the port during the specified time interval. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesPortsGetLivenessGet.json | +| [smMachinesPortsListAcceptingProcessesGet.ts][smmachinesportslistacceptingprocessesget] | Returns a collection of processes accepting on the specified port x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesPortsListAcceptingProcessesGet.json | +| [smMachinesPortsListConnectionsGet.ts][smmachinesportslistconnectionsget] | Returns a collection of connections established via the specified port. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesPortsListConnectionsGet.json | +| [smMachinesProcessesGet.ts][smmachinesprocessesget] | Returns the specified process. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesProcessesGetGet.json | +| [smMachinesProcessesGetLivenessGet.ts][smmachinesprocessesgetlivenessget] | Obtains the liveness status of the process during the specified time interval. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesProcessesGetLivenessGet.json | +| [smMachinesProcessesListAcceptingPortsGet.ts][smmachinesprocesseslistacceptingportsget] | Returns a collection of ports on which this process is accepting x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesProcessesListAcceptingPortsGet.json | +| [smMachinesProcessesListConnectionsGet.ts][smmachinesprocesseslistconnectionsget] | Returns a collection of connections terminating or originating at the specified process x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesProcessesListConnectionsGet.json | +| [smMapsGenerateMachineGroupDependencyPost.ts][smmapsgeneratemachinegroupdependencypost] | Generates the specified map. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Maps/SMMapsGenerateMachineGroupDependencyPost.json | +| [smMapsGenerateMachineListDependencyPost.ts][smmapsgeneratemachinelistdependencypost] | Generates the specified map. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Maps/SMMapsGenerateMachineListDependencyPost.json | +| [smMapsGenerateSingleMachineDependencyPost.ts][smmapsgeneratesinglemachinedependencypost] | Generates the specified map. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Maps/SMMapsGenerateSingleMachineDependencyPost.json | +| [smSummariesGetMachinesGet.ts][smsummariesgetmachinesget] | Returns summary information about the machines in the workspace. x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Summaries/SMSummariesGetMachinesGet.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/smClientGroupsGet.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node dist/smClientGroupsGet.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[smclientgroupsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smClientGroupsGet.ts +[smclientgroupsgetmemberscountget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smClientGroupsGetMembersCountGet.ts +[smclientgroupslistmembersget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smClientGroupsListMembersGet.ts +[smmachinegroupscreatepost]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsCreatePost.ts +[smmachinegroupsdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsDelete.ts +[smmachinegroupsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsGet.ts +[smmachinegroupslistbyworkspaceget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsListByWorkspaceGet.ts +[smmachinegroupsupdateput]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsUpdatePut.ts +[smmachinesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesGet.ts +[smmachinesgetlivenessget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesGetLivenessGet.ts +[smmachineslistbyworkspaceget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListByWorkspaceGet.ts +[smmachineslistconnectionsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListConnectionsGet.ts +[smmachineslistmachinegroupmembershipget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListMachineGroupMembershipGet.ts +[smmachineslistportsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListPortsGet.ts +[smmachineslistprocessesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListProcessesGet.ts +[smmachinesportsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesPortsGet.ts +[smmachinesportsgetlivenessget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesPortsGetLivenessGet.ts +[smmachinesportslistacceptingprocessesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesPortsListAcceptingProcessesGet.ts +[smmachinesportslistconnectionsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesPortsListConnectionsGet.ts +[smmachinesprocessesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesProcessesGet.ts +[smmachinesprocessesgetlivenessget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesProcessesGetLivenessGet.ts +[smmachinesprocesseslistacceptingportsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesProcessesListAcceptingPortsGet.ts +[smmachinesprocesseslistconnectionsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesProcessesListConnectionsGet.ts +[smmapsgeneratemachinegroupdependencypost]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMapsGenerateMachineGroupDependencyPost.ts +[smmapsgeneratemachinelistdependencypost]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMapsGenerateMachineListDependencyPost.ts +[smmapsgeneratesinglemachinedependencypost]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMapsGenerateSingleMachineDependencyPost.ts +[smsummariesgetmachinesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smSummariesGetMachinesGet.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-servicemap?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/service-map/arm-servicemap/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/package.json b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/package.json new file mode 100644 index 00000000000..27b910b3390 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "azure-arm-servicemap-samples-ts-beta", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript (Beta)", + "engines": { + "node": ">=12.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/service-map/arm-servicemap" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/service-map/arm-servicemap", + "dependencies": { + "@azure/arm-servicemap": "next", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^12.0.0", + "typescript": "~4.4.0", + "rimraf": "latest" + } +} diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/sample.env b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smClientGroupsGet.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smClientGroupsGet.ts new file mode 100644 index 00000000000..4142a991048 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smClientGroupsGet.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Retrieves the specified client group + * + * @summary Retrieves the specified client group + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/ClientGroups/SMClientGroupsGetGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smClientGroupsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const clientGroupName = + "m!m-A4AB1C69-03E9-42D2-B822-B42555569FB4!b!b-c0a8010a_10000"; + const startTime = new Date("2018-01-08T21:26:53.7181136Z"); + const endTime = new Date("2018-01-08T21:28:53.7181136Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.clientGroups.get( + resourceGroupName, + workspaceName, + clientGroupName, + options + ); + console.log(result); +} + +smClientGroupsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smClientGroupsGetMembersCountGet.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smClientGroupsGetMembersCountGet.ts new file mode 100644 index 00000000000..2c76a3066f7 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smClientGroupsGetMembersCountGet.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns the approximate number of members in the client group. + * + * @summary Returns the approximate number of members in the client group. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/ClientGroups/SMClientGroupsGetMembersCountGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smClientGroupsGetMembersCountGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const clientGroupName = + "m!m-12bc33c3-31ad-42e0-a08b-bd1c2531776b!b!b-c0a8010a_8000"; + const startTime = new Date("2018-01-08T21:51:48.301Z"); + const endTime = new Date("2018-01-08T21:52:03.301Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.clientGroups.getMembersCount( + resourceGroupName, + workspaceName, + clientGroupName, + options + ); + console.log(result); +} + +smClientGroupsGetMembersCountGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smClientGroupsListMembersGet.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smClientGroupsListMembersGet.ts new file mode 100644 index 00000000000..f16a0ea55d2 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smClientGroupsListMembersGet.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns the members of the client group during the specified time interval. + * + * @summary Returns the members of the client group during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/ClientGroups/SMClientGroupsListMembersGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smClientGroupsListMembersGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const clientGroupName = + "m!m-12bc33c3-31ad-42e0-a08b-bd1c2531776b!b!b-c0a8010a_8000"; + const startTime = new Date("2018-01-08T21:51:48.301Z"); + const endTime = new Date("2018-01-08T21:52:03.301Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.clientGroups.listMembers( + resourceGroupName, + workspaceName, + clientGroupName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smClientGroupsListMembersGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsCreatePost.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsCreatePost.ts new file mode 100644 index 00000000000..f8336d6e878 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsCreatePost.ts @@ -0,0 +1,47 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Creates a new machine group. + * + * @summary Creates a new machine group. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsCreatePost.json + */ +import { MachineGroup, ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachineGroupsCreatePost() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineGroup: MachineGroup = { + count: 1, + displayName: "Foo", + etag: "e20e75b5-5765-48a5-9503-9d1b7fd20925", + kind: "machineGroup", + machines: [ + { + id: + "/subscriptions/63BE4E24-FDF0-4E9C-9342-6A5D5A359722/resourceGroups/rg-sm/providers/Microsoft.OperationalInsights/workspaces/D6F79F14-E563-469B-84B5-9286D2803B2F/machines/m-2f2506f5-cf18-4dc6-98ba-d84ce2610ae0", + kind: "ref:machinewithhints" + } + ] + }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.machineGroups.create( + resourceGroupName, + workspaceName, + machineGroup + ); + console.log(result); +} + +smMachineGroupsCreatePost().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsDelete.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsDelete.ts new file mode 100644 index 00000000000..31ce14f52b1 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsDelete.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Deletes the specified Machine Group. + * + * @summary Deletes the specified Machine Group. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsDeleteDelete.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachineGroupsDelete() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineGroupName = "ccfbf4bf-dc08-4371-9e9b-00a8d875d45a"; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.machineGroups.delete( + resourceGroupName, + workspaceName, + machineGroupName + ); + console.log(result); +} + +smMachineGroupsDelete().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsGet.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsGet.ts new file mode 100644 index 00000000000..cd20387a3ff --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsGet.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns the specified machine group as it existed during the specified time interval. + * + * @summary Returns the specified machine group as it existed during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsGetGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachineGroupsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineGroupName = "07597c56-5395-4815-839c-c4e7bddbac18"; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.machineGroups.get( + resourceGroupName, + workspaceName, + machineGroupName + ); + console.log(result); +} + +smMachineGroupsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsListByWorkspaceGet.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsListByWorkspaceGet.ts new file mode 100644 index 00000000000..8e5b6e98d66 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsListByWorkspaceGet.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns all machine groups during the specified time interval. + * + * @summary Returns all machine groups during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsListByWorkspaceGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachineGroupsListByWorkspaceGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const startTime = new Date("2018-01-08T19:17:49.333139Z"); + const endTime = new Date("2018-01-08T19:19:49.333139Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.machineGroups.listByWorkspace( + resourceGroupName, + workspaceName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachineGroupsListByWorkspaceGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsUpdatePut.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsUpdatePut.ts new file mode 100644 index 00000000000..2a2b0dad20f --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachineGroupsUpdatePut.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Updates a machine group. + * + * @summary Updates a machine group. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/MachineGroups/SMMachineGroupsUpdatePut.json + */ +import { MachineGroup, ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachineGroupsUpdatePut() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineGroupName = "ccfbf4bf-dc08-4371-9e9b-00a8d875d45a"; + const machineGroup: MachineGroup = { + count: 1, + displayName: "Foo", + etag: "8cd3a8a1-4b1f-43fc-ae3c-b2c092561444", + kind: "machineGroup", + machines: [ + { + id: + "/subscriptions/63BE4E24-FDF0-4E9C-9342-6A5D5A359722/resourceGroups/rg-sm/providers/Microsoft.OperationalInsights/workspaces/D6F79F14-E563-469B-84B5-9286D2803B2F/machines/m-0fe4b501-7ac9-41d7-a4e1-1591a0789519", + kind: "ref:machinewithhints" + } + ] + }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.machineGroups.update( + resourceGroupName, + workspaceName, + machineGroupName, + machineGroup + ); + console.log(result); +} + +smMachineGroupsUpdatePut().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesGet.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesGet.ts new file mode 100644 index 00000000000..df5fe93ea2a --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesGet.ts @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns the specified machine. + * + * @summary Returns the specified machine. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/SMMachinesGetGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-A4AB1C69-03E9-42D2-B822-B42555569FB4"; + const timestamp = new Date("2018-01-07T07:01:16.1556059Z"); + const options = { timestamp: timestamp }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.machines.get( + resourceGroupName, + workspaceName, + machineName, + options + ); + console.log(result); +} + +smMachinesGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesGetLivenessGet.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesGetLivenessGet.ts new file mode 100644 index 00000000000..45c94d482c0 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesGetLivenessGet.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Obtains the liveness status of the machine during the specified time interval. + * + * @summary Obtains the liveness status of the machine during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/SMMachinesGetLivenessGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesGetLivenessGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-A4AB1C69-03E9-42D2-B822-B42555569FB4"; + const startTime = new Date("2018-01-07T07:07:27.6026938Z"); + const endTime = new Date("2018-01-07T07:09:27.6026938Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.machines.getLiveness( + resourceGroupName, + workspaceName, + machineName, + options + ); + console.log(result); +} + +smMachinesGetLivenessGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListByWorkspaceGet.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListByWorkspaceGet.ts new file mode 100644 index 00000000000..6fa22c6e11e --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListByWorkspaceGet.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of machines matching the specified conditions. The returned collection represents either machines that are active/live during the specified interval of time (`live=true` and `startTime`/`endTime` are specified) or that are known to have existed at or some time prior to the specified point in time (`live=false` and `timestamp` is specified). + * + * @summary Returns a collection of machines matching the specified conditions. The returned collection represents either machines that are active/live during the specified interval of time (`live=true` and `startTime`/`endTime` are specified) or that are known to have existed at or some time prior to the specified point in time (`live=false` and `timestamp` is specified). + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/SMMachinesListByWorkspaceGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesListByWorkspaceGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const live = false; + const timestamp = new Date("2018-01-05T21:36:07.009Z"); + const options = { live: live, timestamp: timestamp }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.machines.listByWorkspace( + resourceGroupName, + workspaceName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesListByWorkspaceGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListConnectionsGet.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListConnectionsGet.ts new file mode 100644 index 00000000000..c0d69c307f1 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListConnectionsGet.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of connections terminating or originating at the specified machine + * + * @summary Returns a collection of connections terminating or originating at the specified machine + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/SMMachinesListConnectionsGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesListConnectionsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-A4AB1C69-03E9-42D2-B822-B42555569FB4"; + const startTime = new Date("2018-01-07T07:31:38.4041029Z"); + const endTime = new Date("2018-01-07T07:31:38.4041029Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.machines.listConnections( + resourceGroupName, + workspaceName, + machineName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesListConnectionsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListMachineGroupMembershipGet.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListMachineGroupMembershipGet.ts new file mode 100644 index 00000000000..ecdaa7dcee0 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListMachineGroupMembershipGet.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of machine groups this machine belongs to during the specified time interval. + * + * @summary Returns a collection of machine groups this machine belongs to during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/MachineGroups/SMMachinesListMachineGroupMembershipGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesListMachineGroupMembershipGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-A4AB1C69-03E9-42D2-B822-B42555569FB4"; + const startTime = new Date("2018-01-08T19:17:49.333139Z"); + const endTime = new Date("2018-01-08T19:19:49.333139Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.machines.listMachineGroupMembership( + resourceGroupName, + workspaceName, + machineName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesListMachineGroupMembershipGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListPortsGet.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListPortsGet.ts new file mode 100644 index 00000000000..7304b012d80 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListPortsGet.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of live ports on the specified machine during the specified time interval. + * + * @summary Returns a collection of live ports on the specified machine during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesListPortsGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesListPortsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-999066c5-38c5-4f2f-9ce0-51d738cdc432"; + const startTime = new Date("2018-01-07T08:01:48.525Z"); + const endTime = new Date("2018-01-07T08:01:48.525Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.machines.listPorts( + resourceGroupName, + workspaceName, + machineName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesListPortsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListProcessesGet.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListProcessesGet.ts new file mode 100644 index 00000000000..2f1b640b51e --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesListProcessesGet.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of processes on the specified machine matching the specified conditions. The returned collection represents either processes that are active/live during the specified interval of time (`live=true` and `startTime`/`endTime` are specified) or that are known to have existed at or some time prior to the specified point in time (`live=false` and `timestamp` is specified). + * + * @summary Returns a collection of processes on the specified machine matching the specified conditions. The returned collection represents either processes that are active/live during the specified interval of time (`live=true` and `startTime`/`endTime` are specified) or that are known to have existed at or some time prior to the specified point in time (`live=false` and `timestamp` is specified). + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesListProcessesGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesListProcessesGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-36b83664-0822-4fb3-99a3-8332754f3eae"; + const live = false; + const timestamp = new Date("2018-01-07T07:45:45.1930000Z"); + const options = { live: live, timestamp: timestamp }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.machines.listProcesses( + resourceGroupName, + workspaceName, + machineName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesListProcessesGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesPortsGet.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesPortsGet.ts new file mode 100644 index 00000000000..25acb84faa5 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesPortsGet.ts @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns the specified port. The port must be live during the specified time interval. If the port is not live during the interval, status 404 (Not Found) is returned. + * + * @summary Returns the specified port. The port must be live during the specified time interval. If the port is not live during the interval, status 404 (Not Found) is returned. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesPortsGetGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesPortsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-999066c5-38c5-4f2f-9ce0-51d738cdc432"; + const portName = "b-c0a80101_8000"; + const startTime = new Date("2018-01-07T08:01:48.525Z"); + const endTime = new Date("2018-01-07T08:01:48.525Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.ports.get( + resourceGroupName, + workspaceName, + machineName, + portName, + options + ); + console.log(result); +} + +smMachinesPortsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesPortsGetLivenessGet.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesPortsGetLivenessGet.ts new file mode 100644 index 00000000000..3f6698b4355 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesPortsGetLivenessGet.ts @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Obtains the liveness status of the port during the specified time interval. + * + * @summary Obtains the liveness status of the port during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesPortsGetLivenessGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesPortsGetLivenessGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-999066c5-38c5-4f2f-9ce0-51d738cdc432"; + const portName = "b-c0a80101_8000"; + const startTime = new Date("2018-01-07T08:01:48.525Z"); + const endTime = new Date("2018-01-07T08:01:48.525Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.ports.getLiveness( + resourceGroupName, + workspaceName, + machineName, + portName, + options + ); + console.log(result); +} + +smMachinesPortsGetLivenessGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesPortsListAcceptingProcessesGet.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesPortsListAcceptingProcessesGet.ts new file mode 100644 index 00000000000..517837eff89 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesPortsListAcceptingProcessesGet.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of processes accepting on the specified port + * + * @summary Returns a collection of processes accepting on the specified port + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesPortsListAcceptingProcessesGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesPortsListAcceptingProcessesGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-1bc28d72-0e81-4aff-b1e3-ae12e8da155e"; + const portName = "b-c0a80101_8000"; + const startTime = new Date("2018-01-08T18:37:39.936Z"); + const endTime = new Date("2018-01-08T18:37:54.936Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.ports.listAcceptingProcesses( + resourceGroupName, + workspaceName, + machineName, + portName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesPortsListAcceptingProcessesGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesPortsListConnectionsGet.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesPortsListConnectionsGet.ts new file mode 100644 index 00000000000..7831a627823 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesPortsListConnectionsGet.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of connections established via the specified port. + * + * @summary Returns a collection of connections established via the specified port. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Ports/SMMachinesPortsListConnectionsGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesPortsListConnectionsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-A4AB1C69-03E9-42D2-B822-B42555569FB4"; + const portName = "b-c0a8010a_10000"; + const startTime = new Date("2018-01-08T23:05:16.7985488Z"); + const endTime = new Date("2018-01-08T23:07:16.7985488Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.ports.listConnections( + resourceGroupName, + workspaceName, + machineName, + portName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesPortsListConnectionsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesProcessesGet.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesProcessesGet.ts new file mode 100644 index 00000000000..3c326008426 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesProcessesGet.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns the specified process. + * + * @summary Returns the specified process. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesProcessesGetGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesProcessesGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-36b83664-0822-4fb3-99a3-8332754f3eae"; + const processName = "p-bbf99526b8fc5e7ee4f75568958a040d08489160"; + const timestamp = new Date("2018-01-10T22:45:45.1930000Z"); + const options = { timestamp: timestamp }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.processes.get( + resourceGroupName, + workspaceName, + machineName, + processName, + options + ); + console.log(result); +} + +smMachinesProcessesGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesProcessesGetLivenessGet.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesProcessesGetLivenessGet.ts new file mode 100644 index 00000000000..42acfb46d25 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesProcessesGetLivenessGet.ts @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Obtains the liveness status of the process during the specified time interval. + * + * @summary Obtains the liveness status of the process during the specified time interval. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesProcessesGetLivenessGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesProcessesGetLivenessGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-36b83664-0822-4fb3-99a3-8332754f3eae"; + const processName = "p-bbf99526b8fc5e7ee4f75568958a040d08489160"; + const startTime = new Date("2018-01-07T07:07:27.6026938Z"); + const endTime = new Date("2018-01-07T07:09:27.6026938Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.processes.getLiveness( + resourceGroupName, + workspaceName, + machineName, + processName, + options + ); + console.log(result); +} + +smMachinesProcessesGetLivenessGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesProcessesListAcceptingPortsGet.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesProcessesListAcceptingPortsGet.ts new file mode 100644 index 00000000000..ba696b14de6 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesProcessesListAcceptingPortsGet.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of ports on which this process is accepting + * + * @summary Returns a collection of ports on which this process is accepting + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesProcessesListAcceptingPortsGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesProcessesListAcceptingPortsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-999066c5-38c5-4f2f-9ce0-51d738cdc432"; + const processName = "p-37d1761114556be465c44e2300bda03178a6189e"; + const startTime = new Date("2018-01-07T08:01:48.525Z"); + const endTime = new Date("2018-01-07T08:01:48.525Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.processes.listAcceptingPorts( + resourceGroupName, + workspaceName, + machineName, + processName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesProcessesListAcceptingPortsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesProcessesListConnectionsGet.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesProcessesListConnectionsGet.ts new file mode 100644 index 00000000000..c574e7c502c --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMachinesProcessesListConnectionsGet.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a collection of connections terminating or originating at the specified process + * + * @summary Returns a collection of connections terminating or originating at the specified process + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Machines/Processes/SMMachinesProcessesListConnectionsGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMachinesProcessesListConnectionsGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const machineName = "m-A4AB1C69-03E9-42D2-B822-B42555569FB4"; + const processName = "p-f1dd514e73cda65d9a19a977aa4a9f6959427ab0"; + const startTime = new Date("2018-01-07T08:09:15.1682041Z"); + const endTime = new Date("2018-01-07T08:11:15.1682041Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.processes.listConnections( + resourceGroupName, + workspaceName, + machineName, + processName, + options + )) { + resArray.push(item); + } + console.log(resArray); +} + +smMachinesProcessesListConnectionsGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMapsGenerateMachineGroupDependencyPost.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMapsGenerateMachineGroupDependencyPost.ts new file mode 100644 index 00000000000..3e59180f9e9 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMapsGenerateMachineGroupDependencyPost.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Generates the specified map. + * + * @summary Generates the specified map. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Maps/SMMapsGenerateMachineGroupDependencyPost.json + */ +import { MachineGroupMapRequest, ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMapsGenerateMachineGroupDependencyPost() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const request: MachineGroupMapRequest = { + endTime: new Date("2018-01-08T20:01:06.325Z"), + filterProcesses: false, + kind: "map:machine-group-dependency", + machineGroupId: + "/subscriptions/63BE4E24-FDF0-4E9C-9342-6A5D5A359722/resourceGroups/rg-sm/providers/Microsoft.OperationalInsights/workspaces/D6F79F14-E563-469B-84B5-9286D2803B2F/machineGroups/b90f6d8f-a9b9-4ac6-abeb-abd8fe10a6dc", + startTime: new Date("2018-01-08T20:00:51.325Z") + }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.maps.generate( + resourceGroupName, + workspaceName, + request + ); + console.log(result); +} + +smMapsGenerateMachineGroupDependencyPost().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMapsGenerateMachineListDependencyPost.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMapsGenerateMachineListDependencyPost.ts new file mode 100644 index 00000000000..87004af34e2 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMapsGenerateMachineListDependencyPost.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Generates the specified map. + * + * @summary Generates the specified map. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Maps/SMMapsGenerateMachineListDependencyPost.json + */ +import { MachineListMapRequest, ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMapsGenerateMachineListDependencyPost() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const request: MachineListMapRequest = { + endTime: new Date("2018-01-08T20:08:04.78Z"), + filterProcesses: false, + kind: "map:machine-list-dependency", + machineIds: [ + "/subscriptions/63BE4E24-FDF0-4E9C-9342-6A5D5A359722/resourceGroups/rg-sm/providers/Microsoft.OperationalInsights/workspaces/D6F79F14-E563-469B-84B5-9286D2803B2F/machines/m-d60cf4c2-047a-408e-a5ff-cf3d77928c9f", + "/subscriptions/63BE4E24-FDF0-4E9C-9342-6A5D5A359722/resourceGroups/rg-sm/providers/Microsoft.OperationalInsights/workspaces/D6F79F14-E563-469B-84B5-9286D2803B2F/machines/m-52d4f2f9-e684-4003-a774-9cf99898861b" + ], + startTime: new Date("2018-01-08T20:07:49.78Z") + }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.maps.generate( + resourceGroupName, + workspaceName, + request + ); + console.log(result); +} + +smMapsGenerateMachineListDependencyPost().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMapsGenerateSingleMachineDependencyPost.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMapsGenerateSingleMachineDependencyPost.ts new file mode 100644 index 00000000000..1adb2ab8883 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smMapsGenerateSingleMachineDependencyPost.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Generates the specified map. + * + * @summary Generates the specified map. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Maps/SMMapsGenerateSingleMachineDependencyPost.json + */ +import { + SingleMachineDependencyMapRequest, + ServiceMap +} from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smMapsGenerateSingleMachineDependencyPost() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const request: SingleMachineDependencyMapRequest = { + endTime: new Date("2018-01-08T19:52:39.0192315Z"), + kind: "map:single-machine-dependency", + machineId: + "/subscriptions/63BE4E24-FDF0-4E9C-9342-6A5D5A359722/resourceGroups/rg-sm/providers/Microsoft.OperationalInsights/workspaces/D6F79F14-E563-469B-84B5-9286D2803B2F/machines/m-A4AB1C69-03E9-42D2-B822-B42555569FB4", + startTime: new Date("2018-01-08T19:50:39.0192315Z") + }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.maps.generate( + resourceGroupName, + workspaceName, + request + ); + console.log(result); +} + +smMapsGenerateSingleMachineDependencyPost().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smSummariesGetMachinesGet.ts b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smSummariesGetMachinesGet.ts new file mode 100644 index 00000000000..fd694921d5c --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/src/smSummariesGetMachinesGet.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns summary information about the machines in the workspace. + * + * @summary Returns summary information about the machines in the workspace. + * x-ms-original-file: specification/service-map/resource-manager/Microsoft.OperationalInsights/preview/2015-11-01-preview/examples/Summaries/SMSummariesGetMachinesGet.json + */ +import { ServiceMap } from "@azure/arm-servicemap"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function smSummariesGetMachinesGet() { + const subscriptionId = "63BE4E24-FDF0-4E9C-9342-6A5D5A359722"; + const resourceGroupName = "rg-sm"; + const workspaceName = "D6F79F14-E563-469B-84B5-9286D2803B2F"; + const startTime = new Date("2018-01-08T19:41:59.3360000Z"); + const endTime = new Date("2018-01-08T19:42:14.3360000Z"); + const options = { startTime: startTime, endTime: endTime }; + const credential = new DefaultAzureCredential(); + const client = new ServiceMap(credential, subscriptionId); + const result = await client.summaries.getMachines( + resourceGroupName, + workspaceName, + options + ); + console.log(result); +} + +smSummariesGetMachinesGet().catch(console.error); diff --git a/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/tsconfig.json b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/tsconfig.json new file mode 100644 index 00000000000..416c2dd82e0 --- /dev/null +++ b/sdk/service-map/arm-servicemap/samples/v3-beta/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2018", + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "alwaysStrict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src/**.ts" + ] +} diff --git a/sdk/signalr/arm-signalr/src/models/usagesMappers.ts b/sdk/service-map/arm-servicemap/src/index.ts similarity index 60% rename from sdk/signalr/arm-signalr/src/models/usagesMappers.ts rename to sdk/service-map/arm-servicemap/src/index.ts index fc1b2d37d77..6ca18e1bf4d 100644 --- a/sdk/signalr/arm-signalr/src/models/usagesMappers.ts +++ b/sdk/service-map/arm-servicemap/src/index.ts @@ -6,11 +6,7 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -export { - ErrorAdditionalInfo, - ErrorDetail, - ErrorResponse, - SignalRUsage, - SignalRUsageList, - SignalRUsageName -} from "../models/mappers"; +/// +export * from "./models"; +export { ServiceMap } from "./serviceMap"; +export * from "./operationsInterfaces"; diff --git a/sdk/service-map/arm-servicemap/src/models/clientGroupsMappers.ts b/sdk/service-map/arm-servicemap/src/models/clientGroupsMappers.ts deleted file mode 100644 index 50374ddeb69..00000000000 --- a/sdk/service-map/arm-servicemap/src/models/clientGroupsMappers.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - discriminators, - Acceptor, - AgentConfiguration, - AzureCloudServiceConfiguration, - AzureHostingConfiguration, - AzureProcessHostingConfiguration, - AzureServiceFabricClusterConfiguration, - AzureVmScaleSetConfiguration, - BaseResource, - ClientGroup, - ClientGroupMember, - ClientGroupMembersCollection, - ClientGroupMembersCount, - ClientGroupReference, - Connection, - CoreResource, - ErrorModel, - ErrorResponse, - HostingConfiguration, - HypervisorConfiguration, - ImageConfiguration, - Ipv4NetworkInterface, - Ipv6NetworkInterface, - Machine, - MachineCountsByOperatingSystem, - MachineGroup, - MachineReference, - MachineReferenceWithHints, - MachineResourcesConfiguration, - MachinesSummary, - NetworkConfiguration, - OperatingSystemConfiguration, - Port, - PortReference, - Process, - ProcessDetails, - ProcessHostedService, - ProcessHostingConfiguration, - ProcessReference, - ProcessUser, - Relationship, - Resource, - ResourceReference, - Summary, - Timezone, - VirtualMachineConfiguration -} from "../models/mappers"; diff --git a/sdk/service-map/arm-servicemap/src/models/index.ts b/sdk/service-map/arm-servicemap/src/models/index.ts index 3664efa935f..d9f39a43e55 100644 --- a/sdk/service-map/arm-servicemap/src/models/index.ts +++ b/sdk/service-map/arm-servicemap/src/models/index.ts @@ -1,2778 +1,1362 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export { BaseResource, CloudError }; +export type HostingConfigurationUnion = + | HostingConfiguration + | AzureHostingConfiguration; +export type ResourceReferenceUnion = + | ResourceReference + | MachineReference + | PortReference + | MachineReferenceWithHints + | ProcessReference + | ClientGroupReference; +export type ProcessHostingConfigurationUnion = + | ProcessHostingConfiguration + | AzureProcessHostingConfiguration; +export type MapRequestUnion = + | MapRequest + | SingleMachineDependencyMapRequest + | MultipleMachinesMapRequestUnion; +export type CoreResourceUnion = + | CoreResource + | Machine + | Process + | Port + | MachineGroup + | ClientGroup; +export type RelationshipUnion = Relationship | Connection | Acceptor; +export type MultipleMachinesMapRequestUnion = + | MultipleMachinesMapRequest + | MachineListMapRequest + | MachineGroupMapRequest; -/** - * Resource model definition. - */ -export interface Resource extends BaseResource { +/** Collection of Machine resources. */ +export interface MachineCollection { + /** Collection of Machine resources. */ + value?: Machine[]; + /** The URL to the next set of resources. */ + nextLink?: string; +} + +/** Describes a timezone. */ +export interface Timezone { + /** Timezone full name. */ + fullName?: string; +} + +/** Describes the configuration of the Dependency Agent installed on a machine. */ +export interface AgentConfiguration { + /** Health Service Agent unique identifier. */ + agentId: string; + /** Dependency Agent unique identifier. */ + dependencyAgentId?: string; + /** Dependency Agent version number. */ + dependencyAgentVersion?: string; + /** Dependency Agent revision number. */ + dependencyAgentRevision?: string; + /** Specifies whether the machine has been rebooted since the Dependency Agent installation. */ + rebootStatus?: MachineRebootStatus; + /** Machine clock granularity in milliseconds. */ + clockGranularity?: number; +} + +/** Describes the resources of a machine. */ +export interface MachineResourcesConfiguration { + /** Physical memory in megabytes (MB). */ + physicalMemory?: number; + /** Number of CPUs. */ + cpus?: number; + /** CPU speed in megahertz (Mhz). */ + cpuSpeed?: number; + /** Describes the accuracy of the cpuSpeed field. */ + cpuSpeedAccuracy?: Accuracy; +} + +/** Describes the network configuration of a machine. */ +export interface NetworkConfiguration { + /** IPv4 interfaces. */ + ipv4Interfaces?: Ipv4NetworkInterface[]; + /** IPv6 interfaces. */ + ipv6Interfaces?: Ipv6NetworkInterface[]; + /** Default IPv4 gateways. */ + defaultIpv4Gateways?: string[]; + /** MAC addresses of all active network interfaces. */ + macAddresses?: string[]; + /** DNS names associated with the machine. */ + dnsNames?: string[]; +} + +/** Describes an IPv4 network interface. */ +export interface Ipv4NetworkInterface { + /** IPv4 address. */ + ipAddress: string; + /** IPv4 subnet mask. */ + subnetMask?: string; +} + +/** Describes an IPv6 network interface. */ +export interface Ipv6NetworkInterface { + /** IPv6 address. */ + ipAddress: string; +} + +/** Describes the configuration of the operating system of a machine. */ +export interface OperatingSystemConfiguration { + /** Windows, Linux, etc. */ + family: OperatingSystemFamily; + /** Operating system full name. */ + fullName: string; + /** Operating system bitness (32-bit or 64-bit). */ + bitness: Bitness; +} + +/** Describes the virtualization-related configuration of a machine. */ +export interface VirtualMachineConfiguration { + /** Specifies the virtualization technology used by the machine (hyperv, vmware, etc.) */ + virtualMachineType?: VirtualMachineType; + /** The unique identifier of the virtual machine as reported by the underlying virtualization system. */ + nativeMachineId?: string; + /** The Name of the virtual machine. */ + virtualMachineName?: string; + /** The unique identifier of the host of this virtual machine as reported by the underlying virtualization system. */ + nativeHostMachineId?: string; +} + +/** Describes the hypervisor configuration of a machine. */ +export interface HypervisorConfiguration { + /** Specifies the virtualization technology used by the hypervisor (hyperv, vmware, etc.) */ + hypervisorType?: HypervisorType; + /** The unique identifier of the hypervisor machine as reported by the underlying virtualization system. */ + nativeHostMachineId?: string; +} + +/** Describes the hosting configuration of a machine. */ +export interface HostingConfiguration { + /** Polymorphic discriminator, which specifies the different types this object can be */ + kind: "provider:azure"; + /** The hosting provider of the VM. */ + provider?: "azure"; +} + +/** Resource model definition. */ +export interface Resource { /** * Resource identifier. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly id?: string; /** * Resource type. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly type?: string; /** * Resource name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly name?: string; } -/** - * Contains the possible cases for ResourceReference. - */ -export type ResourceReferenceUnion = ResourceReference | MachineReference | ProcessReference | PortReference | MachineReferenceWithHints | ClientGroupReference; +/** An error response from the API. */ +export interface ErrorResponse { + /** Error information. */ + error: ErrorModel; +} -/** - * Represents a reference to another resource. - */ +/** Error details. */ +export interface ErrorModel { + /** Error code identifying the specific error. */ + code: string; + /** Error message in the caller's locale. */ + message?: string; +} + +/** Specifies the contents of a check liveness response. */ +export interface Liveness { + /** Liveness interval start time. */ + startTime: Date; + /** Liveness interval end time. */ + endTime: Date; + /** `true` if the resource is live during [startTime, endTime], `false` otherwise */ + live: boolean; +} + +/** Collection of Connection resources. */ +export interface ConnectionCollection { + /** Collection of Connection resources. */ + value?: Connection[]; + /** The URL to the next set of resources. */ + nextLink?: string; +} + +/** Represents a reference to another resource. */ export interface ResourceReference { - /** - * Polymorphic Discriminator - */ - kind: "ResourceReference"; - /** - * Resource URI. - */ + /** Polymorphic discriminator, which specifies the different types this object can be */ + kind: + | "ref:machine" + | "ref:port" + | "ref:machinewithhints" + | "ref:process" + | "ref:clientgroup"; + /** Resource URI. */ id: string; /** * Resource type qualifier. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly type?: string; /** * Resource name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly name?: string; } -/** - * Reference to a machine. - */ -export interface MachineReference { - /** - * Polymorphic Discriminator - */ +/** Relationship properties. */ +export interface RelationshipProperties { + /** Source resource of the relationship. */ + source: ResourceReferenceUnion; + /** Destination resource of the relationship. */ + destination: ResourceReferenceUnion; + /** Relationship start time. */ + startTime?: Date; + /** Relationship end time. */ + endTime?: Date; +} + +/** Collection of Process resources. */ +export interface ProcessCollection { + /** Collection of Process resources. */ + value?: Process[]; + /** The URL to the next set of resources. */ + nextLink?: string; +} + +/** Describes process metadata. */ +export interface ProcessDetails { + /** A unique identifier for a process, generally resilient to process restart, computed by Service Map. */ + persistentKey?: string; + /** Represents the identity of the process pool assigned to the process by Dependency Agent. */ + poolId?: number; + /** The Operating System Process Identifier (PID) of the first process in this process pool. */ + firstPid?: number; + /** Process description. */ + description?: string; + /** Name of company that created the process executable. */ + companyName?: string; + /** Internal process name. */ + internalName?: string; + /** Product name. */ + productName?: string; + /** Product version. */ + productVersion?: string; + /** File version. */ + fileVersion?: string; + /** Process command line. */ + commandLine?: string; + /** Process executable path. */ + executablePath?: string; + /** Process workingDirectory. */ + workingDirectory?: string; + /** Collection of services hosted by this Process (Windows only). */ + services?: ProcessHostedService[]; + /** Process zone name (Linux only). */ + zoneName?: string; +} + +/** A service hosted by a process. */ +export interface ProcessHostedService { + /** The name of the service. */ + name?: string; + /** The service's display name. */ + displayName?: string; +} + +/** Describes the user under which a process is running. */ +export interface ProcessUser { + /** User name under which the process is running. */ + userName?: string; + /** Domain name for the user. */ + userDomain?: string; +} + +/** Describes the hosting configuration of a process. */ +export interface ProcessHostingConfiguration { + /** Polymorphic discriminator, which specifies the different types this object can be */ + kind: "provider:azure"; + /** The hosting provider of the VM. */ + provider?: "azure"; +} + +/** Collection of Port resources. */ +export interface PortCollection { + /** Collection of Port resources. */ + value?: Port[]; + /** The URL to the next set of resources. */ + nextLink?: string; +} + +/** Collection of Machine Group resources. */ +export interface MachineGroupCollection { + /** Collection of Machine Group resources. */ + value?: MachineGroup[]; + /** The URL to the next set of resources. */ + nextLink?: string; +} + +/** Specifies the number of members in a client group. */ +export interface ClientGroupMembersCount { + /** Membership interval start time. */ + startTime: Date; + /** Membership interval start time. */ + endTime: Date; + /** Client Group URI. */ + groupId: string; + /** Number of members in the client group. Use this value together with the value of ```accuracy```. If accuracy is `exact` then the value represents the actual number of members in the cloud. When accuracy is `estimated`, the actual number of members is larger than the value of ```count```. */ + count: number; + /** Accuracy of the reported count. */ + accuracy: Accuracy; +} + +/** Collection of ClientGroupMember resources. */ +export interface ClientGroupMembersCollection { + /** Collection of ClientGroupMember resources. */ + value?: ClientGroupMember[]; + /** The URL to the next set of resources. */ + nextLink?: string; +} + +/** Specifies the contents of request to generate a map. */ +export interface MapRequest { + /** Polymorphic discriminator, which specifies the different types this object can be */ + kind: + | "map:single-machine-dependency" + | "MultipleMachinesMapRequest" + | "map:machine-list-dependency" + | "map:machine-group-dependency"; + /** Map interval start time. */ + startTime?: Date; + /** Map interval end time. */ + endTime?: Date; +} + +/** Specified the contents of a map response. */ +export interface MapResponse { + /** Map interval start time. */ + startTime: Date; + /** Map interval end time. */ + endTime: Date; + /** The generated map. */ + map: Map; +} + +/** A map of resources and relationships between them. */ +export interface Map { + /** The nodes (entities) of a map. */ + nodes: MapNodes; + /** The edges (relationships) of a map. */ + edges: MapEdges; +} + +/** The nodes (entities) of a map. */ +export interface MapNodes { + /** Machine resources. */ + machines?: Machine[]; + /** Process resources. */ + processes?: Process[]; + /** Port resources. */ + ports?: Port[]; + /** Client Group resources. */ + clientGroups?: ClientGroup[]; +} + +/** The edges (relationships) of a map. */ +export interface MapEdges { + /** Network connections. */ + connections?: Connection[]; + /** Processes accepting on a port. */ + acceptors?: Acceptor[]; +} + +/** Machines by operating system. */ +export interface MachineCountsByOperatingSystem { + /** Number of live Windows machines. */ + windows: number; + /** Number of live Linux machines. */ + linux: number; +} + +/** Base for all summaries. */ +export interface SummaryProperties { + /** Summary interval start time. */ + startTime: Date; + /** Summary interval end time. */ + endTime: Date; +} + +/** Describes the VM image of a machine. */ +export interface ImageConfiguration { + /** Publisher of the VM image. */ + publisher?: string; + /** Offering of the VM image. */ + offering?: string; + /** SKU of the VM image. */ + sku?: string; + /** Version of the VM image. */ + version?: string; +} + +/** Describes an Azure Cloud Service */ +export interface AzureCloudServiceConfiguration { + /** Cloud Service name */ + name?: string; + /** Cloud Service instance identifier */ + instanceId?: string; + /** Cloud Service deployment identifier */ + deployment?: string; + /** Cloud Service role name */ + roleName?: string; + /** Used to specify type of an Azure Cloud Service role */ + roleType?: AzureCloudServiceRoleType; +} + +/** Describes an Azure Virtual Machine Scale Set */ +export interface AzureVmScaleSetConfiguration { + /** Virtual Machine Scale Set name */ + name?: string; + /** Virtual Machine Scale Set instance identifier */ + instanceId?: string; + /** Virtual Machine Scale Set deployment identifier */ + deployment?: string; + /** Unique identifier of the resource. */ + resourceId?: string; +} + +/** Describes an Azure Service Fabric Cluster */ +export interface AzureServiceFabricClusterConfiguration { + /** Service Fabric cluster name. */ + name?: string; + /** Service Fabric cluster identifier. */ + clusterId?: string; +} + +/** Provides information about how a machine is hosted in Azure */ +export type AzureHostingConfiguration = HostingConfiguration & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + kind: "provider:azure"; + /** Virtual Machine ID (unique identifier). */ + vmId?: string; + /** Geographical location of the VM. */ + location?: string; + /** Machine name according to the hosting provider. */ + name?: string; + /** Size of the VM. */ + size?: string; + /** Update domain of the VM. */ + updateDomain?: string; + /** Fault domain of the VM. */ + faultDomain?: string; + /** Subscription ID. */ + subscriptionId?: string; + /** Resource group name within the specified subscription. */ + resourceGroup?: string; + /** Unique identifier of the resource. */ + resourceId?: string; + /** Image of the machine. */ + image?: ImageConfiguration; + /** Contains information about machines hosted as an Azure Cloud Service */ + cloudService?: AzureCloudServiceConfiguration; + /** Contains information about machines hosted as an Azure Virtual Machine Scale Set */ + vmScaleSet?: AzureVmScaleSetConfiguration; + /** Contains information about machines that belong an Azure Service Fabric Cluster */ + serviceFabricCluster?: AzureServiceFabricClusterConfiguration; +}; + +/** Marker resource for the core Service Map resources */ +export type CoreResource = Resource & { + /** Resource ETAG. */ + etag?: string; + /** Additional resource type qualifier. */ + kind: CoreResourceKind; +}; + +/** A typed relationship between two entities. */ +export type Relationship = Resource & { + /** Additional resource type qualifier. */ + kind: RelationshipKind; +}; + +/** Represents a member of a client group */ +export type ClientGroupMember = Resource & { + /** IP address. */ + ipAddress?: string; + /** Port into which this client connected */ + port?: PortReference; + /** Processes accepting on the above port that received connections from this client. */ + processes?: ProcessReference[]; +}; + +/** Base for all resource summaries. */ +export type Summary = Resource & {}; + +/** Reference to a machine. */ +export type MachineReference = ResourceReference & { + /** Polymorphic discriminator, which specifies the different types this object can be */ kind: "ref:machine"; - /** - * Resource URI. - */ - id: string; - /** - * Resource type qualifier. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * Resource name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; -} +}; -/** - * Reference to a process. - */ -export interface ProcessReference { - /** - * Polymorphic Discriminator - */ - kind: "ref:process"; - /** - * Resource URI. - */ - id: string; - /** - * Resource type qualifier. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * Resource name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * Machine hosting the process. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly machine?: MachineReference; -} - -/** - * Reference to a port. - */ -export interface PortReference { - /** - * Polymorphic Discriminator - */ +/** Reference to a port. */ +export type PortReference = ResourceReference & { + /** Polymorphic discriminator, which specifies the different types this object can be */ kind: "ref:port"; - /** - * Resource URI. - */ - id: string; - /** - * Resource type qualifier. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * Resource name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; /** * Machine hosting the port. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly machine?: MachineReference; /** * IP address of the port. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly ipAddress?: string; - /** - * Port number. - */ + /** Port number. */ portNumber?: number; -} +}; -/** - * A machine reference with a hint of the machine's name and operating system. - */ -export interface MachineReferenceWithHints { - /** - * Polymorphic Discriminator - */ +/** A machine reference with a hint of the machine's name and operating system. */ +export type MachineReferenceWithHints = ResourceReference & { + /** Polymorphic discriminator, which specifies the different types this object can be */ kind: "ref:machinewithhints"; - /** - * Resource URI. - */ - id: string; - /** - * Resource type qualifier. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * Resource name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; /** * Last known display name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly displayNameHint?: string; /** - * Last known operating system family. Possible values include: 'unknown', 'windows', 'linux', - * 'solaris', 'aix' - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * Last known operating system family. + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly osFamilyHint?: OperatingSystemFamily; -} +}; -/** - * Reference to a client group. - */ -export interface ClientGroupReference { +/** Reference to a process. */ +export type ProcessReference = ResourceReference & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + kind: "ref:process"; /** - * Polymorphic Discriminator + * Machine hosting the process. + * NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly machine?: MachineReference; +}; + +/** Reference to a client group. */ +export type ClientGroupReference = ResourceReference & { + /** Polymorphic discriminator, which specifies the different types this object can be */ kind: "ref:clientgroup"; - /** - * Resource URI. - */ - id: string; - /** - * Resource type qualifier. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * Resource name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; -} +}; -/** - * Contains the possible cases for CoreResource. - */ -export type CoreResourceUnion = CoreResource | Machine | Process | Port | ClientGroup | MachineGroup; - -/** - * Marker resource for the core Service Map resources - */ -export interface CoreResource { - /** - * Polymorphic Discriminator - */ - kind: "CoreResource"; - /** - * Resource identifier. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * Resource type. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * Resource name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * Resource ETAG. - */ - etag?: string; -} - -/** - * Describes a timezone. - */ -export interface Timezone { - /** - * Timezone full name. - */ - fullName?: string; -} - -/** - * Describes the configuration of the Dependency Agent installed on a machine. - */ -export interface AgentConfiguration { - /** - * Health Service Agent unique identifier. - */ - agentId: string; - /** - * Dependency Agent unique identifier. - */ - dependencyAgentId?: string; - /** - * Dependency Agent version number. - */ - dependencyAgentVersion?: string; - /** - * Dependency Agent revision number. - */ - dependencyAgentRevision?: string; - /** - * Specifies whether the machine has been rebooted since the Dependency Agent installation. - * Possible values include: 'unknown', 'rebooted', 'notRebooted' - */ - rebootStatus?: MachineRebootStatus; - /** - * Machine clock granularity in milliseconds. - */ - clockGranularity?: number; -} - -/** - * Describes the resources of a machine. - */ -export interface MachineResourcesConfiguration { - /** - * Physical memory in megabytes (MB). - */ - physicalMemory?: number; - /** - * Number of CPUs. - */ - cpus?: number; - /** - * CPU speed in megahertz (Mhz). - */ - cpuSpeed?: number; - /** - * Describes the accuracy of the cpuSpeed field. Possible values include: 'actual', 'estimated' - */ - cpuSpeedAccuracy?: Accuracy; -} - -/** - * Describes an IPv4 network interface. - */ -export interface Ipv4NetworkInterface { - /** - * IPv4 address. - */ - ipAddress: string; - /** - * IPv4 subnet mask. Default value: '255.255.255.255'. - */ - subnetMask?: string; -} - -/** - * Describes an IPv6 network interface. - */ -export interface Ipv6NetworkInterface { - /** - * IPv6 address. - */ - ipAddress: string; -} - -/** - * Describes the network configuration of a machine. - */ -export interface NetworkConfiguration { - /** - * IPv4 interfaces. - */ - ipv4Interfaces?: Ipv4NetworkInterface[]; - /** - * IPv6 interfaces. - */ - ipv6Interfaces?: Ipv6NetworkInterface[]; - /** - * Default IPv4 gateways. - */ - defaultIpv4Gateways?: string[]; - /** - * MAC addresses of all active network interfaces. - */ - macAddresses?: string[]; - /** - * DNS names associated with the machine. - */ - dnsNames?: string[]; -} - -/** - * Describes the configuration of the operating system of a machine. - */ -export interface OperatingSystemConfiguration { - /** - * Windows, Linux, etc. Possible values include: 'unknown', 'windows', 'linux', 'solaris', 'aix' - */ - family: OperatingSystemFamily; - /** - * Operating system full name. - */ - fullName: string; - /** - * Operating system bitness (32-bit or 64-bit). Possible values include: '32bit', '64bit' - */ - bitness: Bitness; -} - -/** - * Describes the virtualization-related configuration of a machine. - */ -export interface VirtualMachineConfiguration { - /** - * Specifies the virtualization technology used by the machine (hyperv, vmware, etc.). Possible - * values include: 'unknown', 'hyperv', 'ldom', 'lpar', 'vmware', 'virtualPc', 'xen' - */ - virtualMachineType?: VirtualMachineType; - /** - * The unique identifier of the virtual machine as reported by the underlying virtualization - * system. - */ - nativeMachineId?: string; - /** - * The Name of the virtual machine. - */ - virtualMachineName?: string; - /** - * The unique identifier of the host of this virtual machine as reported by the underlying - * virtualization system. - */ - nativeHostMachineId?: string; -} - -/** - * Describes the hypervisor configuration of a machine. - */ -export interface HypervisorConfiguration { - /** - * Specifies the virtualization technology used by the hypervisor (hyperv, vmware, etc.). - * Possible values include: 'unknown', 'hyperv' - */ - hypervisorType?: HypervisorType; - /** - * The unique identifier of the hypervisor machine as reported by the underlying virtualization - * system. - */ - nativeHostMachineId?: string; -} - -/** - * Contains the possible cases for HostingConfiguration. - */ -export type HostingConfigurationUnion = HostingConfiguration | AzureHostingConfiguration; - -/** - * Describes the hosting configuration of a machine. - */ -export interface HostingConfiguration { - /** - * Polymorphic Discriminator - */ - kind: "HostingConfiguration"; - /** - * The hosting provider of the VM. Possible values include: 'azure' - */ - provider?: Provider; -} - -/** - * A machine resource represents a discovered computer system. It can be *monitored*, i.e., a - * Dependency Agent is running on it, or *discovered*, i.e., its existence was inferred by - * observing the data stream from monitored machines. As machines change, prior versions of the - * machine resource are preserved and available for access. A machine is live during an interval of - * time, if either its Dependency Agent has reported data during (parts) of that interval, or a - * Dependency agent running on other machines has reported activity associated with the machine. - */ -export interface Machine { - /** - * Polymorphic Discriminator - */ - kind: "machine"; - /** - * Resource identifier. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * Resource type. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * Resource name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * Resource ETAG. - */ - etag?: string; - /** - * UTC date and time when this resource was updated in the system. - */ - timestamp?: Date; - /** - * Specifies whether the machine is actively monitored or discovered. Possible values include: - * 'monitored', 'discovered' - */ - monitoringState?: MonitoringState; - /** - * Specifies whether the machine is virtualized. Possible values include: 'unknown', 'physical', - * 'virtual', 'hypervisor' - */ - virtualizationState?: VirtualizationState; - /** - * Name to use for display purposes - */ - displayName?: string; - /** - * Name of the machine, e.g., server - */ - computerName?: string; - /** - * Fully-qualified name of the machine, e.g., server.company.com - */ - fullyQualifiedDomainName?: string; - /** - * UTC date and time when the machine last booted - */ - bootTime?: Date; - /** - * Timezone of the machine. - */ - timezone?: Timezone; - /** - * Dependency Agent configuration. - */ - agent?: AgentConfiguration; - /** - * Machine resources (memory, cpu, etc.). - */ - resources?: MachineResourcesConfiguration; - /** - * Network configuration (ips, gateways, dns, etc.) - */ - networking?: NetworkConfiguration; - /** - * Operating system information. - */ - operatingSystem?: OperatingSystemConfiguration; - /** - * Virtualization-related configuration. Present only when `virtualizationState` is `virtual`. - */ - virtualMachine?: VirtualMachineConfiguration; - /** - * Hypervisor-related configuration. Present only when 'virtualizationState' is `hypervisor`. - */ - hypervisor?: HypervisorConfiguration; - /** - * Hosting-related configuration. Present if hosting information is discovered for the VM. - */ - hosting?: HostingConfigurationUnion; -} - -/** - * A service hosted by a process. - */ -export interface ProcessHostedService { - /** - * The name of the service. - */ - name?: string; - /** - * The service's display name. - */ - displayName?: string; -} - -/** - * Describes process metadata. - */ -export interface ProcessDetails { - /** - * A unique identifier for a process, generally resilient to process restart, computed by Service - * Map. - */ - persistentKey?: string; - /** - * Represents the identity of the process pool assigned to the process by Dependency Agent. - */ - poolId?: number; - /** - * The Operating System Process Identifier (PID) of the first process in this process pool. - */ - firstPid?: number; - /** - * Process description. - */ - description?: string; - /** - * Name of company that created the process executable. - */ - companyName?: string; - /** - * Internal process name. - */ - internalName?: string; - /** - * Product name. - */ - productName?: string; - /** - * Product version. - */ - productVersion?: string; - /** - * File version. - */ - fileVersion?: string; - /** - * Process command line. - */ - commandLine?: string; - /** - * Process executable path. - */ - executablePath?: string; - /** - * Process workingDirectory. - */ - workingDirectory?: string; - /** - * Collection of services hosted by this Process (Windows only). - */ - services?: ProcessHostedService[]; - /** - * Process zone name (Linux only). - */ - zoneName?: string; -} - -/** - * Describes the user under which a process is running. - */ -export interface ProcessUser { - /** - * User name under which the process is running. - */ - userName?: string; - /** - * Domain name for the user. - */ - userDomain?: string; -} - -/** - * Contains the possible cases for ProcessHostingConfiguration. - */ -export type ProcessHostingConfigurationUnion = ProcessHostingConfiguration | AzureProcessHostingConfiguration; - -/** - * Describes the hosting configuration of a process. - */ -export interface ProcessHostingConfiguration { - /** - * Polymorphic Discriminator - */ - kind: "ProcessHostingConfiguration"; - /** - * The hosting provider of the VM. Possible values include: 'azure' - */ - provider?: Provider1; -} - -/** - * A process resource represents a process running on a machine. The process may be actively - * *monitored*, i.e., a Dependency Agent is running on its machine, or *discovered*, i.e., its - * existence was inferred by observing the data stream from monitored machines. A process resource - * represents a pool of actual operating system resources that share command lines and metadata. As - * the process pool evolves over time, prior versions of the process resource are preserved and - * available for access. A process is live during an interval of time, if that process is executing - * during (parts) of that interval - */ -export interface Process { - /** - * Polymorphic Discriminator - */ - kind: "process"; - /** - * Resource identifier. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * Resource type. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * Resource name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * Resource ETAG. - */ - etag?: string; - /** - * UTC date and time when this process resource was updated in the system - */ - timestamp?: Date; - /** - * Specifies whether the process is actively monitored or discovered. Possible values include: - * 'monitored', 'discovered' - */ - monitoringState?: MonitoringState; - /** - * Machine hosting this process. - */ - machine?: ResourceReferenceUnion; - /** - * The name of the process executable - */ - executableName?: string; - /** - * Name to use for display purposes - */ - displayName?: string; - /** - * UTC date and time when the process started - */ - startTime?: Date; - /** - * The inferred role of this process based on its name, command line, etc. Possible values - * include: 'webServer', 'appServer', 'databaseServer', 'ldapServer', 'smbServer' - */ - role?: ProcessRole; - /** - * The name of the product or suite of the process. The group is determined by its executable - * name, command line, etc. - */ - group?: string; - /** - * Process metadata (command line, product name, etc.). - */ - details?: ProcessDetails; - /** - * Information about the account under which the process is executing. - */ - user?: ProcessUser; - /** - * Present only for a discovered process acting as a client of a monitored process/machine/port. - * References the monitored process/machine/port that this process is a client of. - */ - clientOf?: ResourceReferenceUnion; - /** - * Present only for a discovered process acting as a server. References the port on which the - * discovered process is accepting. - */ - acceptorOf?: ResourceReferenceUnion; - /** - * Information about the hosting environment - */ - hosting?: ProcessHostingConfigurationUnion; -} - -/** - * A port resource represents a server port on a machine. The port may be actively *monitored*, - * i.e., a Dependency Agent is running on its machine, or *discovered*, i.e., its existence was - * inferred by observing the data stream from monitored machines. A port is live during an interval - * of time, if that port had associated activity during (parts) of that interval. - */ -export interface Port { - /** - * Polymorphic Discriminator - */ - kind: "port"; - /** - * Resource identifier. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * Resource type. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * Resource name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * Resource ETAG. - */ - etag?: string; - /** - * Specifies whether the port is actively monitored or discovered. Possible values include: - * 'monitored', 'discovered' - */ - monitoringState?: MonitoringState; - /** - * Machine hosting this port. - */ - machine?: ResourceReferenceUnion; - /** - * Name to use for display purposes. - */ - displayName?: string; - /** - * IP address associated with the port. At present only IPv4 addresses are supported. - */ - ipAddress?: string; - /** - * Port number. - */ - portNumber?: number; -} - -/** - * Represents a collection of clients of a resource. A client group can represent the clients of a - * port, process, or a machine. - */ -export interface ClientGroup { - /** - * Polymorphic Discriminator - */ - kind: "clientGroup"; - /** - * Resource identifier. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * Resource type. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * Resource name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * Resource ETAG. - */ - etag?: string; - /** - * Reference to the resource whose clients are represented by this group. - */ - clientsOf: ResourceReferenceUnion; -} - -/** - * Represents a member of a client group - */ -export interface ClientGroupMember extends Resource { - /** - * IP address. - */ - ipAddress?: string; - /** - * Port into which this client connected - */ - port?: PortReference; - /** - * Processes accepting on the above port that received connections from this client. - */ - processes?: ProcessReference[]; -} - -/** - * A user-defined logical grouping of machines. - */ -export interface MachineGroup { - /** - * Polymorphic Discriminator - */ - kind: "machineGroup"; - /** - * Resource identifier. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * Resource type. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * Resource name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * Resource ETAG. - */ - etag?: string; - /** - * Type of the machine group. Possible values include: 'unknown', 'azure-cs', 'azure-sf', - * 'azure-vmss', 'user-static' - */ - groupType?: MachineGroupType; - /** - * User defined name for the group - */ - displayName: string; - /** - * Count of machines in this group. The value of count may be bigger than the number of machines - * in case of the group has been truncated due to exceeding the max number of machines a group - * can handle. - */ - count?: number; - /** - * References of the machines in this group. The hints within each reference do not represent the - * current value of the corresponding fields. They are a snapshot created during the last time - * the machine group was updated. - */ - machines?: MachineReferenceWithHints[]; -} - -/** - * Base for all resource summaries. - */ -export interface Summary extends Resource { -} - -/** - * Machines by operating system. - */ -export interface MachineCountsByOperatingSystem { - /** - * Number of live Windows machines. - */ - windows: number; - /** - * Number of live Linux machines. - */ - linux: number; -} - -/** - * A summary of the machines in the workspace. - */ -export interface MachinesSummary extends Summary { - /** - * Summary interval start time. - */ - startTime: Date; - /** - * Summary interval end time. - */ - endTime: Date; - /** - * Total number of machines. - */ - total: number; - /** - * Number of live machines. - */ - live: number; - /** - * Machine counts by operating system. - */ - os: MachineCountsByOperatingSystem; -} - -/** - * Contains the possible cases for Relationship. - */ -export type RelationshipUnion = Relationship | Connection | Acceptor; - -/** - * A typed relationship between two entities. - */ -export interface Relationship { - /** - * Polymorphic Discriminator - */ - kind: "Relationship"; - /** - * Resource identifier. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * Resource type. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * Resource name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; -} - -/** - * A network connection. - */ -export interface Connection { - /** - * Polymorphic Discriminator - */ - kind: "rel:connection"; - /** - * Resource identifier. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * Resource type. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * Resource name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * Source resource of the relationship. - */ - source: ResourceReferenceUnion; - /** - * Destination resource of the relationship. - */ - destination: ResourceReferenceUnion; - /** - * Relationship start time. - */ - startTime?: Date; - /** - * Relationship end time. - */ - endTime?: Date; - /** - * Reference to the server port via which this connection has been established. - */ +/** Properties for a connection resource. */ +export type ConnectionProperties = RelationshipProperties & { + /** Reference to the server port via which this connection has been established. */ serverPort?: PortReference; - /** - * Specifies whether there are only successful, failed or a mixture of both connections - * represented by this resource. Possible values include: 'ok', 'failed', 'mixed' - */ + /** Specifies whether there are only successful, failed or a mixture of both connections represented by this resource. */ failureState?: ConnectionFailureState; -} +}; -/** - * A process accepting on a port. - */ -export interface Acceptor { - /** - * Polymorphic Discriminator - */ - kind: "rel:acceptor"; - /** - * Resource identifier. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * Resource type. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * Resource name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * Port being accepted. - */ - source: PortReference; - /** - * Accepting process. - */ - destination: ProcessReference; - /** - * Relationship start time. - */ - startTime?: Date; - /** - * Relationship end time. - */ - endTime?: Date; -} - -/** - * Base for all summaries. - */ -export interface SummaryProperties { - /** - * Summary interval start time. - */ - startTime: Date; - /** - * Summary interval end time. - */ - endTime: Date; -} - -/** - * Relationship properties. - */ -export interface RelationshipProperties { - /** - * Source resource of the relationship. - */ - source: ResourceReferenceUnion; - /** - * Destination resource of the relationship. - */ - destination: ResourceReferenceUnion; - /** - * Relationship start time. - */ - startTime?: Date; - /** - * Relationship end time. - */ - endTime?: Date; -} - -/** - * Describes the VM image of a machine. - */ -export interface ImageConfiguration { - /** - * Publisher of the VM image. - */ - publisher?: string; - /** - * Offering of the VM image. - */ - offering?: string; - /** - * SKU of the VM image. - */ - sku?: string; - /** - * Version of the VM image. - */ - version?: string; -} - -/** - * Describes an Azure Cloud Service - */ -export interface AzureCloudServiceConfiguration { - /** - * Cloud Service name - */ - name?: string; - /** - * Cloud Service instance identifier - */ - instanceId?: string; - /** - * Cloud Service deployment identifier - */ - deployment?: string; - /** - * Cloud Service role name - */ - roleName?: string; - /** - * Used to specify type of an Azure Cloud Service role. Possible values include: 'unknown', - * 'worker', 'web' - */ - roleType?: AzureCloudServiceRoleType; -} - -/** - * Describes an Azure Virtual Machine Scale Set - */ -export interface AzureVmScaleSetConfiguration { - /** - * Virtual Machine Scale Set name - */ - name?: string; - /** - * Virtual Machine Scale Set instance identifier - */ - instanceId?: string; - /** - * Virtual Machine Scale Set deployment identifier - */ - deployment?: string; - /** - * Unique identifier of the resource. - */ - resourceId?: string; -} - -/** - * Describes an Azure Service Fabric Cluster - */ -export interface AzureServiceFabricClusterConfiguration { - /** - * Service Fabric cluster name. - */ - name?: string; - /** - * Service Fabric cluster identifier. - */ - clusterId?: string; -} - -/** - * Provides information about how a machine is hosted in Azure - */ -export interface AzureHostingConfiguration { - /** - * Polymorphic Discriminator - */ +/** Describes the hosting configuration of a process when hosted on azure */ +export type AzureProcessHostingConfiguration = ProcessHostingConfiguration & { + /** Polymorphic discriminator, which specifies the different types this object can be */ kind: "provider:azure"; - /** - * The hosting provider of the VM. Possible values include: 'azure' - */ - provider?: Provider; - /** - * Virtual Machine ID (unique identifier). - */ - vmId?: string; - /** - * Geographical location of the VM. - */ - location?: string; - /** - * Machine name according to the hosting provider. - */ - name?: string; - /** - * Size of the VM. - */ - size?: string; - /** - * Update domain of the VM. - */ - updateDomain?: string; - /** - * Fault domain of the VM. - */ - faultDomain?: string; - /** - * Subscription ID. - */ - subscriptionId?: string; - /** - * Resource group name within the specified subscription. - */ - resourceGroup?: string; - /** - * Unique identifier of the resource. - */ - resourceId?: string; - /** - * Image of the machine. - */ - image?: ImageConfiguration; - /** - * Contains information about machines hosted as an Azure Cloud Service - */ + /** Contains information about the cloud service the process belongs to */ cloudService?: AzureCloudServiceConfiguration; - /** - * Contains information about machines hosted as an Azure Virtual Machine Scale Set - */ - vmScaleSet?: AzureVmScaleSetConfiguration; - /** - * Contains information about machines that belong an Azure Service Fabric Cluster - */ - serviceFabricCluster?: AzureServiceFabricClusterConfiguration; -} +}; -/** - * Describes the hosting configuration of a process when hosted on azure - */ -export interface AzureProcessHostingConfiguration { - /** - * Polymorphic Discriminator - */ - kind: "provider:azure"; - /** - * The hosting provider of the VM. Possible values include: 'azure' - */ - provider?: Provider1; - /** - * Contains information about the cloud service the process belongs to - */ - cloudService?: AzureCloudServiceConfiguration; -} - -/** - * The nodes (entities) of a map. - */ -export interface MapNodes { - /** - * Machine resources. - */ - machines?: Machine[]; - /** - * Process resources. - */ - processes?: Process[]; - /** - * Port resources. - */ - ports?: Port[]; - /** - * Client Group resources. - */ - clientGroups?: ClientGroup[]; -} - -/** - * The edges (relationships) of a map. - */ -export interface MapEdges { - /** - * Network connections. - */ - connections?: Connection[]; - /** - * Processes accepting on a port. - */ - acceptors?: Acceptor[]; -} - -/** - * A map of resources and relationships between them. - */ -export interface Map { - nodes: MapNodes; - edges: MapEdges; -} - -/** - * Specifies the contents of a check liveness response. - */ -export interface Liveness { - /** - * Liveness interval start time. - */ - startTime: Date; - /** - * Liveness interval end time. - */ - endTime: Date; - /** - * `true` if the resource is live during [startTime, endTime], `false` otherwise - */ - live: boolean; -} - -/** - * Contains the possible cases for MapRequest. - */ -export type MapRequestUnion = MapRequest | SingleMachineDependencyMapRequest | MultipleMachinesMapRequestUnion; - -/** - * Specifies the contents of request to generate a map. - */ -export interface MapRequest { - /** - * Polymorphic Discriminator - */ - kind: "MapRequest"; - /** - * Map interval start time. - */ - startTime?: Date; - /** - * Map interval end time. - */ - endTime?: Date; -} - -/** - * Specifies the computation of a single server dependency map. A single server dependency map - * includes all direct dependencies of a given machine. - */ -export interface SingleMachineDependencyMapRequest { - /** - * Polymorphic Discriminator - */ +/** Specifies the computation of a single server dependency map. A single server dependency map includes all direct dependencies of a given machine. */ +export type SingleMachineDependencyMapRequest = MapRequest & { + /** Polymorphic discriminator, which specifies the different types this object can be */ kind: "map:single-machine-dependency"; - /** - * Map interval start time. - */ - startTime?: Date; - /** - * Map interval end time. - */ - endTime?: Date; - /** - * URI of machine resource for which to generate the map. - */ + /** URI of machine resource for which to generate the map. */ machineId: string; -} +}; -/** - * Contains the possible cases for MultipleMachinesMapRequest. - */ -export type MultipleMachinesMapRequestUnion = MultipleMachinesMapRequest | MachineListMapRequest | MachineGroupMapRequest; - -/** - * Provides a base class for describing map requests for a collection of machines - */ -export interface MultipleMachinesMapRequest { - /** - * Polymorphic Discriminator - */ - kind: "MultipleMachinesMapRequest"; - /** - * Map interval start time. - */ - startTime?: Date; - /** - * Map interval end time. - */ - endTime?: Date; - /** - * If true, only processes between specified machines will be included. Any connections in or out - * of those processes will be included. - */ +/** Provides a base class for describing map requests for a collection of machines */ +export type MultipleMachinesMapRequest = MapRequest & { + /** Polymorphic discriminator, which specifies the different types this object can be */ + kind: + | "MultipleMachinesMapRequest" + | "map:machine-list-dependency" + | "map:machine-group-dependency"; + /** If true, only processes between specified machines will be included. Any connections in or out of those processes will be included. */ filterProcesses?: boolean; -} +}; -/** - * Specifies the computation of a one hope dependency map for a list of machines. The resulting map - * includes all direct dependencies for the specified machines. - */ -export interface MachineListMapRequest { - /** - * Polymorphic Discriminator - */ +/** Summarizes machines in the workspace. */ +export type MachinesSummaryProperties = SummaryProperties & { + /** Total number of machines. */ + total: number; + /** Number of live machines. */ + live: number; + /** Machine counts by operating system. */ + os: MachineCountsByOperatingSystem; +}; + +/** A machine resource represents a discovered computer system. It can be *monitored*, i.e., a Dependency Agent is running on it, or *discovered*, i.e., its existence was inferred by observing the data stream from monitored machines. As machines change, prior versions of the machine resource are preserved and available for access. A machine is live during an interval of time, if either its Dependency Agent has reported data during (parts) of that interval, or a Dependency agent running on other machines has reported activity associated with the machine. */ +export type Machine = CoreResource & { + /** UTC date and time when this resource was updated in the system. */ + timestamp?: Date; + /** Specifies whether the machine is actively monitored or discovered. */ + monitoringState?: MonitoringState; + /** Specifies whether the machine is virtualized. */ + virtualizationState?: VirtualizationState; + /** Name to use for display purposes */ + displayName?: string; + /** Name of the machine, e.g., server */ + computerName?: string; + /** Fully-qualified name of the machine, e.g., server.company.com */ + fullyQualifiedDomainName?: string; + /** UTC date and time when the machine last booted */ + bootTime?: Date; + /** Timezone of the machine. */ + timezone?: Timezone; + /** Dependency Agent configuration. */ + agent?: AgentConfiguration; + /** Machine resources (memory, cpu, etc.). */ + resources?: MachineResourcesConfiguration; + /** Network configuration (ips, gateways, dns, etc.) */ + networking?: NetworkConfiguration; + /** Operating system information. */ + operatingSystem?: OperatingSystemConfiguration; + /** Virtualization-related configuration. Present only when `virtualizationState` is `virtual`. */ + virtualMachine?: VirtualMachineConfiguration; + /** Hypervisor-related configuration. Present only when 'virtualizationState' is `hypervisor`. */ + hypervisor?: HypervisorConfiguration; + /** Hosting-related configuration. Present if hosting information is discovered for the VM. */ + hosting?: HostingConfigurationUnion; +}; + +/** A process resource represents a process running on a machine. The process may be actively *monitored*, i.e., a Dependency Agent is running on its machine, or *discovered*, i.e., its existence was inferred by observing the data stream from monitored machines. A process resource represents a pool of actual operating system resources that share command lines and metadata. As the process pool evolves over time, prior versions of the process resource are preserved and available for access. A process is live during an interval of time, if that process is executing during (parts) of that interval */ +export type Process = CoreResource & { + /** UTC date and time when this process resource was updated in the system */ + timestamp?: Date; + /** Specifies whether the process is actively monitored or discovered. */ + monitoringState?: MonitoringState; + /** Machine hosting this process. */ + machine?: ResourceReferenceUnion; + /** The name of the process executable */ + executableName?: string; + /** Name to use for display purposes */ + displayName?: string; + /** UTC date and time when the process started */ + startTime?: Date; + /** The inferred role of this process based on its name, command line, etc. */ + role?: ProcessRole; + /** The name of the product or suite of the process. The group is determined by its executable name, command line, etc. */ + group?: string; + /** Process metadata (command line, product name, etc.). */ + details?: ProcessDetails; + /** Information about the account under which the process is executing. */ + user?: ProcessUser; + /** Present only for a discovered process acting as a client of a monitored process/machine/port. References the monitored process/machine/port that this process is a client of. */ + clientOf?: ResourceReferenceUnion; + /** Present only for a discovered process acting as a server. References the port on which the discovered process is accepting. */ + acceptorOf?: ResourceReferenceUnion; + /** Information about the hosting environment */ + hosting?: ProcessHostingConfigurationUnion; +}; + +/** A port resource represents a server port on a machine. The port may be actively *monitored*, i.e., a Dependency Agent is running on its machine, or *discovered*, i.e., its existence was inferred by observing the data stream from monitored machines. A port is live during an interval of time, if that port had associated activity during (parts) of that interval. */ +export type Port = CoreResource & { + /** Specifies whether the port is actively monitored or discovered. */ + monitoringState?: MonitoringState; + /** Machine hosting this port. */ + machine?: ResourceReferenceUnion; + /** Name to use for display purposes. */ + displayName?: string; + /** IP address associated with the port. At present only IPv4 addresses are supported. */ + ipAddress?: string; + /** Port number. */ + portNumber?: number; +}; + +/** A user-defined logical grouping of machines. */ +export type MachineGroup = CoreResource & { + /** Type of the machine group */ + groupType?: MachineGroupType; + /** User defined name for the group */ + displayName?: string; + /** Count of machines in this group. The value of count may be bigger than the number of machines in case of the group has been truncated due to exceeding the max number of machines a group can handle. */ + count?: number; + /** References of the machines in this group. The hints within each reference do not represent the current value of the corresponding fields. They are a snapshot created during the last time the machine group was updated. */ + machines?: MachineReferenceWithHints[]; +}; + +/** Represents a collection of clients of a resource. A client group can represent the clients of a port, process, or a machine. */ +export type ClientGroup = CoreResource & { + /** Reference to the resource whose clients are represented by this group. */ + clientsOf?: ResourceReferenceUnion; +}; + +/** A network connection. */ +export type Connection = Relationship & { + /** Source resource of the relationship. */ + source?: ResourceReferenceUnion; + /** Destination resource of the relationship. */ + destination?: ResourceReferenceUnion; + /** Relationship start time. */ + startTime?: Date; + /** Relationship end time. */ + endTime?: Date; + /** Reference to the server port via which this connection has been established. */ + serverPort?: PortReference; + /** Specifies whether there are only successful, failed or a mixture of both connections represented by this resource. */ + failureState?: ConnectionFailureState; +}; + +/** A process accepting on a port. */ +export type Acceptor = Relationship & { + /** Port being accepted. */ + source?: PortReference; + /** Accepting process. */ + destination?: ProcessReference; + /** Relationship start time. */ + startTime?: Date; + /** Relationship end time. */ + endTime?: Date; +}; + +/** A summary of the machines in the workspace. */ +export type MachinesSummary = Summary & { + /** Summary interval start time. */ + startTime?: Date; + /** Summary interval end time. */ + endTime?: Date; + /** Total number of machines. */ + total?: number; + /** Number of live machines. */ + live?: number; + /** Machine counts by operating system. */ + os?: MachineCountsByOperatingSystem; +}; + +/** Specifies the computation of a one hope dependency map for a list of machines. The resulting map includes all direct dependencies for the specified machines. */ +export type MachineListMapRequest = MultipleMachinesMapRequest & { + /** Polymorphic discriminator, which specifies the different types this object can be */ kind: "map:machine-list-dependency"; - /** - * Map interval start time. - */ - startTime?: Date; - /** - * Map interval end time. - */ - endTime?: Date; - /** - * If true, only processes between specified machines will be included. Any connections in or out - * of those processes will be included. - */ - filterProcesses?: boolean; - /** - * a list of URIs of machine resources for which to generate the map. - */ + /** a list of URIs of machine resources for which to generate the map. */ machineIds: string[]; -} +}; -/** - * Specifies the computation of a machine group dependency map. A machine group dependency map - * includes all direct dependencies the machines in the group. - */ -export interface MachineGroupMapRequest { - /** - * Polymorphic Discriminator - */ +/** Specifies the computation of a machine group dependency map. A machine group dependency map includes all direct dependencies the machines in the group. */ +export type MachineGroupMapRequest = MultipleMachinesMapRequest & { + /** Polymorphic discriminator, which specifies the different types this object can be */ kind: "map:machine-group-dependency"; - /** - * Map interval start time. - */ - startTime?: Date; - /** - * Map interval end time. - */ - endTime?: Date; - /** - * If true, only processes between specified machines will be included. Any connections in or out - * of those processes will be included. - */ - filterProcesses?: boolean; - /** - * URI of machine group resource for which to generate the map. - */ + /** URI of machine group resource for which to generate the map. */ machineGroupId: string; +}; + +/** Known values of {@link CoreResourceKind} that the service accepts. */ +export enum KnownCoreResourceKind { + Machine = "machine", + Process = "process", + Port = "port", + ClientGroup = "clientGroup", + MachineGroup = "machineGroup" } /** - * Specified the contents of a map response. + * Defines values for CoreResourceKind. \ + * {@link KnownCoreResourceKind} can be used interchangeably with CoreResourceKind, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **machine** \ + * **process** \ + * **port** \ + * **clientGroup** \ + * **machineGroup** */ -export interface MapResponse { - /** - * Map interval start time. - */ - startTime: Date; - /** - * Map interval end time. - */ - endTime: Date; - /** - * The generated map. - */ - map: Map; +export type CoreResourceKind = string; + +/** Known values of {@link ResourceReferenceKind} that the service accepts. */ +export enum KnownResourceReferenceKind { + RefMachine = "ref:machine", + RefMachinewithhints = "ref:machinewithhints", + RefProcess = "ref:process", + RefPort = "ref:port", + RefOnmachine = "ref:onmachine", + RefClientgroup = "ref:clientgroup" } /** - * Specifies the number of members in a client group. + * Defines values for ResourceReferenceKind. \ + * {@link KnownResourceReferenceKind} can be used interchangeably with ResourceReferenceKind, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ref:machine** \ + * **ref:machinewithhints** \ + * **ref:process** \ + * **ref:port** \ + * **ref:onmachine** \ + * **ref:clientgroup** */ -export interface ClientGroupMembersCount { - /** - * Membership interval start time. - */ - startTime: Date; - /** - * Membership interval start time. - */ - endTime: Date; - /** - * Client Group URI. - */ - groupId: string; - /** - * Number of members in the client group. Use this value together with the value of - * ```accuracy```. If accuracy is `exact` then the value represents the actual number of members - * in the cloud. When accuracy is `estimated`, the actual number of members is larger than the - * value of ```count```. - */ - count: number; - /** - * Accuracy of the reported count. Possible values include: 'actual', 'estimated' - */ - accuracy: Accuracy; +export type ResourceReferenceKind = string; + +/** Known values of {@link RelationshipKind} that the service accepts. */ +export enum KnownRelationshipKind { + RelConnection = "rel:connection", + RelAcceptor = "rel:acceptor" } /** - * Error details. + * Defines values for RelationshipKind. \ + * {@link KnownRelationshipKind} can be used interchangeably with RelationshipKind, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **rel:connection** \ + * **rel:acceptor** */ -export interface ErrorModel { - /** - * Error code identifying the specific error. - */ - code: string; - /** - * Error message in the caller's locale. - */ - message?: string; +export type RelationshipKind = string; + +/** Known values of {@link ProcessRole} that the service accepts. */ +export enum KnownProcessRole { + WebServer = "webServer", + AppServer = "appServer", + DatabaseServer = "databaseServer", + LdapServer = "ldapServer", + SmbServer = "smbServer" } /** - * An error response from the API. + * Defines values for ProcessRole. \ + * {@link KnownProcessRole} can be used interchangeably with ProcessRole, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **webServer** \ + * **appServer** \ + * **databaseServer** \ + * **ldapServer** \ + * **smbServer** */ -export interface ErrorResponse { - /** - * Error information. - */ - error: ErrorModel; +export type ProcessRole = string; + +/** Known values of {@link MachineGroupType} that the service accepts. */ +export enum KnownMachineGroupType { + Unknown = "unknown", + AzureCs = "azure-cs", + AzureSf = "azure-sf", + AzureVmss = "azure-vmss", + UserStatic = "user-static" } /** - * Optional Parameters. + * Defines values for MachineGroupType. \ + * {@link KnownMachineGroupType} can be used interchangeably with MachineGroupType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **unknown** \ + * **azure-cs** \ + * **azure-sf** \ + * **azure-vmss** \ + * **user-static** */ -export interface MachinesListByWorkspaceOptionalParams extends msRest.RequestOptionsBase { - /** - * Specifies whether to return live resources (true) or inventory resources (false). Defaults to - * **true**. When retrieving live resources, the start time (`startTime`) and end time - * (`endTime`) of the desired interval should be included. When retrieving inventory resources, - * an optional timestamp (`timestamp`) parameter can be specified to return the version of each - * resource closest (not-after) that timestamp. Default value: true. - */ +export type MachineGroupType = string; + +/** Known values of {@link MapRequestKind} that the service accepts. */ +export enum KnownMapRequestKind { + MapSingleMachineDependency = "map:single-machine-dependency", + MapMachineGroupDependency = "map:machine-group-dependency", + MapMachineListDependency = "map:machine-list-dependency" +} + +/** + * Defines values for MapRequestKind. \ + * {@link KnownMapRequestKind} can be used interchangeably with MapRequestKind, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **map:single-machine-dependency** \ + * **map:machine-group-dependency** \ + * **map:machine-list-dependency** + */ +export type MapRequestKind = string; +/** Defines values for MonitoringState. */ +export type MonitoringState = "monitored" | "discovered"; +/** Defines values for VirtualizationState. */ +export type VirtualizationState = + | "unknown" + | "physical" + | "virtual" + | "hypervisor"; +/** Defines values for MachineRebootStatus. */ +export type MachineRebootStatus = "unknown" | "rebooted" | "notRebooted"; +/** Defines values for Accuracy. */ +export type Accuracy = "actual" | "estimated"; +/** Defines values for OperatingSystemFamily. */ +export type OperatingSystemFamily = + | "unknown" + | "windows" + | "linux" + | "solaris" + | "aix"; +/** Defines values for Bitness. */ +export type Bitness = "32bit" | "64bit"; +/** Defines values for VirtualMachineType. */ +export type VirtualMachineType = + | "unknown" + | "hyperv" + | "ldom" + | "lpar" + | "vmware" + | "virtualPc" + | "xen"; +/** Defines values for HypervisorType. */ +export type HypervisorType = "unknown" | "hyperv"; +/** Defines values for ConnectionFailureState. */ +export type ConnectionFailureState = "ok" | "failed" | "mixed"; +/** Defines values for AzureCloudServiceRoleType. */ +export type AzureCloudServiceRoleType = "unknown" | "worker" | "web"; + +/** Optional parameters. */ +export interface MachinesListByWorkspaceOptionalParams + extends coreClient.OperationOptions { + /** Specifies whether to return live resources (true) or inventory resources (false). Defaults to **true**. When retrieving live resources, the start time (`startTime`) and end time (`endTime`) of the desired interval should be included. When retrieving inventory resources, an optional timestamp (`timestamp`) parameter can be specified to return the version of each resource closest (not-after) that timestamp. */ live?: boolean; - /** - * UTC date and time specifying the start time of an interval. When not specified the service - * uses DateTime.UtcNow - 10m - */ + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ startTime?: Date; - /** - * UTC date and time specifying the end time of an interval. When not specified the service uses - * DateTime.UtcNow - */ + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ endTime?: Date; - /** - * UTC date and time specifying a time instance relative to which to evaluate each machine - * resource. Only applies when `live=false`. When not specified, the service uses - * DateTime.UtcNow. - */ + /** UTC date and time specifying a time instance relative to which to evaluate each machine resource. Only applies when `live=false`. When not specified, the service uses DateTime.UtcNow. */ timestamp?: Date; - /** - * Page size to use. When not specified, the default page size is 100 records. - */ + /** Page size to use. When not specified, the default page size is 100 records. */ top?: number; } -/** - * Optional Parameters. - */ -export interface MachinesGetOptionalParams extends msRest.RequestOptionsBase { - /** - * UTC date and time specifying a time instance relative to which to evaluate the machine - * resource. When not specified, the service uses DateTime.UtcNow. - */ +/** Contains response data for the listByWorkspace operation. */ +export type MachinesListByWorkspaceResponse = MachineCollection; + +/** Optional parameters. */ +export interface MachinesGetOptionalParams extends coreClient.OperationOptions { + /** UTC date and time specifying a time instance relative to which to evaluate the machine resource. When not specified, the service uses DateTime.UtcNow. */ timestamp?: Date; } -/** - * Optional Parameters. - */ -export interface MachinesGetLivenessOptionalParams extends msRest.RequestOptionsBase { - /** - * UTC date and time specifying the start time of an interval. When not specified the service - * uses DateTime.UtcNow - 10m - */ +/** Contains response data for the get operation. */ +export type MachinesGetResponse = Machine; + +/** Optional parameters. */ +export interface MachinesGetLivenessOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ startTime?: Date; - /** - * UTC date and time specifying the end time of an interval. When not specified the service uses - * DateTime.UtcNow - */ + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ endTime?: Date; } -/** - * Optional Parameters. - */ -export interface MachinesListConnectionsOptionalParams extends msRest.RequestOptionsBase { - /** - * UTC date and time specifying the start time of an interval. When not specified the service - * uses DateTime.UtcNow - 10m - */ +/** Contains response data for the getLiveness operation. */ +export type MachinesGetLivenessResponse = Liveness; + +/** Optional parameters. */ +export interface MachinesListConnectionsOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ startTime?: Date; - /** - * UTC date and time specifying the end time of an interval. When not specified the service uses - * DateTime.UtcNow - */ + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ endTime?: Date; } -/** - * Optional Parameters. - */ -export interface MachinesListProcessesOptionalParams extends msRest.RequestOptionsBase { - /** - * Specifies whether to return live resources (true) or inventory resources (false). Defaults to - * **true**. When retrieving live resources, the start time (`startTime`) and end time - * (`endTime`) of the desired interval should be included. When retrieving inventory resources, - * an optional timestamp (`timestamp`) parameter can be specified to return the version of each - * resource closest (not-after) that timestamp. Default value: true. - */ +/** Contains response data for the listConnections operation. */ +export type MachinesListConnectionsResponse = ConnectionCollection; + +/** Optional parameters. */ +export interface MachinesListProcessesOptionalParams + extends coreClient.OperationOptions { + /** Specifies whether to return live resources (true) or inventory resources (false). Defaults to **true**. When retrieving live resources, the start time (`startTime`) and end time (`endTime`) of the desired interval should be included. When retrieving inventory resources, an optional timestamp (`timestamp`) parameter can be specified to return the version of each resource closest (not-after) that timestamp. */ live?: boolean; - /** - * UTC date and time specifying the start time of an interval. When not specified the service - * uses DateTime.UtcNow - 10m - */ + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ startTime?: Date; - /** - * UTC date and time specifying the end time of an interval. When not specified the service uses - * DateTime.UtcNow - */ + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ endTime?: Date; - /** - * UTC date and time specifying a time instance relative to which to evaluate all process - * resource. Only applies when `live=false`. When not specified, the service uses - * DateTime.UtcNow. - */ + /** UTC date and time specifying a time instance relative to which to evaluate all process resource. Only applies when `live=false`. When not specified, the service uses DateTime.UtcNow. */ timestamp?: Date; } -/** - * Optional Parameters. - */ -export interface MachinesListPortsOptionalParams extends msRest.RequestOptionsBase { - /** - * UTC date and time specifying the start time of an interval. When not specified the service - * uses DateTime.UtcNow - 10m - */ +/** Contains response data for the listProcesses operation. */ +export type MachinesListProcessesResponse = ProcessCollection; + +/** Optional parameters. */ +export interface MachinesListPortsOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ startTime?: Date; - /** - * UTC date and time specifying the end time of an interval. When not specified the service uses - * DateTime.UtcNow - */ + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ endTime?: Date; } -/** - * Optional Parameters. - */ -export interface MachinesListMachineGroupMembershipOptionalParams extends msRest.RequestOptionsBase { - /** - * UTC date and time specifying the start time of an interval. When not specified the service - * uses DateTime.UtcNow - 10m - */ +/** Contains response data for the listPorts operation. */ +export type MachinesListPortsResponse = PortCollection; + +/** Optional parameters. */ +export interface MachinesListMachineGroupMembershipOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ startTime?: Date; - /** - * UTC date and time specifying the end time of an interval. When not specified the service uses - * DateTime.UtcNow - */ + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ endTime?: Date; } -/** - * Optional Parameters. - */ -export interface ProcessesGetOptionalParams extends msRest.RequestOptionsBase { - /** - * UTC date and time specifying a time instance relative to which to evaluate a resource. When - * not specified, the service uses DateTime.UtcNow. - */ +/** Contains response data for the listMachineGroupMembership operation. */ +export type MachinesListMachineGroupMembershipResponse = MachineGroupCollection; + +/** Optional parameters. */ +export interface MachinesListByWorkspaceNextOptionalParams + extends coreClient.OperationOptions { + /** Specifies whether to return live resources (true) or inventory resources (false). Defaults to **true**. When retrieving live resources, the start time (`startTime`) and end time (`endTime`) of the desired interval should be included. When retrieving inventory resources, an optional timestamp (`timestamp`) parameter can be specified to return the version of each resource closest (not-after) that timestamp. */ + live?: boolean; + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ + startTime?: Date; + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ + endTime?: Date; + /** UTC date and time specifying a time instance relative to which to evaluate each machine resource. Only applies when `live=false`. When not specified, the service uses DateTime.UtcNow. */ timestamp?: Date; -} - -/** - * Optional Parameters. - */ -export interface ProcessesGetLivenessOptionalParams extends msRest.RequestOptionsBase { - /** - * UTC date and time specifying the start time of an interval. When not specified the service - * uses DateTime.UtcNow - 10m - */ - startTime?: Date; - /** - * UTC date and time specifying the end time of an interval. When not specified the service uses - * DateTime.UtcNow - */ - endTime?: Date; -} - -/** - * Optional Parameters. - */ -export interface ProcessesListAcceptingPortsOptionalParams extends msRest.RequestOptionsBase { - /** - * UTC date and time specifying the start time of an interval. When not specified the service - * uses DateTime.UtcNow - 10m - */ - startTime?: Date; - /** - * UTC date and time specifying the end time of an interval. When not specified the service uses - * DateTime.UtcNow - */ - endTime?: Date; -} - -/** - * Optional Parameters. - */ -export interface ProcessesListConnectionsOptionalParams extends msRest.RequestOptionsBase { - /** - * UTC date and time specifying the start time of an interval. When not specified the service - * uses DateTime.UtcNow - 10m - */ - startTime?: Date; - /** - * UTC date and time specifying the end time of an interval. When not specified the service uses - * DateTime.UtcNow - */ - endTime?: Date; -} - -/** - * Optional Parameters. - */ -export interface PortsGetOptionalParams extends msRest.RequestOptionsBase { - /** - * UTC date and time specifying the start time of an interval. When not specified the service - * uses DateTime.UtcNow - 10m - */ - startTime?: Date; - /** - * UTC date and time specifying the end time of an interval. When not specified the service uses - * DateTime.UtcNow - */ - endTime?: Date; -} - -/** - * Optional Parameters. - */ -export interface PortsGetLivenessOptionalParams extends msRest.RequestOptionsBase { - /** - * UTC date and time specifying the start time of an interval. When not specified the service - * uses DateTime.UtcNow - 10m - */ - startTime?: Date; - /** - * UTC date and time specifying the end time of an interval. When not specified the service uses - * DateTime.UtcNow - */ - endTime?: Date; -} - -/** - * Optional Parameters. - */ -export interface PortsListAcceptingProcessesOptionalParams extends msRest.RequestOptionsBase { - /** - * UTC date and time specifying the start time of an interval. When not specified the service - * uses DateTime.UtcNow - 10m - */ - startTime?: Date; - /** - * UTC date and time specifying the end time of an interval. When not specified the service uses - * DateTime.UtcNow - */ - endTime?: Date; -} - -/** - * Optional Parameters. - */ -export interface PortsListConnectionsOptionalParams extends msRest.RequestOptionsBase { - /** - * UTC date and time specifying the start time of an interval. When not specified the service - * uses DateTime.UtcNow - 10m - */ - startTime?: Date; - /** - * UTC date and time specifying the end time of an interval. When not specified the service uses - * DateTime.UtcNow - */ - endTime?: Date; -} - -/** - * Optional Parameters. - */ -export interface ClientGroupsGetOptionalParams extends msRest.RequestOptionsBase { - /** - * UTC date and time specifying the start time of an interval. When not specified the service - * uses DateTime.UtcNow - 10m - */ - startTime?: Date; - /** - * UTC date and time specifying the end time of an interval. When not specified the service uses - * DateTime.UtcNow - */ - endTime?: Date; -} - -/** - * Optional Parameters. - */ -export interface ClientGroupsGetMembersCountOptionalParams extends msRest.RequestOptionsBase { - /** - * UTC date and time specifying the start time of an interval. When not specified the service - * uses DateTime.UtcNow - 10m - */ - startTime?: Date; - /** - * UTC date and time specifying the end time of an interval. When not specified the service uses - * DateTime.UtcNow - */ - endTime?: Date; -} - -/** - * Optional Parameters. - */ -export interface ClientGroupsListMembersOptionalParams extends msRest.RequestOptionsBase { - /** - * UTC date and time specifying the start time of an interval. When not specified the service - * uses DateTime.UtcNow - 10m - */ - startTime?: Date; - /** - * UTC date and time specifying the end time of an interval. When not specified the service uses - * DateTime.UtcNow - */ - endTime?: Date; - /** - * Page size to use. When not specified, the default page size is 100 records. - */ + /** Page size to use. When not specified, the default page size is 100 records. */ top?: number; } -/** - * Optional Parameters. - */ -export interface SummariesGetMachinesOptionalParams extends msRest.RequestOptionsBase { - /** - * UTC date and time specifying the start time of an interval. When not specified the service - * uses DateTime.UtcNow - 10m - */ +/** Contains response data for the listByWorkspaceNext operation. */ +export type MachinesListByWorkspaceNextResponse = MachineCollection; + +/** Optional parameters. */ +export interface MachinesListConnectionsNextOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ startTime?: Date; - /** - * UTC date and time specifying the end time of an interval. When not specified the service uses - * DateTime.UtcNow - */ + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ endTime?: Date; } -/** - * Optional Parameters. - */ -export interface MachineGroupsListByWorkspaceOptionalParams extends msRest.RequestOptionsBase { - /** - * UTC date and time specifying the start time of an interval. When not specified the service - * uses DateTime.UtcNow - 10m - */ +/** Contains response data for the listConnectionsNext operation. */ +export type MachinesListConnectionsNextResponse = ConnectionCollection; + +/** Optional parameters. */ +export interface MachinesListProcessesNextOptionalParams + extends coreClient.OperationOptions { + /** Specifies whether to return live resources (true) or inventory resources (false). Defaults to **true**. When retrieving live resources, the start time (`startTime`) and end time (`endTime`) of the desired interval should be included. When retrieving inventory resources, an optional timestamp (`timestamp`) parameter can be specified to return the version of each resource closest (not-after) that timestamp. */ + live?: boolean; + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ startTime?: Date; - /** - * UTC date and time specifying the end time of an interval. When not specified the service uses - * DateTime.UtcNow - */ + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ + endTime?: Date; + /** UTC date and time specifying a time instance relative to which to evaluate all process resource. Only applies when `live=false`. When not specified, the service uses DateTime.UtcNow. */ + timestamp?: Date; +} + +/** Contains response data for the listProcessesNext operation. */ +export type MachinesListProcessesNextResponse = ProcessCollection; + +/** Optional parameters. */ +export interface MachinesListPortsNextOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ + startTime?: Date; + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ endTime?: Date; } -/** - * Optional Parameters. - */ -export interface MachineGroupsGetOptionalParams extends msRest.RequestOptionsBase { - /** - * UTC date and time specifying the start time of an interval. When not specified the service - * uses DateTime.UtcNow - 10m - */ +/** Contains response data for the listPortsNext operation. */ +export type MachinesListPortsNextResponse = PortCollection; + +/** Optional parameters. */ +export interface MachinesListMachineGroupMembershipNextOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ startTime?: Date; - /** - * UTC date and time specifying the end time of an interval. When not specified the service uses - * DateTime.UtcNow - */ + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ endTime?: Date; } -/** - * An interface representing ServicemapManagementClientOptions. - */ -export interface ServicemapManagementClientOptions extends AzureServiceClientOptions { - baseUri?: string; +/** Contains response data for the listMachineGroupMembershipNext operation. */ +export type MachinesListMachineGroupMembershipNextResponse = MachineGroupCollection; + +/** Optional parameters. */ +export interface ProcessesGetOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying a time instance relative to which to evaluate a resource. When not specified, the service uses DateTime.UtcNow. */ + timestamp?: Date; } -/** - * @interface - * Collection of Machine resources. - * @extends Array - */ -export interface MachineCollection extends Array { - /** - * The URL to the next set of resources. - */ - nextLink?: string; +/** Contains response data for the get operation. */ +export type ProcessesGetResponse = Process; + +/** Optional parameters. */ +export interface ProcessesGetLivenessOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ + startTime?: Date; + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ + endTime?: Date; } -/** - * @interface - * Collection of Connection resources. - * @extends Array - */ -export interface ConnectionCollection extends Array { - /** - * The URL to the next set of resources. - */ - nextLink?: string; +/** Contains response data for the getLiveness operation. */ +export type ProcessesGetLivenessResponse = Liveness; + +/** Optional parameters. */ +export interface ProcessesListAcceptingPortsOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ + startTime?: Date; + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ + endTime?: Date; } -/** - * @interface - * Collection of Process resources. - * @extends Array - */ -export interface ProcessCollection extends Array { - /** - * The URL to the next set of resources. - */ - nextLink?: string; +/** Contains response data for the listAcceptingPorts operation. */ +export type ProcessesListAcceptingPortsResponse = PortCollection; + +/** Optional parameters. */ +export interface ProcessesListConnectionsOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ + startTime?: Date; + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ + endTime?: Date; } -/** - * @interface - * Collection of Port resources. - * @extends Array - */ -export interface PortCollection extends Array { - /** - * The URL to the next set of resources. - */ - nextLink?: string; +/** Contains response data for the listConnections operation. */ +export type ProcessesListConnectionsResponse = ConnectionCollection; + +/** Optional parameters. */ +export interface ProcessesListAcceptingPortsNextOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ + startTime?: Date; + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ + endTime?: Date; } -/** - * @interface - * Collection of Machine Group resources. - * @extends Array - */ -export interface MachineGroupCollection extends Array { - /** - * The URL to the next set of resources. - */ - nextLink?: string; +/** Contains response data for the listAcceptingPortsNext operation. */ +export type ProcessesListAcceptingPortsNextResponse = PortCollection; + +/** Optional parameters. */ +export interface ProcessesListConnectionsNextOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ + startTime?: Date; + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ + endTime?: Date; } -/** - * @interface - * Collection of ClientGroupMember resources. - * @extends Array - */ -export interface ClientGroupMembersCollection extends Array { - /** - * The URL to the next set of resources. - */ - nextLink?: string; +/** Contains response data for the listConnectionsNext operation. */ +export type ProcessesListConnectionsNextResponse = ConnectionCollection; + +/** Optional parameters. */ +export interface PortsGetOptionalParams extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ + startTime?: Date; + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ + endTime?: Date; } -/** - * Defines values for OperatingSystemFamily. - * Possible values include: 'unknown', 'windows', 'linux', 'solaris', 'aix' - * @readonly - * @enum {string} - */ -export type OperatingSystemFamily = 'unknown' | 'windows' | 'linux' | 'solaris' | 'aix'; - -/** - * Defines values for MonitoringState. - * Possible values include: 'monitored', 'discovered' - * @readonly - * @enum {string} - */ -export type MonitoringState = 'monitored' | 'discovered'; - -/** - * Defines values for VirtualizationState. - * Possible values include: 'unknown', 'physical', 'virtual', 'hypervisor' - * @readonly - * @enum {string} - */ -export type VirtualizationState = 'unknown' | 'physical' | 'virtual' | 'hypervisor'; - -/** - * Defines values for MachineRebootStatus. - * Possible values include: 'unknown', 'rebooted', 'notRebooted' - * @readonly - * @enum {string} - */ -export type MachineRebootStatus = 'unknown' | 'rebooted' | 'notRebooted'; - -/** - * Defines values for Accuracy. - * Possible values include: 'actual', 'estimated' - * @readonly - * @enum {string} - */ -export type Accuracy = 'actual' | 'estimated'; - -/** - * Defines values for Bitness. - * Possible values include: '32bit', '64bit' - * @readonly - * @enum {string} - */ -export type Bitness = '32bit' | '64bit'; - -/** - * Defines values for VirtualMachineType. - * Possible values include: 'unknown', 'hyperv', 'ldom', 'lpar', 'vmware', 'virtualPc', 'xen' - * @readonly - * @enum {string} - */ -export type VirtualMachineType = 'unknown' | 'hyperv' | 'ldom' | 'lpar' | 'vmware' | 'virtualPc' | 'xen'; - -/** - * Defines values for HypervisorType. - * Possible values include: 'unknown', 'hyperv' - * @readonly - * @enum {string} - */ -export type HypervisorType = 'unknown' | 'hyperv'; - -/** - * Defines values for ProcessRole. - * Possible values include: 'webServer', 'appServer', 'databaseServer', 'ldapServer', 'smbServer' - * @readonly - * @enum {string} - */ -export type ProcessRole = 'webServer' | 'appServer' | 'databaseServer' | 'ldapServer' | 'smbServer'; - -/** - * Defines values for MachineGroupType. - * Possible values include: 'unknown', 'azure-cs', 'azure-sf', 'azure-vmss', 'user-static' - * @readonly - * @enum {string} - */ -export type MachineGroupType = 'unknown' | 'azure-cs' | 'azure-sf' | 'azure-vmss' | 'user-static'; - -/** - * Defines values for ConnectionFailureState. - * Possible values include: 'ok', 'failed', 'mixed' - * @readonly - * @enum {string} - */ -export type ConnectionFailureState = 'ok' | 'failed' | 'mixed'; - -/** - * Defines values for AzureCloudServiceRoleType. - * Possible values include: 'unknown', 'worker', 'web' - * @readonly - * @enum {string} - */ -export type AzureCloudServiceRoleType = 'unknown' | 'worker' | 'web'; - -/** - * Defines values for Provider. - * Possible values include: 'azure' - * @readonly - * @enum {string} - */ -export type Provider = 'azure'; - -/** - * Defines values for Provider1. - * Possible values include: 'azure' - * @readonly - * @enum {string} - */ -export type Provider1 = 'azure'; - -/** - * Contains response data for the listByWorkspace operation. - */ -export type MachinesListByWorkspaceResponse = MachineCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MachineCollection; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type MachinesGetResponse = Machine & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Machine; - }; -}; - -/** - * Contains response data for the getLiveness operation. - */ -export type MachinesGetLivenessResponse = Liveness & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Liveness; - }; -}; - -/** - * Contains response data for the listConnections operation. - */ -export type MachinesListConnectionsResponse = ConnectionCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ConnectionCollection; - }; -}; - -/** - * Contains response data for the listProcesses operation. - */ -export type MachinesListProcessesResponse = ProcessCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ProcessCollection; - }; -}; - -/** - * Contains response data for the listPorts operation. - */ -export type MachinesListPortsResponse = PortCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PortCollection; - }; -}; - -/** - * Contains response data for the listMachineGroupMembership operation. - */ -export type MachinesListMachineGroupMembershipResponse = MachineGroupCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MachineGroupCollection; - }; -}; - -/** - * Contains response data for the listByWorkspaceNext operation. - */ -export type MachinesListByWorkspaceNextResponse = MachineCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MachineCollection; - }; -}; - -/** - * Contains response data for the listConnectionsNext operation. - */ -export type MachinesListConnectionsNextResponse = ConnectionCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ConnectionCollection; - }; -}; - -/** - * Contains response data for the listProcessesNext operation. - */ -export type MachinesListProcessesNextResponse = ProcessCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ProcessCollection; - }; -}; - -/** - * Contains response data for the listPortsNext operation. - */ -export type MachinesListPortsNextResponse = PortCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PortCollection; - }; -}; - -/** - * Contains response data for the listMachineGroupMembershipNext operation. - */ -export type MachinesListMachineGroupMembershipNextResponse = MachineGroupCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MachineGroupCollection; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type ProcessesGetResponse = Process & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Process; - }; -}; - -/** - * Contains response data for the getLiveness operation. - */ -export type ProcessesGetLivenessResponse = Liveness & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Liveness; - }; -}; - -/** - * Contains response data for the listAcceptingPorts operation. - */ -export type ProcessesListAcceptingPortsResponse = PortCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PortCollection; - }; -}; - -/** - * Contains response data for the listConnections operation. - */ -export type ProcessesListConnectionsResponse = ConnectionCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ConnectionCollection; - }; -}; - -/** - * Contains response data for the listAcceptingPortsNext operation. - */ -export type ProcessesListAcceptingPortsNextResponse = PortCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PortCollection; - }; -}; - -/** - * Contains response data for the listConnectionsNext operation. - */ -export type ProcessesListConnectionsNextResponse = ConnectionCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ConnectionCollection; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type PortsGetResponse = Port & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Port; - }; -}; - -/** - * Contains response data for the getLiveness operation. - */ -export type PortsGetLivenessResponse = Liveness & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Liveness; - }; -}; - -/** - * Contains response data for the listAcceptingProcesses operation. - */ -export type PortsListAcceptingProcessesResponse = ProcessCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ProcessCollection; - }; -}; - -/** - * Contains response data for the listConnections operation. - */ -export type PortsListConnectionsResponse = ConnectionCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ConnectionCollection; - }; -}; - -/** - * Contains response data for the listAcceptingProcessesNext operation. - */ -export type PortsListAcceptingProcessesNextResponse = ProcessCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ProcessCollection; - }; -}; - -/** - * Contains response data for the listConnectionsNext operation. - */ -export type PortsListConnectionsNextResponse = ConnectionCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ConnectionCollection; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type ClientGroupsGetResponse = ClientGroup & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ClientGroup; - }; -}; - -/** - * Contains response data for the getMembersCount operation. - */ -export type ClientGroupsGetMembersCountResponse = ClientGroupMembersCount & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ClientGroupMembersCount; - }; -}; - -/** - * Contains response data for the listMembers operation. - */ -export type ClientGroupsListMembersResponse = ClientGroupMembersCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ClientGroupMembersCollection; - }; -}; - -/** - * Contains response data for the listMembersNext operation. - */ -export type ClientGroupsListMembersNextResponse = ClientGroupMembersCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ClientGroupMembersCollection; - }; -}; - -/** - * Contains response data for the generate operation. - */ -export type MapsGenerateResponse = MapResponse & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MapResponse; - }; -}; - -/** - * Contains response data for the getMachines operation. - */ -export type SummariesGetMachinesResponse = MachinesSummary & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MachinesSummary; - }; -}; - -/** - * Contains response data for the listByWorkspace operation. - */ -export type MachineGroupsListByWorkspaceResponse = MachineGroupCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MachineGroupCollection; - }; -}; - -/** - * Contains response data for the create operation. - */ -export type MachineGroupsCreateResponse = MachineGroup & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MachineGroup; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type MachineGroupsGetResponse = MachineGroup & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MachineGroup; - }; -}; - -/** - * Contains response data for the update operation. - */ -export type MachineGroupsUpdateResponse = MachineGroup & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MachineGroup; - }; -}; - -/** - * Contains response data for the listByWorkspaceNext operation. - */ -export type MachineGroupsListByWorkspaceNextResponse = MachineGroupCollection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: MachineGroupCollection; - }; -}; +/** Contains response data for the get operation. */ +export type PortsGetResponse = Port; + +/** Optional parameters. */ +export interface PortsGetLivenessOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ + startTime?: Date; + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ + endTime?: Date; +} + +/** Contains response data for the getLiveness operation. */ +export type PortsGetLivenessResponse = Liveness; + +/** Optional parameters. */ +export interface PortsListAcceptingProcessesOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ + startTime?: Date; + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ + endTime?: Date; +} + +/** Contains response data for the listAcceptingProcesses operation. */ +export type PortsListAcceptingProcessesResponse = ProcessCollection; + +/** Optional parameters. */ +export interface PortsListConnectionsOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ + startTime?: Date; + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ + endTime?: Date; +} + +/** Contains response data for the listConnections operation. */ +export type PortsListConnectionsResponse = ConnectionCollection; + +/** Optional parameters. */ +export interface PortsListAcceptingProcessesNextOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ + startTime?: Date; + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ + endTime?: Date; +} + +/** Contains response data for the listAcceptingProcessesNext operation. */ +export type PortsListAcceptingProcessesNextResponse = ProcessCollection; + +/** Optional parameters. */ +export interface PortsListConnectionsNextOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ + startTime?: Date; + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ + endTime?: Date; +} + +/** Contains response data for the listConnectionsNext operation. */ +export type PortsListConnectionsNextResponse = ConnectionCollection; + +/** Optional parameters. */ +export interface ClientGroupsGetOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ + startTime?: Date; + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ + endTime?: Date; +} + +/** Contains response data for the get operation. */ +export type ClientGroupsGetResponse = ClientGroup; + +/** Optional parameters. */ +export interface ClientGroupsGetMembersCountOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ + startTime?: Date; + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ + endTime?: Date; +} + +/** Contains response data for the getMembersCount operation. */ +export type ClientGroupsGetMembersCountResponse = ClientGroupMembersCount; + +/** Optional parameters. */ +export interface ClientGroupsListMembersOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ + startTime?: Date; + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ + endTime?: Date; + /** Page size to use. When not specified, the default page size is 100 records. */ + top?: number; +} + +/** Contains response data for the listMembers operation. */ +export type ClientGroupsListMembersResponse = ClientGroupMembersCollection; + +/** Optional parameters. */ +export interface ClientGroupsListMembersNextOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ + startTime?: Date; + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ + endTime?: Date; + /** Page size to use. When not specified, the default page size is 100 records. */ + top?: number; +} + +/** Contains response data for the listMembersNext operation. */ +export type ClientGroupsListMembersNextResponse = ClientGroupMembersCollection; + +/** Optional parameters. */ +export interface MapsGenerateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the generate operation. */ +export type MapsGenerateResponse = MapResponse; + +/** Optional parameters. */ +export interface SummariesGetMachinesOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ + startTime?: Date; + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ + endTime?: Date; +} + +/** Contains response data for the getMachines operation. */ +export type SummariesGetMachinesResponse = MachinesSummary; + +/** Optional parameters. */ +export interface MachineGroupsListByWorkspaceOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ + startTime?: Date; + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ + endTime?: Date; +} + +/** Contains response data for the listByWorkspace operation. */ +export type MachineGroupsListByWorkspaceResponse = MachineGroupCollection; + +/** Optional parameters. */ +export interface MachineGroupsCreateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the create operation. */ +export type MachineGroupsCreateResponse = MachineGroup; + +/** Optional parameters. */ +export interface MachineGroupsGetOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ + startTime?: Date; + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ + endTime?: Date; +} + +/** Contains response data for the get operation. */ +export type MachineGroupsGetResponse = MachineGroup; + +/** Optional parameters. */ +export interface MachineGroupsUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type MachineGroupsUpdateResponse = MachineGroup; + +/** Optional parameters. */ +export interface MachineGroupsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Optional parameters. */ +export interface MachineGroupsListByWorkspaceNextOptionalParams + extends coreClient.OperationOptions { + /** UTC date and time specifying the start time of an interval. When not specified the service uses DateTime.UtcNow - 10m */ + startTime?: Date; + /** UTC date and time specifying the end time of an interval. When not specified the service uses DateTime.UtcNow */ + endTime?: Date; +} + +/** Contains response data for the listByWorkspaceNext operation. */ +export type MachineGroupsListByWorkspaceNextResponse = MachineGroupCollection; + +/** Optional parameters. */ +export interface ServiceMapOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/service-map/arm-servicemap/src/models/machineGroupsMappers.ts b/sdk/service-map/arm-servicemap/src/models/machineGroupsMappers.ts deleted file mode 100644 index 7a92af1662e..00000000000 --- a/sdk/service-map/arm-servicemap/src/models/machineGroupsMappers.ts +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - discriminators, - Acceptor, - AgentConfiguration, - AzureCloudServiceConfiguration, - AzureHostingConfiguration, - AzureProcessHostingConfiguration, - AzureServiceFabricClusterConfiguration, - AzureVmScaleSetConfiguration, - BaseResource, - ClientGroup, - ClientGroupMember, - ClientGroupReference, - Connection, - CoreResource, - ErrorModel, - ErrorResponse, - HostingConfiguration, - HypervisorConfiguration, - ImageConfiguration, - Ipv4NetworkInterface, - Ipv6NetworkInterface, - Machine, - MachineCountsByOperatingSystem, - MachineGroup, - MachineGroupCollection, - MachineReference, - MachineReferenceWithHints, - MachineResourcesConfiguration, - MachinesSummary, - NetworkConfiguration, - OperatingSystemConfiguration, - Port, - PortReference, - Process, - ProcessDetails, - ProcessHostedService, - ProcessHostingConfiguration, - ProcessReference, - ProcessUser, - Relationship, - Resource, - ResourceReference, - Summary, - Timezone, - VirtualMachineConfiguration -} from "../models/mappers"; diff --git a/sdk/service-map/arm-servicemap/src/models/machinesMappers.ts b/sdk/service-map/arm-servicemap/src/models/machinesMappers.ts deleted file mode 100644 index a67340add90..00000000000 --- a/sdk/service-map/arm-servicemap/src/models/machinesMappers.ts +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - discriminators, - Acceptor, - AgentConfiguration, - AzureCloudServiceConfiguration, - AzureHostingConfiguration, - AzureProcessHostingConfiguration, - AzureServiceFabricClusterConfiguration, - AzureVmScaleSetConfiguration, - BaseResource, - ClientGroup, - ClientGroupMember, - ClientGroupReference, - Connection, - ConnectionCollection, - CoreResource, - ErrorModel, - ErrorResponse, - HostingConfiguration, - HypervisorConfiguration, - ImageConfiguration, - Ipv4NetworkInterface, - Ipv6NetworkInterface, - Liveness, - Machine, - MachineCollection, - MachineCountsByOperatingSystem, - MachineGroup, - MachineGroupCollection, - MachineReference, - MachineReferenceWithHints, - MachineResourcesConfiguration, - MachinesSummary, - NetworkConfiguration, - OperatingSystemConfiguration, - Port, - PortCollection, - PortReference, - Process, - ProcessCollection, - ProcessDetails, - ProcessHostedService, - ProcessHostingConfiguration, - ProcessReference, - ProcessUser, - Relationship, - Resource, - ResourceReference, - Summary, - Timezone, - VirtualMachineConfiguration -} from "../models/mappers"; diff --git a/sdk/service-map/arm-servicemap/src/models/mappers.ts b/sdk/service-map/arm-servicemap/src/models/mappers.ts index 2a50f46a281..d0856a99c24 100644 --- a/sdk/service-map/arm-servicemap/src/models/mappers.ts +++ b/sdk/service-map/arm-servicemap/src/models/mappers.ts @@ -1,40 +1,32 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export const CloudError = CloudErrorMapper; -export const BaseResource = BaseResourceMapper; - -export const Resource: msRest.CompositeMapper = { - serializedName: "Resource", +export const MachineCollection: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Resource", + className: "MachineCollection", modelProperties: { - id: { - readOnly: true, - serializedName: "id", + value: { + serializedName: "value", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Machine" + } + } } }, - type: { - readOnly: true, - serializedName: "type", - type: { - name: "String" - } - }, - name: { - readOnly: true, - serializedName: "name", + nextLink: { + serializedName: "nextLink", type: { name: "String" } @@ -43,195 +35,7 @@ export const Resource: msRest.CompositeMapper = { } }; -export const ResourceReference: msRest.CompositeMapper = { - serializedName: "ResourceReference", - type: { - name: "Composite", - polymorphicDiscriminator: { - serializedName: "kind", - clientName: "kind" - }, - uberParent: "ResourceReference", - className: "ResourceReference", - modelProperties: { - id: { - required: true, - serializedName: "id", - type: { - name: "String" - } - }, - type: { - readOnly: true, - serializedName: "type", - type: { - name: "String" - } - }, - name: { - readOnly: true, - serializedName: "name", - type: { - name: "String" - } - }, - kind: { - required: true, - serializedName: "kind", - type: { - name: "String" - } - } - } - } -}; - -export const MachineReference: msRest.CompositeMapper = { - serializedName: "ref:machine", - type: { - name: "Composite", - polymorphicDiscriminator: ResourceReference.type.polymorphicDiscriminator, - uberParent: "ResourceReference", - className: "MachineReference", - modelProperties: { - ...ResourceReference.type.modelProperties - } - } -}; - -export const ProcessReference: msRest.CompositeMapper = { - serializedName: "ref:process", - type: { - name: "Composite", - polymorphicDiscriminator: ResourceReference.type.polymorphicDiscriminator, - uberParent: "ResourceReference", - className: "ProcessReference", - modelProperties: { - ...ResourceReference.type.modelProperties, - machine: { - readOnly: true, - serializedName: "properties.machine", - type: { - name: "Composite", - className: "MachineReference" - } - } - } - } -}; - -export const PortReference: msRest.CompositeMapper = { - serializedName: "ref:port", - type: { - name: "Composite", - polymorphicDiscriminator: ResourceReference.type.polymorphicDiscriminator, - uberParent: "ResourceReference", - className: "PortReference", - modelProperties: { - ...ResourceReference.type.modelProperties, - machine: { - readOnly: true, - serializedName: "properties.machine", - type: { - name: "Composite", - className: "MachineReference" - } - }, - ipAddress: { - readOnly: true, - serializedName: "properties.ipAddress", - type: { - name: "String" - } - }, - portNumber: { - serializedName: "properties.portNumber", - type: { - name: "Number" - } - } - } - } -}; - -export const MachineReferenceWithHints: msRest.CompositeMapper = { - serializedName: "ref:machinewithhints", - type: { - name: "Composite", - polymorphicDiscriminator: ResourceReference.type.polymorphicDiscriminator, - uberParent: "ResourceReference", - className: "MachineReferenceWithHints", - modelProperties: { - ...ResourceReference.type.modelProperties, - displayNameHint: { - readOnly: true, - serializedName: "properties.displayNameHint", - type: { - name: "String" - } - }, - osFamilyHint: { - readOnly: true, - serializedName: "properties.osFamilyHint", - type: { - name: "Enum", - allowedValues: [ - "unknown", - "windows", - "linux", - "solaris", - "aix" - ] - } - } - } - } -}; - -export const ClientGroupReference: msRest.CompositeMapper = { - serializedName: "ref:clientgroup", - type: { - name: "Composite", - polymorphicDiscriminator: ResourceReference.type.polymorphicDiscriminator, - uberParent: "ResourceReference", - className: "ClientGroupReference", - modelProperties: { - ...ResourceReference.type.modelProperties - } - } -}; - -export const CoreResource: msRest.CompositeMapper = { - serializedName: "CoreResource", - type: { - name: "Composite", - polymorphicDiscriminator: { - serializedName: "kind", - clientName: "kind" - }, - uberParent: "BaseResource", - className: "CoreResource", - modelProperties: { - ...Resource.type.modelProperties, - etag: { - serializedName: "etag", - type: { - name: "String" - } - }, - kind: { - required: true, - serializedName: "kind", - type: { - name: "String" - } - } - } - } -}; - -export const Timezone: msRest.CompositeMapper = { - serializedName: "Timezone", +export const Timezone: coreClient.CompositeMapper = { type: { name: "Composite", className: "Timezone", @@ -246,15 +50,14 @@ export const Timezone: msRest.CompositeMapper = { } }; -export const AgentConfiguration: msRest.CompositeMapper = { - serializedName: "AgentConfiguration", +export const AgentConfiguration: coreClient.CompositeMapper = { type: { name: "Composite", className: "AgentConfiguration", modelProperties: { agentId: { - required: true, serializedName: "agentId", + required: true, type: { name: "String" } @@ -281,11 +84,7 @@ export const AgentConfiguration: msRest.CompositeMapper = { serializedName: "rebootStatus", type: { name: "Enum", - allowedValues: [ - "unknown", - "rebooted", - "notRebooted" - ] + allowedValues: ["unknown", "rebooted", "notRebooted"] } }, clockGranularity: { @@ -298,8 +97,7 @@ export const AgentConfiguration: msRest.CompositeMapper = { } }; -export const MachineResourcesConfiguration: msRest.CompositeMapper = { - serializedName: "MachineResourcesConfiguration", +export const MachineResourcesConfiguration: coreClient.CompositeMapper = { type: { name: "Composite", className: "MachineResourcesConfiguration", @@ -326,59 +124,14 @@ export const MachineResourcesConfiguration: msRest.CompositeMapper = { serializedName: "cpuSpeedAccuracy", type: { name: "Enum", - allowedValues: [ - "actual", - "estimated" - ] + allowedValues: ["actual", "estimated"] } } } } }; -export const Ipv4NetworkInterface: msRest.CompositeMapper = { - serializedName: "Ipv4NetworkInterface", - type: { - name: "Composite", - className: "Ipv4NetworkInterface", - modelProperties: { - ipAddress: { - required: true, - serializedName: "ipAddress", - type: { - name: "String" - } - }, - subnetMask: { - serializedName: "subnetMask", - defaultValue: '255.255.255.255', - type: { - name: "String" - } - } - } - } -}; - -export const Ipv6NetworkInterface: msRest.CompositeMapper = { - serializedName: "Ipv6NetworkInterface", - type: { - name: "Composite", - className: "Ipv6NetworkInterface", - modelProperties: { - ipAddress: { - required: true, - serializedName: "ipAddress", - type: { - name: "String" - } - } - } - } -}; - -export const NetworkConfiguration: msRest.CompositeMapper = { - serializedName: "NetworkConfiguration", +export const NetworkConfiguration: coreClient.CompositeMapper = { type: { name: "Composite", className: "NetworkConfiguration", @@ -444,50 +197,78 @@ export const NetworkConfiguration: msRest.CompositeMapper = { } }; -export const OperatingSystemConfiguration: msRest.CompositeMapper = { - serializedName: "OperatingSystemConfiguration", +export const Ipv4NetworkInterface: coreClient.CompositeMapper = { type: { name: "Composite", - className: "OperatingSystemConfiguration", + className: "Ipv4NetworkInterface", modelProperties: { - family: { + ipAddress: { + serializedName: "ipAddress", required: true, - serializedName: "family", - type: { - name: "Enum", - allowedValues: [ - "unknown", - "windows", - "linux", - "solaris", - "aix" - ] - } - }, - fullName: { - required: true, - serializedName: "fullName", type: { name: "String" } }, - bitness: { - required: true, - serializedName: "bitness", + subnetMask: { + defaultValue: "255.255.255.255", + serializedName: "subnetMask", type: { - name: "Enum", - allowedValues: [ - "32bit", - "64bit" - ] + name: "String" } } } } }; -export const VirtualMachineConfiguration: msRest.CompositeMapper = { - serializedName: "VirtualMachineConfiguration", +export const Ipv6NetworkInterface: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Ipv6NetworkInterface", + modelProperties: { + ipAddress: { + serializedName: "ipAddress", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const OperatingSystemConfiguration: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperatingSystemConfiguration", + modelProperties: { + family: { + serializedName: "family", + required: true, + type: { + name: "Enum", + allowedValues: ["unknown", "windows", "linux", "solaris", "aix"] + } + }, + fullName: { + serializedName: "fullName", + required: true, + type: { + name: "String" + } + }, + bitness: { + serializedName: "bitness", + required: true, + type: { + name: "Enum", + allowedValues: ["32bit", "64bit"] + } + } + } + } +}; + +export const VirtualMachineConfiguration: coreClient.CompositeMapper = { type: { name: "Composite", className: "VirtualMachineConfiguration", @@ -529,8 +310,7 @@ export const VirtualMachineConfiguration: msRest.CompositeMapper = { } }; -export const HypervisorConfiguration: msRest.CompositeMapper = { - serializedName: "HypervisorConfiguration", +export const HypervisorConfiguration: coreClient.CompositeMapper = { type: { name: "Composite", className: "HypervisorConfiguration", @@ -539,10 +319,7 @@ export const HypervisorConfiguration: msRest.CompositeMapper = { serializedName: "hypervisorType", type: { name: "Enum", - allowedValues: [ - "unknown", - "hyperv" - ] + allowedValues: ["unknown", "hyperv"] } }, nativeHostMachineId: { @@ -555,25 +332,27 @@ export const HypervisorConfiguration: msRest.CompositeMapper = { } }; -export const HostingConfiguration: msRest.CompositeMapper = { - serializedName: "HostingConfiguration", +export const HostingConfiguration: coreClient.CompositeMapper = { type: { name: "Composite", + className: "HostingConfiguration", + uberParent: "HostingConfiguration", polymorphicDiscriminator: { serializedName: "kind", clientName: "kind" }, - uberParent: "HostingConfiguration", - className: "HostingConfiguration", modelProperties: { provider: { + defaultValue: "azure", + isConstant: true, serializedName: "provider", type: { name: "String" } }, kind: { - required: true, + defaultValue: "provider:azure", + isConstant: true, serializedName: "kind", type: { name: "String" @@ -583,139 +362,28 @@ export const HostingConfiguration: msRest.CompositeMapper = { } }; -export const Machine: msRest.CompositeMapper = { - serializedName: "machine", +export const Resource: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Machine", + className: "Resource", modelProperties: { - ...CoreResource.type.modelProperties, - timestamp: { - serializedName: "properties.timestamp", - type: { - name: "DateTime" - } - }, - monitoringState: { - serializedName: "properties.monitoringState", - type: { - name: "Enum", - allowedValues: [ - "monitored", - "discovered" - ] - } - }, - virtualizationState: { - serializedName: "properties.virtualizationState", - type: { - name: "Enum", - allowedValues: [ - "unknown", - "physical", - "virtual", - "hypervisor" - ] - } - }, - displayName: { - serializedName: "properties.displayName", + id: { + serializedName: "id", + readOnly: true, type: { name: "String" } }, - computerName: { - serializedName: "properties.computerName", + type: { + serializedName: "type", + readOnly: true, type: { name: "String" } }, - fullyQualifiedDomainName: { - serializedName: "properties.fullyQualifiedDomainName", - type: { - name: "String" - } - }, - bootTime: { - serializedName: "properties.bootTime", - type: { - name: "DateTime" - } - }, - timezone: { - serializedName: "properties.timezone", - type: { - name: "Composite", - className: "Timezone" - } - }, - agent: { - serializedName: "properties.agent", - type: { - name: "Composite", - className: "AgentConfiguration" - } - }, - resources: { - serializedName: "properties.resources", - type: { - name: "Composite", - className: "MachineResourcesConfiguration" - } - }, - networking: { - serializedName: "properties.networking", - type: { - name: "Composite", - className: "NetworkConfiguration" - } - }, - operatingSystem: { - serializedName: "properties.operatingSystem", - type: { - name: "Composite", - className: "OperatingSystemConfiguration" - } - }, - virtualMachine: { - serializedName: "properties.virtualMachine", - type: { - name: "Composite", - className: "VirtualMachineConfiguration" - } - }, - hypervisor: { - serializedName: "properties.hypervisor", - type: { - name: "Composite", - className: "HypervisorConfiguration" - } - }, - hosting: { - serializedName: "properties.hosting", - type: { - name: "Composite", - className: "HostingConfiguration" - } - } - } - } -}; - -export const ProcessHostedService: msRest.CompositeMapper = { - serializedName: "ProcessHostedService", - type: { - name: "Composite", - className: "ProcessHostedService", - modelProperties: { name: { serializedName: "name", - type: { - name: "String" - } - }, - displayName: { - serializedName: "displayName", + readOnly: true, type: { name: "String" } @@ -724,8 +392,206 @@ export const ProcessHostedService: msRest.CompositeMapper = { } }; -export const ProcessDetails: msRest.CompositeMapper = { - serializedName: "ProcessDetails", +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorModel" + } + } + } + } +}; + +export const ErrorModel: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorModel", + modelProperties: { + code: { + serializedName: "code", + required: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const Liveness: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Liveness", + modelProperties: { + startTime: { + serializedName: "startTime", + required: true, + type: { + name: "DateTime" + } + }, + endTime: { + serializedName: "endTime", + required: true, + type: { + name: "DateTime" + } + }, + live: { + serializedName: "live", + required: true, + type: { + name: "Boolean" + } + } + } + } +}; + +export const ConnectionCollection: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConnectionCollection", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Connection" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const ResourceReference: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceReference", + uberParent: "ResourceReference", + polymorphicDiscriminator: { + serializedName: "kind", + clientName: "kind" + }, + modelProperties: { + id: { + serializedName: "id", + required: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + kind: { + serializedName: "kind", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const RelationshipProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RelationshipProperties", + modelProperties: { + source: { + serializedName: "source", + type: { + name: "Composite", + className: "ResourceReference" + } + }, + destination: { + serializedName: "destination", + type: { + name: "Composite", + className: "ResourceReference" + } + }, + startTime: { + serializedName: "startTime", + type: { + name: "DateTime" + } + }, + endTime: { + serializedName: "endTime", + type: { + name: "DateTime" + } + } + } + } +}; + +export const ProcessCollection: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProcessCollection", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Process" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const ProcessDetails: coreClient.CompositeMapper = { type: { name: "Composite", className: "ProcessDetails", @@ -824,8 +690,28 @@ export const ProcessDetails: msRest.CompositeMapper = { } }; -export const ProcessUser: msRest.CompositeMapper = { - serializedName: "ProcessUser", +export const ProcessHostedService: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProcessHostedService", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + } + } + } +}; + +export const ProcessUser: coreClient.CompositeMapper = { type: { name: "Composite", className: "ProcessUser", @@ -846,25 +732,27 @@ export const ProcessUser: msRest.CompositeMapper = { } }; -export const ProcessHostingConfiguration: msRest.CompositeMapper = { - serializedName: "ProcessHostingConfiguration", +export const ProcessHostingConfiguration: coreClient.CompositeMapper = { type: { name: "Composite", + className: "ProcessHostingConfiguration", + uberParent: "ProcessHostingConfiguration", polymorphicDiscriminator: { serializedName: "kind", clientName: "kind" }, - uberParent: "ProcessHostingConfiguration", - className: "ProcessHostingConfiguration", modelProperties: { provider: { + defaultValue: "azure", + isConstant: true, serializedName: "provider", type: { name: "String" } }, kind: { - required: true, + defaultValue: "provider:azure", + isConstant: true, serializedName: "kind", type: { name: "String" @@ -874,349 +762,124 @@ export const ProcessHostingConfiguration: msRest.CompositeMapper = { } }; -export const Process: msRest.CompositeMapper = { - serializedName: "process", +export const PortCollection: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Process", + className: "PortCollection", modelProperties: { - ...CoreResource.type.modelProperties, - timestamp: { - serializedName: "properties.timestamp", - type: { - name: "DateTime" - } - }, - monitoringState: { - serializedName: "properties.monitoringState", - type: { - name: "Enum", - allowedValues: [ - "monitored", - "discovered" - ] - } - }, - machine: { - serializedName: "properties.machine", - type: { - name: "Composite", - className: "ResourceReference" - } - }, - executableName: { - serializedName: "properties.executableName", - type: { - name: "String" - } - }, - displayName: { - serializedName: "properties.displayName", - type: { - name: "String" - } - }, - startTime: { - serializedName: "properties.startTime", - type: { - name: "DateTime" - } - }, - role: { - serializedName: "properties.role", - type: { - name: "String" - } - }, - group: { - serializedName: "properties.group", - type: { - name: "String" - } - }, - details: { - serializedName: "properties.details", - type: { - name: "Composite", - className: "ProcessDetails" - } - }, - user: { - serializedName: "properties.user", - type: { - name: "Composite", - className: "ProcessUser" - } - }, - clientOf: { - serializedName: "properties.clientOf", - type: { - name: "Composite", - className: "ResourceReference" - } - }, - acceptorOf: { - serializedName: "properties.acceptorOf", - type: { - name: "Composite", - className: "ResourceReference" - } - }, - hosting: { - serializedName: "properties.hosting", - type: { - name: "Composite", - className: "ProcessHostingConfiguration" - } - } - } - } -}; - -export const Port: msRest.CompositeMapper = { - serializedName: "port", - type: { - name: "Composite", - className: "Port", - modelProperties: { - ...CoreResource.type.modelProperties, - monitoringState: { - serializedName: "properties.monitoringState", - type: { - name: "Enum", - allowedValues: [ - "monitored", - "discovered" - ] - } - }, - machine: { - serializedName: "properties.machine", - type: { - name: "Composite", - className: "ResourceReference" - } - }, - displayName: { - serializedName: "properties.displayName", - type: { - name: "String" - } - }, - ipAddress: { - serializedName: "properties.ipAddress", - type: { - name: "String" - } - }, - portNumber: { - serializedName: "properties.portNumber", - type: { - name: "Number" - } - } - } - } -}; - -export const ClientGroup: msRest.CompositeMapper = { - serializedName: "clientGroup", - type: { - name: "Composite", - className: "ClientGroup", - modelProperties: { - ...CoreResource.type.modelProperties, - clientsOf: { - required: true, - serializedName: "properties.clientsOf", - type: { - name: "Composite", - className: "ResourceReference" - } - } - } - } -}; - -export const ClientGroupMember: msRest.CompositeMapper = { - serializedName: "ClientGroupMember", - type: { - name: "Composite", - className: "ClientGroupMember", - modelProperties: { - ...Resource.type.modelProperties, - ipAddress: { - serializedName: "properties.ipAddress", - type: { - name: "String" - } - }, - port: { - serializedName: "properties.port", - type: { - name: "Composite", - className: "PortReference" - } - }, - processes: { - serializedName: "properties.processes", + value: { + serializedName: "value", type: { name: "Sequence", element: { type: { name: "Composite", - className: "ProcessReference" + className: "Port" } } } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } } } } }; -export const MachineGroup: msRest.CompositeMapper = { - serializedName: "machineGroup", +export const MachineGroupCollection: coreClient.CompositeMapper = { type: { name: "Composite", - className: "MachineGroup", + className: "MachineGroupCollection", modelProperties: { - ...CoreResource.type.modelProperties, - groupType: { - serializedName: "properties.groupType", + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MachineGroup" + } + } + } + }, + nextLink: { + serializedName: "nextLink", type: { name: "String" } - }, - displayName: { + } + } + } +}; + +export const ClientGroupMembersCount: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ClientGroupMembersCount", + modelProperties: { + startTime: { + serializedName: "startTime", + required: true, + type: { + name: "DateTime" + } + }, + endTime: { + serializedName: "endTime", + required: true, + type: { + name: "DateTime" + } + }, + groupId: { + serializedName: "groupId", required: true, - serializedName: "properties.displayName", - constraints: { - MaxLength: 256, - MinLength: 1 - }, type: { name: "String" } }, count: { - serializedName: "properties.count", + serializedName: "count", + required: true, type: { name: "Number" } }, - machines: { - serializedName: "properties.machines", + accuracy: { + serializedName: "accuracy", + required: true, + type: { + name: "Enum", + allowedValues: ["actual", "estimated"] + } + } + } + } +}; + +export const ClientGroupMembersCollection: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ClientGroupMembersCollection", + modelProperties: { + value: { + serializedName: "value", type: { name: "Sequence", element: { type: { name: "Composite", - className: "MachineReferenceWithHints" + className: "ClientGroupMember" } } } - } - } - } -}; - -export const Summary: msRest.CompositeMapper = { - serializedName: "Summary", - type: { - name: "Composite", - className: "Summary", - modelProperties: { - ...Resource.type.modelProperties - } - } -}; - -export const MachineCountsByOperatingSystem: msRest.CompositeMapper = { - serializedName: "MachineCountsByOperatingSystem", - type: { - name: "Composite", - className: "MachineCountsByOperatingSystem", - modelProperties: { - windows: { - required: true, - serializedName: "windows", - type: { - name: "Number" - } }, - linux: { - required: true, - serializedName: "linux", - type: { - name: "Number" - } - } - } - } -}; - -export const MachinesSummary: msRest.CompositeMapper = { - serializedName: "MachinesSummary", - type: { - name: "Composite", - className: "MachinesSummary", - modelProperties: { - ...Summary.type.modelProperties, - startTime: { - required: true, - serializedName: "properties.startTime", - type: { - name: "DateTime" - } - }, - endTime: { - required: true, - serializedName: "properties.endTime", - type: { - name: "DateTime" - } - }, - total: { - required: true, - serializedName: "properties.total", - type: { - name: "Number" - } - }, - live: { - required: true, - serializedName: "properties.live", - type: { - name: "Number" - } - }, - os: { - required: true, - serializedName: "properties.os", - type: { - name: "Composite", - className: "MachineCountsByOperatingSystem" - } - } - } - } -}; - -export const Relationship: msRest.CompositeMapper = { - serializedName: "Relationship", - type: { - name: "Composite", - polymorphicDiscriminator: { - serializedName: "kind", - clientName: "kind" - }, - uberParent: "BaseResource", - className: "Relationship", - modelProperties: { - ...Resource.type.modelProperties, - kind: { - required: true, - serializedName: "kind", + nextLink: { + serializedName: "nextLink", type: { name: "String" } @@ -1225,118 +888,220 @@ export const Relationship: msRest.CompositeMapper = { } }; -export const Connection: msRest.CompositeMapper = { - serializedName: "rel:connection", +export const MapRequest: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Connection", + className: "MapRequest", + uberParent: "MapRequest", + polymorphicDiscriminator: { + serializedName: "kind", + clientName: "kind" + }, modelProperties: { - ...Relationship.type.modelProperties, - source: { - required: true, - serializedName: "properties.source", - type: { - name: "Composite", - className: "ResourceReference" - } - }, - destination: { - required: true, - serializedName: "properties.destination", - type: { - name: "Composite", - className: "ResourceReference" - } - }, startTime: { - serializedName: "properties.startTime", + serializedName: "startTime", type: { name: "DateTime" } }, endTime: { - serializedName: "properties.endTime", + serializedName: "endTime", type: { name: "DateTime" } }, - serverPort: { - serializedName: "properties.serverPort", + kind: { + serializedName: "kind", + required: true, type: { - name: "Composite", - className: "PortReference" - } - }, - failureState: { - serializedName: "properties.failureState", - type: { - name: "Enum", - allowedValues: [ - "ok", - "failed", - "mixed" - ] + name: "String" } } } } }; -export const Acceptor: msRest.CompositeMapper = { - serializedName: "rel:acceptor", +export const MapResponse: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Acceptor", + className: "MapResponse", modelProperties: { - ...Relationship.type.modelProperties, - source: { - required: true, - serializedName: "properties.source", - type: { - name: "Composite", - className: "PortReference" - } - }, - destination: { - required: true, - serializedName: "properties.destination", - type: { - name: "Composite", - className: "ProcessReference" - } - }, startTime: { - serializedName: "properties.startTime", + serializedName: "startTime", + required: true, type: { name: "DateTime" } }, endTime: { - serializedName: "properties.endTime", + serializedName: "endTime", + required: true, type: { name: "DateTime" } + }, + map: { + serializedName: "map", + type: { + name: "Composite", + className: "Map" + } } } } }; -export const SummaryProperties: msRest.CompositeMapper = { - serializedName: "SummaryProperties", +export const Map: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Map", + modelProperties: { + nodes: { + serializedName: "nodes", + type: { + name: "Composite", + className: "MapNodes" + } + }, + edges: { + serializedName: "edges", + type: { + name: "Composite", + className: "MapEdges" + } + } + } + } +}; + +export const MapNodes: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MapNodes", + modelProperties: { + machines: { + serializedName: "machines", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Machine" + } + } + } + }, + processes: { + serializedName: "processes", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Process" + } + } + } + }, + ports: { + serializedName: "ports", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Port" + } + } + } + }, + clientGroups: { + serializedName: "clientGroups", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ClientGroup" + } + } + } + } + } + } +}; + +export const MapEdges: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MapEdges", + modelProperties: { + connections: { + serializedName: "connections", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Connection" + } + } + } + }, + acceptors: { + serializedName: "acceptors", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Acceptor" + } + } + } + } + } + } +}; + +export const MachineCountsByOperatingSystem: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MachineCountsByOperatingSystem", + modelProperties: { + windows: { + serializedName: "windows", + required: true, + type: { + name: "Number" + } + }, + linux: { + serializedName: "linux", + required: true, + type: { + name: "Number" + } + } + } + } +}; + +export const SummaryProperties: coreClient.CompositeMapper = { type: { name: "Composite", className: "SummaryProperties", modelProperties: { startTime: { - required: true, serializedName: "startTime", + required: true, type: { name: "DateTime" } }, endTime: { - required: true, serializedName: "endTime", + required: true, type: { name: "DateTime" } @@ -1345,46 +1110,7 @@ export const SummaryProperties: msRest.CompositeMapper = { } }; -export const RelationshipProperties: msRest.CompositeMapper = { - serializedName: "RelationshipProperties", - type: { - name: "Composite", - className: "RelationshipProperties", - modelProperties: { - source: { - required: true, - serializedName: "source", - type: { - name: "Composite", - className: "ResourceReference" - } - }, - destination: { - required: true, - serializedName: "destination", - type: { - name: "Composite", - className: "ResourceReference" - } - }, - startTime: { - serializedName: "startTime", - type: { - name: "DateTime" - } - }, - endTime: { - serializedName: "endTime", - type: { - name: "DateTime" - } - } - } - } -}; - -export const ImageConfiguration: msRest.CompositeMapper = { - serializedName: "ImageConfiguration", +export const ImageConfiguration: coreClient.CompositeMapper = { type: { name: "Composite", className: "ImageConfiguration", @@ -1417,8 +1143,7 @@ export const ImageConfiguration: msRest.CompositeMapper = { } }; -export const AzureCloudServiceConfiguration: msRest.CompositeMapper = { - serializedName: "AzureCloudServiceConfiguration", +export const AzureCloudServiceConfiguration: coreClient.CompositeMapper = { type: { name: "Composite", className: "AzureCloudServiceConfiguration", @@ -1451,19 +1176,14 @@ export const AzureCloudServiceConfiguration: msRest.CompositeMapper = { serializedName: "roleType", type: { name: "Enum", - allowedValues: [ - "unknown", - "worker", - "web" - ] + allowedValues: ["unknown", "worker", "web"] } } } } }; -export const AzureVmScaleSetConfiguration: msRest.CompositeMapper = { - serializedName: "AzureVmScaleSetConfiguration", +export const AzureVmScaleSetConfiguration: coreClient.CompositeMapper = { type: { name: "Composite", className: "AzureVmScaleSetConfiguration", @@ -1496,8 +1216,7 @@ export const AzureVmScaleSetConfiguration: msRest.CompositeMapper = { } }; -export const AzureServiceFabricClusterConfiguration: msRest.CompositeMapper = { - serializedName: "AzureServiceFabricClusterConfiguration", +export const AzureServiceFabricClusterConfiguration: coreClient.CompositeMapper = { type: { name: "Composite", className: "AzureServiceFabricClusterConfiguration", @@ -1518,13 +1237,14 @@ export const AzureServiceFabricClusterConfiguration: msRest.CompositeMapper = { } }; -export const AzureHostingConfiguration: msRest.CompositeMapper = { +export const AzureHostingConfiguration: coreClient.CompositeMapper = { serializedName: "provider:azure", type: { name: "Composite", - polymorphicDiscriminator: HostingConfiguration.type.polymorphicDiscriminator, - uberParent: "HostingConfiguration", className: "AzureHostingConfiguration", + uberParent: "HostingConfiguration", + polymorphicDiscriminator: + HostingConfiguration.type.polymorphicDiscriminator, modelProperties: { ...HostingConfiguration.type.modelProperties, vmId: { @@ -1613,13 +1333,242 @@ export const AzureHostingConfiguration: msRest.CompositeMapper = { } }; -export const AzureProcessHostingConfiguration: msRest.CompositeMapper = { +export const CoreResource: coreClient.CompositeMapper = { + serializedName: "CoreResource", + type: { + name: "Composite", + className: "CoreResource", + uberParent: "Resource", + polymorphicDiscriminator: { + serializedName: "kind", + clientName: "kind" + }, + modelProperties: { + ...Resource.type.modelProperties, + etag: { + serializedName: "etag", + type: { + name: "String" + } + }, + kind: { + serializedName: "kind", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const Relationship: coreClient.CompositeMapper = { + serializedName: "Relationship", + type: { + name: "Composite", + className: "Relationship", + uberParent: "Resource", + polymorphicDiscriminator: { + serializedName: "kind", + clientName: "kind" + }, + modelProperties: { + ...Resource.type.modelProperties, + kind: { + serializedName: "kind", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const ClientGroupMember: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ClientGroupMember", + modelProperties: { + ...Resource.type.modelProperties, + ipAddress: { + serializedName: "properties.ipAddress", + type: { + name: "String" + } + }, + port: { + serializedName: "properties.port", + type: { + name: "Composite", + className: "PortReference" + } + }, + processes: { + serializedName: "properties.processes", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ProcessReference" + } + } + } + } + } + } +}; + +export const Summary: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Summary", + modelProperties: { + ...Resource.type.modelProperties + } + } +}; + +export const MachineReference: coreClient.CompositeMapper = { + serializedName: "ref:machine", + type: { + name: "Composite", + className: "MachineReference", + uberParent: "ResourceReference", + polymorphicDiscriminator: ResourceReference.type.polymorphicDiscriminator, + modelProperties: { + ...ResourceReference.type.modelProperties + } + } +}; + +export const PortReference: coreClient.CompositeMapper = { + serializedName: "ref:port", + type: { + name: "Composite", + className: "PortReference", + uberParent: "ResourceReference", + polymorphicDiscriminator: ResourceReference.type.polymorphicDiscriminator, + modelProperties: { + ...ResourceReference.type.modelProperties, + machine: { + serializedName: "properties.machine", + type: { + name: "Composite", + className: "MachineReference" + } + }, + ipAddress: { + serializedName: "properties.ipAddress", + readOnly: true, + type: { + name: "String" + } + }, + portNumber: { + serializedName: "properties.portNumber", + type: { + name: "Number" + } + } + } + } +}; + +export const MachineReferenceWithHints: coreClient.CompositeMapper = { + serializedName: "ref:machinewithhints", + type: { + name: "Composite", + className: "MachineReferenceWithHints", + uberParent: "ResourceReference", + polymorphicDiscriminator: ResourceReference.type.polymorphicDiscriminator, + modelProperties: { + ...ResourceReference.type.modelProperties, + displayNameHint: { + serializedName: "properties.displayNameHint", + readOnly: true, + type: { + name: "String" + } + }, + osFamilyHint: { + serializedName: "properties.osFamilyHint", + readOnly: true, + type: { + name: "Enum", + allowedValues: ["unknown", "windows", "linux", "solaris", "aix"] + } + } + } + } +}; + +export const ProcessReference: coreClient.CompositeMapper = { + serializedName: "ref:process", + type: { + name: "Composite", + className: "ProcessReference", + uberParent: "ResourceReference", + polymorphicDiscriminator: ResourceReference.type.polymorphicDiscriminator, + modelProperties: { + ...ResourceReference.type.modelProperties, + machine: { + serializedName: "properties.machine", + type: { + name: "Composite", + className: "MachineReference" + } + } + } + } +}; + +export const ClientGroupReference: coreClient.CompositeMapper = { + serializedName: "ref:clientgroup", + type: { + name: "Composite", + className: "ClientGroupReference", + uberParent: "ResourceReference", + polymorphicDiscriminator: ResourceReference.type.polymorphicDiscriminator, + modelProperties: { + ...ResourceReference.type.modelProperties + } + } +}; + +export const ConnectionProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ConnectionProperties", + modelProperties: { + ...RelationshipProperties.type.modelProperties, + serverPort: { + serializedName: "serverPort", + type: { + name: "Composite", + className: "PortReference" + } + }, + failureState: { + serializedName: "failureState", + type: { + name: "Enum", + allowedValues: ["ok", "failed", "mixed"] + } + } + } + } +}; + +export const AzureProcessHostingConfiguration: coreClient.CompositeMapper = { serializedName: "provider:azure", type: { name: "Composite", - polymorphicDiscriminator: ProcessHostingConfiguration.type.polymorphicDiscriminator, - uberParent: "ProcessHostingConfiguration", className: "AzureProcessHostingConfiguration", + uberParent: "ProcessHostingConfiguration", + polymorphicDiscriminator: + ProcessHostingConfiguration.type.polymorphicDiscriminator, modelProperties: { ...ProcessHostingConfiguration.type.modelProperties, cloudService: { @@ -1633,216 +1582,36 @@ export const AzureProcessHostingConfiguration: msRest.CompositeMapper = { } }; -export const MapNodes: msRest.CompositeMapper = { - serializedName: "MapNodes", +export const SingleMachineDependencyMapRequest: coreClient.CompositeMapper = { + serializedName: "map:single-machine-dependency", type: { name: "Composite", - className: "MapNodes", + className: "SingleMachineDependencyMapRequest", + uberParent: "MapRequest", + polymorphicDiscriminator: MapRequest.type.polymorphicDiscriminator, modelProperties: { - machines: { - serializedName: "machines", + ...MapRequest.type.modelProperties, + machineId: { + serializedName: "machineId", + required: true, type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Machine" - } - } - } - }, - processes: { - serializedName: "processes", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Process" - } - } - } - }, - ports: { - serializedName: "ports", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Port" - } - } - } - }, - clientGroups: { - serializedName: "clientGroups", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ClientGroup" - } - } + name: "String" } } } } }; -export const MapEdges: msRest.CompositeMapper = { - serializedName: "MapEdges", - type: { - name: "Composite", - className: "MapEdges", - modelProperties: { - connections: { - serializedName: "connections", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Connection" - } - } - } - }, - acceptors: { - serializedName: "acceptors", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Acceptor" - } - } - } - } - } - } -}; - -export const Map: msRest.CompositeMapper = { - serializedName: "Map", - type: { - name: "Composite", - className: "Map", - modelProperties: { - nodes: { - required: true, - serializedName: "nodes", - type: { - name: "Composite", - className: "MapNodes" - } - }, - edges: { - required: true, - serializedName: "edges", - type: { - name: "Composite", - className: "MapEdges" - } - } - } - } -}; - -export const Liveness: msRest.CompositeMapper = { - serializedName: "Liveness", - type: { - name: "Composite", - className: "Liveness", - modelProperties: { - startTime: { - required: true, - serializedName: "startTime", - type: { - name: "DateTime" - } - }, - endTime: { - required: true, - serializedName: "endTime", - type: { - name: "DateTime" - } - }, - live: { - required: true, - serializedName: "live", - type: { - name: "Boolean" - } - } - } - } -}; - -export const MapRequest: msRest.CompositeMapper = { - serializedName: "MapRequest", +export const MultipleMachinesMapRequest: coreClient.CompositeMapper = { + serializedName: "MultipleMachinesMapRequest", type: { name: "Composite", + className: "MultipleMachinesMapRequest", + uberParent: "MapRequest", polymorphicDiscriminator: { serializedName: "kind", clientName: "kind" }, - uberParent: "MapRequest", - className: "MapRequest", - modelProperties: { - startTime: { - serializedName: "startTime", - type: { - name: "DateTime" - } - }, - endTime: { - serializedName: "endTime", - type: { - name: "DateTime" - } - }, - kind: { - required: true, - serializedName: "kind", - type: { - name: "String" - } - } - } - } -}; - -export const SingleMachineDependencyMapRequest: msRest.CompositeMapper = { - serializedName: "map:single-machine-dependency", - type: { - name: "Composite", - polymorphicDiscriminator: MapRequest.type.polymorphicDiscriminator, - uberParent: "MapRequest", - className: "SingleMachineDependencyMapRequest", - modelProperties: { - ...MapRequest.type.modelProperties, - machineId: { - required: true, - serializedName: "machineId", - type: { - name: "String" - } - } - } - } -}; - -export const MultipleMachinesMapRequest: msRest.CompositeMapper = { - serializedName: "MultipleMachinesMapRequest", - type: { - name: "Composite", - polymorphicDiscriminator: MapRequest.type.polymorphicDiscriminator, - uberParent: "MapRequest", - className: "MultipleMachinesMapRequest", modelProperties: { ...MapRequest.type.modelProperties, filterProcesses: { @@ -1855,18 +1624,505 @@ export const MultipleMachinesMapRequest: msRest.CompositeMapper = { } }; -export const MachineListMapRequest: msRest.CompositeMapper = { +export const MachinesSummaryProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MachinesSummaryProperties", + modelProperties: { + ...SummaryProperties.type.modelProperties, + total: { + serializedName: "total", + required: true, + type: { + name: "Number" + } + }, + live: { + serializedName: "live", + required: true, + type: { + name: "Number" + } + }, + os: { + serializedName: "os", + type: { + name: "Composite", + className: "MachineCountsByOperatingSystem" + } + } + } + } +}; + +export const Machine: coreClient.CompositeMapper = { + serializedName: "machine", + type: { + name: "Composite", + className: "Machine", + uberParent: "Resource", + polymorphicDiscriminator: Resource.type.polymorphicDiscriminator, + modelProperties: { + ...CoreResource.type.modelProperties, + timestamp: { + serializedName: "properties.timestamp", + type: { + name: "DateTime" + } + }, + monitoringState: { + serializedName: "properties.monitoringState", + type: { + name: "Enum", + allowedValues: ["monitored", "discovered"] + } + }, + virtualizationState: { + serializedName: "properties.virtualizationState", + type: { + name: "Enum", + allowedValues: ["unknown", "physical", "virtual", "hypervisor"] + } + }, + displayName: { + serializedName: "properties.displayName", + type: { + name: "String" + } + }, + computerName: { + serializedName: "properties.computerName", + type: { + name: "String" + } + }, + fullyQualifiedDomainName: { + serializedName: "properties.fullyQualifiedDomainName", + type: { + name: "String" + } + }, + bootTime: { + serializedName: "properties.bootTime", + type: { + name: "DateTime" + } + }, + timezone: { + serializedName: "properties.timezone", + type: { + name: "Composite", + className: "Timezone" + } + }, + agent: { + serializedName: "properties.agent", + type: { + name: "Composite", + className: "AgentConfiguration" + } + }, + resources: { + serializedName: "properties.resources", + type: { + name: "Composite", + className: "MachineResourcesConfiguration" + } + }, + networking: { + serializedName: "properties.networking", + type: { + name: "Composite", + className: "NetworkConfiguration" + } + }, + operatingSystem: { + serializedName: "properties.operatingSystem", + type: { + name: "Composite", + className: "OperatingSystemConfiguration" + } + }, + virtualMachine: { + serializedName: "properties.virtualMachine", + type: { + name: "Composite", + className: "VirtualMachineConfiguration" + } + }, + hypervisor: { + serializedName: "properties.hypervisor", + type: { + name: "Composite", + className: "HypervisorConfiguration" + } + }, + hosting: { + serializedName: "properties.hosting", + type: { + name: "Composite", + className: "HostingConfiguration" + } + } + } + } +}; + +export const Process: coreClient.CompositeMapper = { + serializedName: "process", + type: { + name: "Composite", + className: "Process", + uberParent: "Resource", + polymorphicDiscriminator: Resource.type.polymorphicDiscriminator, + modelProperties: { + ...CoreResource.type.modelProperties, + timestamp: { + serializedName: "properties.timestamp", + type: { + name: "DateTime" + } + }, + monitoringState: { + serializedName: "properties.monitoringState", + type: { + name: "Enum", + allowedValues: ["monitored", "discovered"] + } + }, + machine: { + serializedName: "properties.machine", + type: { + name: "Composite", + className: "ResourceReference" + } + }, + executableName: { + serializedName: "properties.executableName", + type: { + name: "String" + } + }, + displayName: { + serializedName: "properties.displayName", + type: { + name: "String" + } + }, + startTime: { + serializedName: "properties.startTime", + type: { + name: "DateTime" + } + }, + role: { + serializedName: "properties.role", + type: { + name: "String" + } + }, + group: { + serializedName: "properties.group", + type: { + name: "String" + } + }, + details: { + serializedName: "properties.details", + type: { + name: "Composite", + className: "ProcessDetails" + } + }, + user: { + serializedName: "properties.user", + type: { + name: "Composite", + className: "ProcessUser" + } + }, + clientOf: { + serializedName: "properties.clientOf", + type: { + name: "Composite", + className: "ResourceReference" + } + }, + acceptorOf: { + serializedName: "properties.acceptorOf", + type: { + name: "Composite", + className: "ResourceReference" + } + }, + hosting: { + serializedName: "properties.hosting", + type: { + name: "Composite", + className: "ProcessHostingConfiguration" + } + } + } + } +}; + +export const Port: coreClient.CompositeMapper = { + serializedName: "port", + type: { + name: "Composite", + className: "Port", + uberParent: "Resource", + polymorphicDiscriminator: Resource.type.polymorphicDiscriminator, + modelProperties: { + ...CoreResource.type.modelProperties, + monitoringState: { + serializedName: "properties.monitoringState", + type: { + name: "Enum", + allowedValues: ["monitored", "discovered"] + } + }, + machine: { + serializedName: "properties.machine", + type: { + name: "Composite", + className: "ResourceReference" + } + }, + displayName: { + serializedName: "properties.displayName", + type: { + name: "String" + } + }, + ipAddress: { + serializedName: "properties.ipAddress", + type: { + name: "String" + } + }, + portNumber: { + serializedName: "properties.portNumber", + type: { + name: "Number" + } + } + } + } +}; + +export const MachineGroup: coreClient.CompositeMapper = { + serializedName: "machineGroup", + type: { + name: "Composite", + className: "MachineGroup", + uberParent: "Resource", + polymorphicDiscriminator: Resource.type.polymorphicDiscriminator, + modelProperties: { + ...CoreResource.type.modelProperties, + groupType: { + serializedName: "properties.groupType", + type: { + name: "String" + } + }, + displayName: { + constraints: { + MaxLength: 256, + MinLength: 1 + }, + serializedName: "properties.displayName", + type: { + name: "String" + } + }, + count: { + serializedName: "properties.count", + type: { + name: "Number" + } + }, + machines: { + serializedName: "properties.machines", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MachineReferenceWithHints" + } + } + } + } + } + } +}; + +export const ClientGroup: coreClient.CompositeMapper = { + serializedName: "clientGroup", + type: { + name: "Composite", + className: "ClientGroup", + uberParent: "Resource", + polymorphicDiscriminator: Resource.type.polymorphicDiscriminator, + modelProperties: { + ...CoreResource.type.modelProperties, + clientsOf: { + serializedName: "properties.clientsOf", + type: { + name: "Composite", + className: "ResourceReference" + } + } + } + } +}; + +export const Connection: coreClient.CompositeMapper = { + serializedName: "rel:connection", + type: { + name: "Composite", + className: "Connection", + uberParent: "Resource", + polymorphicDiscriminator: Resource.type.polymorphicDiscriminator, + modelProperties: { + ...Relationship.type.modelProperties, + source: { + serializedName: "properties.source", + type: { + name: "Composite", + className: "ResourceReference" + } + }, + destination: { + serializedName: "properties.destination", + type: { + name: "Composite", + className: "ResourceReference" + } + }, + startTime: { + serializedName: "properties.startTime", + type: { + name: "DateTime" + } + }, + endTime: { + serializedName: "properties.endTime", + type: { + name: "DateTime" + } + }, + serverPort: { + serializedName: "properties.serverPort", + type: { + name: "Composite", + className: "PortReference" + } + }, + failureState: { + serializedName: "properties.failureState", + type: { + name: "Enum", + allowedValues: ["ok", "failed", "mixed"] + } + } + } + } +}; + +export const Acceptor: coreClient.CompositeMapper = { + serializedName: "rel:acceptor", + type: { + name: "Composite", + className: "Acceptor", + uberParent: "Resource", + polymorphicDiscriminator: Resource.type.polymorphicDiscriminator, + modelProperties: { + ...Relationship.type.modelProperties, + source: { + serializedName: "properties.source", + type: { + name: "Composite", + className: "PortReference" + } + }, + destination: { + serializedName: "properties.destination", + type: { + name: "Composite", + className: "ProcessReference" + } + }, + startTime: { + serializedName: "properties.startTime", + type: { + name: "DateTime" + } + }, + endTime: { + serializedName: "properties.endTime", + type: { + name: "DateTime" + } + } + } + } +}; + +export const MachinesSummary: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "MachinesSummary", + modelProperties: { + ...Summary.type.modelProperties, + startTime: { + serializedName: "properties.startTime", + type: { + name: "DateTime" + } + }, + endTime: { + serializedName: "properties.endTime", + type: { + name: "DateTime" + } + }, + total: { + serializedName: "properties.total", + type: { + name: "Number" + } + }, + live: { + serializedName: "properties.live", + type: { + name: "Number" + } + }, + os: { + serializedName: "properties.os", + type: { + name: "Composite", + className: "MachineCountsByOperatingSystem" + } + } + } + } +}; + +export const MachineListMapRequest: coreClient.CompositeMapper = { serializedName: "map:machine-list-dependency", type: { name: "Composite", - polymorphicDiscriminator: MapRequest.type.polymorphicDiscriminator, - uberParent: "MapRequest", className: "MachineListMapRequest", + uberParent: "MapRequest", + polymorphicDiscriminator: MapRequest.type.polymorphicDiscriminator, modelProperties: { ...MultipleMachinesMapRequest.type.modelProperties, machineIds: { - required: true, serializedName: "machineIds", + required: true, type: { name: "Sequence", element: { @@ -1880,18 +2136,18 @@ export const MachineListMapRequest: msRest.CompositeMapper = { } }; -export const MachineGroupMapRequest: msRest.CompositeMapper = { +export const MachineGroupMapRequest: coreClient.CompositeMapper = { serializedName: "map:machine-group-dependency", type: { name: "Composite", - polymorphicDiscriminator: MapRequest.type.polymorphicDiscriminator, - uberParent: "MapRequest", className: "MachineGroupMapRequest", + uberParent: "MapRequest", + polymorphicDiscriminator: MapRequest.type.polymorphicDiscriminator, modelProperties: { ...MultipleMachinesMapRequest.type.modelProperties, machineGroupId: { - required: true, serializedName: "machineGroupId", + required: true, type: { name: "String" } @@ -1900,320 +2156,29 @@ export const MachineGroupMapRequest: msRest.CompositeMapper = { } }; -export const MapResponse: msRest.CompositeMapper = { - serializedName: "MapResponse", - type: { - name: "Composite", - className: "MapResponse", - modelProperties: { - startTime: { - required: true, - serializedName: "startTime", - type: { - name: "DateTime" - } - }, - endTime: { - required: true, - serializedName: "endTime", - type: { - name: "DateTime" - } - }, - map: { - required: true, - serializedName: "map", - type: { - name: "Composite", - className: "Map" - } - } - } - } -}; - -export const ClientGroupMembersCount: msRest.CompositeMapper = { - serializedName: "ClientGroupMembersCount", - type: { - name: "Composite", - className: "ClientGroupMembersCount", - modelProperties: { - startTime: { - required: true, - serializedName: "startTime", - type: { - name: "DateTime" - } - }, - endTime: { - required: true, - serializedName: "endTime", - type: { - name: "DateTime" - } - }, - groupId: { - required: true, - serializedName: "groupId", - type: { - name: "String" - } - }, - count: { - required: true, - serializedName: "count", - type: { - name: "Number" - } - }, - accuracy: { - required: true, - serializedName: "accuracy", - type: { - name: "Enum", - allowedValues: [ - "actual", - "estimated" - ] - } - } - } - } -}; - -export const ErrorModel: msRest.CompositeMapper = { - serializedName: "Error", - type: { - name: "Composite", - className: "ErrorModel", - modelProperties: { - code: { - required: true, - serializedName: "code", - type: { - name: "String" - } - }, - message: { - serializedName: "message", - type: { - name: "String" - } - } - } - } -}; - -export const ErrorResponse: msRest.CompositeMapper = { - serializedName: "ErrorResponse", - type: { - name: "Composite", - className: "ErrorResponse", - modelProperties: { - error: { - required: true, - serializedName: "error", - type: { - name: "Composite", - className: "ErrorModel" - } - } - } - } -}; - -export const MachineCollection: msRest.CompositeMapper = { - serializedName: "MachineCollection", - type: { - name: "Composite", - className: "MachineCollection", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Machine" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const ConnectionCollection: msRest.CompositeMapper = { - serializedName: "ConnectionCollection", - type: { - name: "Composite", - className: "ConnectionCollection", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Connection" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const ProcessCollection: msRest.CompositeMapper = { - serializedName: "ProcessCollection", - type: { - name: "Composite", - className: "ProcessCollection", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Process" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const PortCollection: msRest.CompositeMapper = { - serializedName: "PortCollection", - type: { - name: "Composite", - className: "PortCollection", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Port" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const MachineGroupCollection: msRest.CompositeMapper = { - serializedName: "MachineGroupCollection", - type: { - name: "Composite", - className: "MachineGroupCollection", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "MachineGroup" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const ClientGroupMembersCollection: msRest.CompositeMapper = { - serializedName: "ClientGroupMembersCollection", - type: { - name: "Composite", - className: "ClientGroupMembersCollection", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ClientGroupMember" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const discriminators = { - 'ResourceReference' : ResourceReference, - 'ResourceReference.ref:machine' : MachineReference, - 'ResourceReference.ref:process' : ProcessReference, - 'ResourceReference.ref:port' : PortReference, - 'ResourceReference.ref:machinewithhints' : MachineReferenceWithHints, - 'ResourceReference.ref:clientgroup' : ClientGroupReference, - 'BaseResource.CoreResource' : CoreResource, - 'HostingConfiguration' : HostingConfiguration, - 'BaseResource.machine' : Machine, - 'ProcessHostingConfiguration' : ProcessHostingConfiguration, - 'BaseResource.process' : Process, - 'BaseResource.port' : Port, - 'BaseResource.clientGroup' : ClientGroup, - 'BaseResource.machineGroup' : MachineGroup, - 'BaseResource.Relationship' : Relationship, - 'BaseResource.rel:connection' : Connection, - 'BaseResource.rel:acceptor' : Acceptor, - 'HostingConfiguration.provider:azure' : AzureHostingConfiguration, - 'ProcessHostingConfiguration.provider:azure' : AzureProcessHostingConfiguration, - 'MapRequest' : MapRequest, - 'MapRequest.map:single-machine-dependency' : SingleMachineDependencyMapRequest, - 'MapRequest.MultipleMachinesMapRequest' : MultipleMachinesMapRequest, - 'MapRequest.map:machine-list-dependency' : MachineListMapRequest, - 'MapRequest.map:machine-group-dependency' : MachineGroupMapRequest - +export let discriminators = { + HostingConfiguration: HostingConfiguration, + ResourceReference: ResourceReference, + ProcessHostingConfiguration: ProcessHostingConfiguration, + MapRequest: MapRequest, + "HostingConfiguration.provider:azure": AzureHostingConfiguration, + "Resource.CoreResource": CoreResource, + "Resource.Relationship": Relationship, + "ResourceReference.ref:machine": MachineReference, + "ResourceReference.ref:port": PortReference, + "ResourceReference.ref:machinewithhints": MachineReferenceWithHints, + "ResourceReference.ref:process": ProcessReference, + "ResourceReference.ref:clientgroup": ClientGroupReference, + "ProcessHostingConfiguration.provider:azure": AzureProcessHostingConfiguration, + "MapRequest.map:single-machine-dependency": SingleMachineDependencyMapRequest, + "MapRequest.MultipleMachinesMapRequest": MultipleMachinesMapRequest, + "Resource.machine": Machine, + "Resource.process": Process, + "Resource.port": Port, + "Resource.machineGroup": MachineGroup, + "Resource.clientGroup": ClientGroup, + "Resource.rel:connection": Connection, + "Resource.rel:acceptor": Acceptor, + "MapRequest.map:machine-list-dependency": MachineListMapRequest, + "MapRequest.map:machine-group-dependency": MachineGroupMapRequest }; diff --git a/sdk/service-map/arm-servicemap/src/models/mapsMappers.ts b/sdk/service-map/arm-servicemap/src/models/mapsMappers.ts deleted file mode 100644 index 7987fadf3af..00000000000 --- a/sdk/service-map/arm-servicemap/src/models/mapsMappers.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - discriminators, - Acceptor, - AgentConfiguration, - AzureCloudServiceConfiguration, - AzureHostingConfiguration, - AzureProcessHostingConfiguration, - AzureServiceFabricClusterConfiguration, - AzureVmScaleSetConfiguration, - BaseResource, - ClientGroup, - ClientGroupMember, - ClientGroupReference, - Connection, - CoreResource, - ErrorModel, - ErrorResponse, - HostingConfiguration, - HypervisorConfiguration, - ImageConfiguration, - Ipv4NetworkInterface, - Ipv6NetworkInterface, - Machine, - MachineCountsByOperatingSystem, - MachineGroup, - MachineGroupMapRequest, - MachineListMapRequest, - MachineReference, - MachineReferenceWithHints, - MachineResourcesConfiguration, - MachinesSummary, - Map, - MapEdges, - MapNodes, - MapRequest, - MapResponse, - MultipleMachinesMapRequest, - NetworkConfiguration, - OperatingSystemConfiguration, - Port, - PortReference, - Process, - ProcessDetails, - ProcessHostedService, - ProcessHostingConfiguration, - ProcessReference, - ProcessUser, - Relationship, - Resource, - ResourceReference, - SingleMachineDependencyMapRequest, - Summary, - Timezone, - VirtualMachineConfiguration -} from "../models/mappers"; diff --git a/sdk/service-map/arm-servicemap/src/models/parameters.ts b/sdk/service-map/arm-servicemap/src/models/parameters.ts index 1dd34272265..0efb371b17c 100644 --- a/sdk/service-map/arm-servicemap/src/models/parameters.ts +++ b/sdk/service-map/arm-servicemap/src/models/parameters.ts @@ -1,161 +1,113 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + MapRequest as MapRequestMapper, + MachineGroup as MachineGroupMapper +} from "../models/mappers"; -export const acceptLanguage: msRest.OperationParameter = { - parameterPath: "acceptLanguage", +export const accept: OperationParameter = { + parameterPath: "accept", mapper: { - serializedName: "accept-language", - defaultValue: 'en-US', + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", type: { name: "String" } } }; -export const apiVersion: msRest.OperationQueryParameter = { - parameterPath: "apiVersion", + +export const $host: OperationURLParameter = { + parameterPath: "$host", mapper: { + serializedName: "$host", required: true, - serializedName: "api-version", - type: { - name: "String" - } - } -}; -export const clientGroupName: msRest.OperationURLParameter = { - parameterPath: "clientGroupName", - mapper: { - required: true, - serializedName: "clientGroupName", - constraints: { - MaxLength: 256, - MinLength: 3 - }, - type: { - name: "String" - } - } -}; -export const endTime: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "endTime" - ], - mapper: { - serializedName: "endTime", - type: { - name: "DateTime" - } - } -}; -export const live: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "live" - ], - mapper: { - serializedName: "live", - defaultValue: true, - type: { - name: "Boolean" - } - } -}; -export const machineGroupName: msRest.OperationURLParameter = { - parameterPath: "machineGroupName", - mapper: { - required: true, - serializedName: "machineGroupName", - constraints: { - MaxLength: 36, - MinLength: 36 - }, - type: { - name: "String" - } - } -}; -export const machineName: msRest.OperationURLParameter = { - parameterPath: "machineName", - mapper: { - required: true, - serializedName: "machineName", - constraints: { - MaxLength: 64, - MinLength: 3 - }, - type: { - name: "String" - } - } -}; -export const nextPageLink: msRest.OperationURLParameter = { - parameterPath: "nextPageLink", - mapper: { - required: true, - serializedName: "nextLink", type: { name: "String" } }, skipEncoding: true }; -export const portName: msRest.OperationURLParameter = { - parameterPath: "portName", + +export const subscriptionId: OperationURLParameter = { + parameterPath: "subscriptionId", mapper: { + serializedName: "subscriptionId", required: true, - serializedName: "portName", - constraints: { - MaxLength: 64, - MinLength: 3 - }, type: { name: "String" } } }; -export const processName: msRest.OperationURLParameter = { - parameterPath: "processName", - mapper: { - required: true, - serializedName: "processName", - constraints: { - MaxLength: 128, - MinLength: 3 - }, - type: { - name: "String" - } - } -}; -export const resourceGroupName: msRest.OperationURLParameter = { + +export const resourceGroupName: OperationURLParameter = { parameterPath: "resourceGroupName", mapper: { - required: true, - serializedName: "resourceGroupName", constraints: { + Pattern: new RegExp("[a-zA-Z0-9_-]+"), MaxLength: 64, - MinLength: 1, - Pattern: /[a-zA-Z0-9_-]+/ + MinLength: 1 }, + serializedName: "resourceGroupName", + required: true, type: { name: "String" } } }; -export const startTime: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "startTime" - ], + +export const workspaceName: OperationURLParameter = { + parameterPath: "workspaceName", + mapper: { + constraints: { + Pattern: new RegExp("[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]"), + MaxLength: 63, + MinLength: 3 + }, + serializedName: "workspaceName", + required: true, + type: { + name: "String" + } + } +}; + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", + mapper: { + defaultValue: "2015-11-01-preview", + isConstant: true, + serializedName: "api-version", + type: { + name: "String" + } + } +}; + +export const live: OperationQueryParameter = { + parameterPath: ["options", "live"], + mapper: { + defaultValue: true, + serializedName: "live", + type: { + name: "Boolean" + } + } +}; + +export const startTime: OperationQueryParameter = { + parameterPath: ["options", "startTime"], mapper: { serializedName: "startTime", type: { @@ -163,21 +115,19 @@ export const startTime: msRest.OperationQueryParameter = { } } }; -export const subscriptionId: msRest.OperationURLParameter = { - parameterPath: "subscriptionId", + +export const endTime: OperationQueryParameter = { + parameterPath: ["options", "endTime"], mapper: { - required: true, - serializedName: "subscriptionId", + serializedName: "endTime", type: { - name: "String" + name: "DateTime" } } }; -export const timestamp: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "timestamp" - ], + +export const timestamp: OperationQueryParameter = { + parameterPath: ["options", "timestamp"], mapper: { serializedName: "timestamp", type: { @@ -185,32 +135,124 @@ export const timestamp: msRest.OperationQueryParameter = { } } }; -export const top: msRest.OperationQueryParameter = { - parameterPath: [ - "options", - "top" - ], + +export const top: OperationQueryParameter = { + parameterPath: ["options", "top"], mapper: { - serializedName: "$top", constraints: { InclusiveMaximum: 200, InclusiveMinimum: 1 }, + serializedName: "$top", type: { name: "Number" } } }; -export const workspaceName: msRest.OperationURLParameter = { - parameterPath: "workspaceName", + +export const machineName: OperationURLParameter = { + parameterPath: "machineName", mapper: { - required: true, - serializedName: "workspaceName", constraints: { - MaxLength: 63, - MinLength: 3, - Pattern: /[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]/ + MaxLength: 64, + MinLength: 3 }, + serializedName: "machineName", + required: true, + type: { + name: "String" + } + } +}; + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", + mapper: { + serializedName: "nextLink", + required: true, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const processName: OperationURLParameter = { + parameterPath: "processName", + mapper: { + constraints: { + MaxLength: 128, + MinLength: 3 + }, + serializedName: "processName", + required: true, + type: { + name: "String" + } + } +}; + +export const portName: OperationURLParameter = { + parameterPath: "portName", + mapper: { + constraints: { + MaxLength: 64, + MinLength: 3 + }, + serializedName: "portName", + required: true, + type: { + name: "String" + } + } +}; + +export const clientGroupName: OperationURLParameter = { + parameterPath: "clientGroupName", + mapper: { + constraints: { + MaxLength: 256, + MinLength: 3 + }, + serializedName: "clientGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const request: OperationParameter = { + parameterPath: "request", + mapper: MapRequestMapper +}; + +export const machineGroup: OperationParameter = { + parameterPath: "machineGroup", + mapper: MachineGroupMapper +}; + +export const machineGroupName: OperationURLParameter = { + parameterPath: "machineGroupName", + mapper: { + constraints: { + MaxLength: 36, + MinLength: 36 + }, + serializedName: "machineGroupName", + required: true, type: { name: "String" } diff --git a/sdk/service-map/arm-servicemap/src/models/portsMappers.ts b/sdk/service-map/arm-servicemap/src/models/portsMappers.ts deleted file mode 100644 index a229225dba5..00000000000 --- a/sdk/service-map/arm-servicemap/src/models/portsMappers.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - discriminators, - Acceptor, - AgentConfiguration, - AzureCloudServiceConfiguration, - AzureHostingConfiguration, - AzureProcessHostingConfiguration, - AzureServiceFabricClusterConfiguration, - AzureVmScaleSetConfiguration, - BaseResource, - ClientGroup, - ClientGroupMember, - ClientGroupReference, - Connection, - ConnectionCollection, - CoreResource, - ErrorModel, - ErrorResponse, - HostingConfiguration, - HypervisorConfiguration, - ImageConfiguration, - Ipv4NetworkInterface, - Ipv6NetworkInterface, - Liveness, - Machine, - MachineCountsByOperatingSystem, - MachineGroup, - MachineReference, - MachineReferenceWithHints, - MachineResourcesConfiguration, - MachinesSummary, - NetworkConfiguration, - OperatingSystemConfiguration, - Port, - PortReference, - Process, - ProcessCollection, - ProcessDetails, - ProcessHostedService, - ProcessHostingConfiguration, - ProcessReference, - ProcessUser, - Relationship, - Resource, - ResourceReference, - Summary, - Timezone, - VirtualMachineConfiguration -} from "../models/mappers"; diff --git a/sdk/service-map/arm-servicemap/src/models/processesMappers.ts b/sdk/service-map/arm-servicemap/src/models/processesMappers.ts deleted file mode 100644 index 06bd1000293..00000000000 --- a/sdk/service-map/arm-servicemap/src/models/processesMappers.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - discriminators, - Acceptor, - AgentConfiguration, - AzureCloudServiceConfiguration, - AzureHostingConfiguration, - AzureProcessHostingConfiguration, - AzureServiceFabricClusterConfiguration, - AzureVmScaleSetConfiguration, - BaseResource, - ClientGroup, - ClientGroupMember, - ClientGroupReference, - Connection, - ConnectionCollection, - CoreResource, - ErrorModel, - ErrorResponse, - HostingConfiguration, - HypervisorConfiguration, - ImageConfiguration, - Ipv4NetworkInterface, - Ipv6NetworkInterface, - Liveness, - Machine, - MachineCountsByOperatingSystem, - MachineGroup, - MachineReference, - MachineReferenceWithHints, - MachineResourcesConfiguration, - MachinesSummary, - NetworkConfiguration, - OperatingSystemConfiguration, - Port, - PortCollection, - PortReference, - Process, - ProcessDetails, - ProcessHostedService, - ProcessHostingConfiguration, - ProcessReference, - ProcessUser, - Relationship, - Resource, - ResourceReference, - Summary, - Timezone, - VirtualMachineConfiguration -} from "../models/mappers"; diff --git a/sdk/service-map/arm-servicemap/src/models/summariesMappers.ts b/sdk/service-map/arm-servicemap/src/models/summariesMappers.ts deleted file mode 100644 index 715b7e40127..00000000000 --- a/sdk/service-map/arm-servicemap/src/models/summariesMappers.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - discriminators, - Acceptor, - AgentConfiguration, - AzureCloudServiceConfiguration, - AzureHostingConfiguration, - AzureProcessHostingConfiguration, - AzureServiceFabricClusterConfiguration, - AzureVmScaleSetConfiguration, - BaseResource, - ClientGroup, - ClientGroupMember, - ClientGroupReference, - Connection, - CoreResource, - ErrorModel, - ErrorResponse, - HostingConfiguration, - HypervisorConfiguration, - ImageConfiguration, - Ipv4NetworkInterface, - Ipv6NetworkInterface, - Machine, - MachineCountsByOperatingSystem, - MachineGroup, - MachineReference, - MachineReferenceWithHints, - MachineResourcesConfiguration, - MachinesSummary, - NetworkConfiguration, - OperatingSystemConfiguration, - Port, - PortReference, - Process, - ProcessDetails, - ProcessHostedService, - ProcessHostingConfiguration, - ProcessReference, - ProcessUser, - Relationship, - Resource, - ResourceReference, - Summary, - Timezone, - VirtualMachineConfiguration -} from "../models/mappers"; diff --git a/sdk/service-map/arm-servicemap/src/operations/clientGroups.ts b/sdk/service-map/arm-servicemap/src/operations/clientGroups.ts index fe38b7858d5..fb990f2c4b4 100644 --- a/sdk/service-map/arm-servicemap/src/operations/clientGroups.ts +++ b/sdk/service-map/arm-servicemap/src/operations/clientGroups.ts @@ -1,65 +1,139 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/clientGroupsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { ClientGroups } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { ServicemapManagementClientContext } from "../servicemapManagementClientContext"; +import { ServiceMap } from "../serviceMap"; +import { + ClientGroupMember, + ClientGroupsListMembersNextOptionalParams, + ClientGroupsListMembersOptionalParams, + ClientGroupsGetOptionalParams, + ClientGroupsGetResponse, + ClientGroupsGetMembersCountOptionalParams, + ClientGroupsGetMembersCountResponse, + ClientGroupsListMembersResponse, + ClientGroupsListMembersNextResponse +} from "../models"; -/** Class representing a ClientGroups. */ -export class ClientGroups { - private readonly client: ServicemapManagementClientContext; +/// +/** Class containing ClientGroups operations. */ +export class ClientGroupsImpl implements ClientGroups { + private readonly client: ServiceMap; /** - * Create a ClientGroups. - * @param {ServicemapManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class ClientGroups class. + * @param client Reference to the service client */ - constructor(client: ServicemapManagementClientContext) { + constructor(client: ServiceMap) { this.client = client; } + /** + * Returns the members of the client group during the specified time interval. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param clientGroupName Client Group resource name. + * @param options The options parameters. + */ + public listMembers( + resourceGroupName: string, + workspaceName: string, + clientGroupName: string, + options?: ClientGroupsListMembersOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listMembersPagingAll( + resourceGroupName, + workspaceName, + clientGroupName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listMembersPagingPage( + resourceGroupName, + workspaceName, + clientGroupName, + options + ); + } + }; + } + + private async *listMembersPagingPage( + resourceGroupName: string, + workspaceName: string, + clientGroupName: string, + options?: ClientGroupsListMembersOptionalParams + ): AsyncIterableIterator { + let result = await this._listMembers( + resourceGroupName, + workspaceName, + clientGroupName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listMembersNext( + resourceGroupName, + workspaceName, + clientGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listMembersPagingAll( + resourceGroupName: string, + workspaceName: string, + clientGroupName: string, + options?: ClientGroupsListMembersOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listMembersPagingPage( + resourceGroupName, + workspaceName, + clientGroupName, + options + )) { + yield* page; + } + } + /** * Retrieves the specified client group * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. * @param clientGroupName Client Group resource name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, workspaceName: string, clientGroupName: string, options?: Models.ClientGroupsGetOptionalParams): Promise; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param clientGroupName Client Group resource name. - * @param callback The callback - */ - get(resourceGroupName: string, workspaceName: string, clientGroupName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param clientGroupName Client Group resource name. - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, workspaceName: string, clientGroupName: string, options: Models.ClientGroupsGetOptionalParams, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, workspaceName: string, clientGroupName: string, options?: Models.ClientGroupsGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + workspaceName: string, + clientGroupName: string, + options?: ClientGroupsGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - workspaceName, - clientGroupName, - options - }, - getOperationSpec, - callback) as Promise; + { resourceGroupName, workspaceName, clientGroupName, options }, + getOperationSpec + ); } /** @@ -67,35 +141,18 @@ export class ClientGroups { * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. * @param clientGroupName Client Group resource name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - getMembersCount(resourceGroupName: string, workspaceName: string, clientGroupName: string, options?: Models.ClientGroupsGetMembersCountOptionalParams): Promise; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param clientGroupName Client Group resource name. - * @param callback The callback - */ - getMembersCount(resourceGroupName: string, workspaceName: string, clientGroupName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param clientGroupName Client Group resource name. - * @param options The optional parameters - * @param callback The callback - */ - getMembersCount(resourceGroupName: string, workspaceName: string, clientGroupName: string, options: Models.ClientGroupsGetMembersCountOptionalParams, callback: msRest.ServiceCallback): void; - getMembersCount(resourceGroupName: string, workspaceName: string, clientGroupName: string, options?: Models.ClientGroupsGetMembersCountOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + getMembersCount( + resourceGroupName: string, + workspaceName: string, + clientGroupName: string, + options?: ClientGroupsGetMembersCountOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - workspaceName, - clientGroupName, - options - }, - getMembersCountOperationSpec, - callback) as Promise; + { resourceGroupName, workspaceName, clientGroupName, options }, + getMembersCountOperationSpec + ); } /** @@ -103,85 +160,48 @@ export class ClientGroups { * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. * @param clientGroupName Client Group resource name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listMembers(resourceGroupName: string, workspaceName: string, clientGroupName: string, options?: Models.ClientGroupsListMembersOptionalParams): Promise; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param clientGroupName Client Group resource name. - * @param callback The callback - */ - listMembers(resourceGroupName: string, workspaceName: string, clientGroupName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param clientGroupName Client Group resource name. - * @param options The optional parameters - * @param callback The callback - */ - listMembers(resourceGroupName: string, workspaceName: string, clientGroupName: string, options: Models.ClientGroupsListMembersOptionalParams, callback: msRest.ServiceCallback): void; - listMembers(resourceGroupName: string, workspaceName: string, clientGroupName: string, options?: Models.ClientGroupsListMembersOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listMembers( + resourceGroupName: string, + workspaceName: string, + clientGroupName: string, + options?: ClientGroupsListMembersOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - workspaceName, - clientGroupName, - options - }, - listMembersOperationSpec, - callback) as Promise; + { resourceGroupName, workspaceName, clientGroupName, options }, + listMembersOperationSpec + ); } /** - * Returns the members of the client group during the specified time interval. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * ListMembersNext + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param clientGroupName Client Group resource name. + * @param nextLink The nextLink from the previous successful call to the ListMembers method. + * @param options The options parameters. */ - listMembersNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listMembersNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listMembersNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listMembersNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listMembersNext( + resourceGroupName: string, + workspaceName: string, + clientGroupName: string, + nextLink: string, + options?: ClientGroupsListMembersNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listMembersNextOperationSpec, - callback) as Promise; + { resourceGroupName, workspaceName, clientGroupName, nextLink, options }, + listMembersNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/clientGroups/{clientGroupName}", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/clientGroups/{clientGroupName}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.workspaceName, - Parameters.clientGroupName - ], - queryParameters: [ - Parameters.apiVersion, - Parameters.startTime, - Parameters.endTime - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.ClientGroup @@ -190,26 +210,25 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const getMembersCountOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/clientGroups/{clientGroupName}/membersCount", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.workspaceName, - Parameters.clientGroupName - ], queryParameters: [ Parameters.apiVersion, Parameters.startTime, Parameters.endTime ], - headerParameters: [ - Parameters.acceptLanguage + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName, + Parameters.clientGroupName ], + headerParameters: [Parameters.accept], + serializer +}; +const getMembersCountOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/clientGroups/{clientGroupName}/membersCount", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ClientGroupMembersCount @@ -218,48 +237,52 @@ const getMembersCountOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const listMembersOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/clientGroups/{clientGroupName}/members", + queryParameters: [ + Parameters.apiVersion, + Parameters.startTime, + Parameters.endTime + ], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.workspaceName, Parameters.clientGroupName ], + headerParameters: [Parameters.accept], + serializer +}; +const listMembersOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/clientGroups/{clientGroupName}/members", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ClientGroupMembersCollection + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, queryParameters: [ Parameters.apiVersion, Parameters.startTime, Parameters.endTime, Parameters.top ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.ClientGroupMembersCollection - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const listMembersNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName, + Parameters.clientGroupName ], + headerParameters: [Parameters.accept], + serializer +}; +const listMembersNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ClientGroupMembersCollection @@ -268,5 +291,20 @@ const listMembersNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [ + Parameters.apiVersion, + Parameters.startTime, + Parameters.endTime, + Parameters.top + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName, + Parameters.nextLink, + Parameters.clientGroupName + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/service-map/arm-servicemap/src/operations/index.ts b/sdk/service-map/arm-servicemap/src/operations/index.ts index 967290471d8..d84217c1cff 100644 --- a/sdk/service-map/arm-servicemap/src/operations/index.ts +++ b/sdk/service-map/arm-servicemap/src/operations/index.ts @@ -1,11 +1,9 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ export * from "./machines"; diff --git a/sdk/service-map/arm-servicemap/src/operations/machineGroups.ts b/sdk/service-map/arm-servicemap/src/operations/machineGroups.ts index 7db8d22f0de..b720dee5a51 100644 --- a/sdk/service-map/arm-servicemap/src/operations/machineGroups.ts +++ b/sdk/service-map/arm-servicemap/src/operations/machineGroups.ts @@ -1,28 +1,42 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/machineGroupsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { MachineGroups } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { ServicemapManagementClientContext } from "../servicemapManagementClientContext"; +import { ServiceMap } from "../serviceMap"; +import { + MachineGroup, + MachineGroupsListByWorkspaceNextOptionalParams, + MachineGroupsListByWorkspaceOptionalParams, + MachineGroupsListByWorkspaceResponse, + MachineGroupsCreateOptionalParams, + MachineGroupsCreateResponse, + MachineGroupsGetOptionalParams, + MachineGroupsGetResponse, + MachineGroupsUpdateOptionalParams, + MachineGroupsUpdateResponse, + MachineGroupsDeleteOptionalParams, + MachineGroupsListByWorkspaceNextResponse +} from "../models"; -/** Class representing a MachineGroups. */ -export class MachineGroups { - private readonly client: ServicemapManagementClientContext; +/// +/** Class containing MachineGroups operations. */ +export class MachineGroupsImpl implements MachineGroups { + private readonly client: ServiceMap; /** - * Create a MachineGroups. - * @param {ServicemapManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class MachineGroups class. + * @param client Reference to the service client */ - constructor(client: ServicemapManagementClientContext) { + constructor(client: ServiceMap) { this.client = client; } @@ -30,32 +44,88 @@ export class MachineGroups { * Returns all machine groups during the specified time interval. * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listByWorkspace(resourceGroupName: string, workspaceName: string, options?: Models.MachineGroupsListByWorkspaceOptionalParams): Promise; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param callback The callback - */ - listByWorkspace(resourceGroupName: string, workspaceName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param options The optional parameters - * @param callback The callback - */ - listByWorkspace(resourceGroupName: string, workspaceName: string, options: Models.MachineGroupsListByWorkspaceOptionalParams, callback: msRest.ServiceCallback): void; - listByWorkspace(resourceGroupName: string, workspaceName: string, options?: Models.MachineGroupsListByWorkspaceOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { + public listByWorkspace( + resourceGroupName: string, + workspaceName: string, + options?: MachineGroupsListByWorkspaceOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByWorkspacePagingAll( + resourceGroupName, + workspaceName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByWorkspacePagingPage( + resourceGroupName, + workspaceName, + options + ); + } + }; + } + + private async *listByWorkspacePagingPage( + resourceGroupName: string, + workspaceName: string, + options?: MachineGroupsListByWorkspaceOptionalParams + ): AsyncIterableIterator { + let result = await this._listByWorkspace( + resourceGroupName, + workspaceName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByWorkspaceNext( resourceGroupName, workspaceName, + continuationToken, options - }, - listByWorkspaceOperationSpec, - callback) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByWorkspacePagingAll( + resourceGroupName: string, + workspaceName: string, + options?: MachineGroupsListByWorkspaceOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByWorkspacePagingPage( + resourceGroupName, + workspaceName, + options + )) { + yield* page; + } + } + + /** + * Returns all machine groups during the specified time interval. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param options The options parameters. + */ + private _listByWorkspace( + resourceGroupName: string, + workspaceName: string, + options?: MachineGroupsListByWorkspaceOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, workspaceName, options }, + listByWorkspaceOperationSpec + ); } /** @@ -63,35 +133,18 @@ export class MachineGroups { * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. * @param machineGroup Machine Group resource to create. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - create(resourceGroupName: string, workspaceName: string, machineGroup: Models.MachineGroup, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineGroup Machine Group resource to create. - * @param callback The callback - */ - create(resourceGroupName: string, workspaceName: string, machineGroup: Models.MachineGroup, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineGroup Machine Group resource to create. - * @param options The optional parameters - * @param callback The callback - */ - create(resourceGroupName: string, workspaceName: string, machineGroup: Models.MachineGroup, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - create(resourceGroupName: string, workspaceName: string, machineGroup: Models.MachineGroup, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + create( + resourceGroupName: string, + workspaceName: string, + machineGroup: MachineGroup, + options?: MachineGroupsCreateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - workspaceName, - machineGroup, - options - }, - createOperationSpec, - callback) as Promise; + { resourceGroupName, workspaceName, machineGroup, options }, + createOperationSpec + ); } /** @@ -99,35 +152,18 @@ export class MachineGroups { * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. * @param machineGroupName Machine Group resource name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, workspaceName: string, machineGroupName: string, options?: Models.MachineGroupsGetOptionalParams): Promise; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineGroupName Machine Group resource name. - * @param callback The callback - */ - get(resourceGroupName: string, workspaceName: string, machineGroupName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineGroupName Machine Group resource name. - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, workspaceName: string, machineGroupName: string, options: Models.MachineGroupsGetOptionalParams, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, workspaceName: string, machineGroupName: string, options?: Models.MachineGroupsGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + workspaceName: string, + machineGroupName: string, + options?: MachineGroupsGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - workspaceName, - machineGroupName, - options - }, - getOperationSpec, - callback) as Promise; + { resourceGroupName, workspaceName, machineGroupName, options }, + getOperationSpec + ); } /** @@ -136,28 +172,15 @@ export class MachineGroups { * @param workspaceName OMS workspace containing the resources of interest. * @param machineGroupName Machine Group resource name. * @param machineGroup Machine Group resource to update. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - update(resourceGroupName: string, workspaceName: string, machineGroupName: string, machineGroup: Models.MachineGroup, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineGroupName Machine Group resource name. - * @param machineGroup Machine Group resource to update. - * @param callback The callback - */ - update(resourceGroupName: string, workspaceName: string, machineGroupName: string, machineGroup: Models.MachineGroup, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineGroupName Machine Group resource name. - * @param machineGroup Machine Group resource to update. - * @param options The optional parameters - * @param callback The callback - */ - update(resourceGroupName: string, workspaceName: string, machineGroupName: string, machineGroup: Models.MachineGroup, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - update(resourceGroupName: string, workspaceName: string, machineGroupName: string, machineGroup: Models.MachineGroup, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + update( + resourceGroupName: string, + workspaceName: string, + machineGroupName: string, + machineGroup: MachineGroup, + options?: MachineGroupsUpdateOptionalParams + ): Promise { return this.client.sendOperationRequest( { resourceGroupName, @@ -166,8 +189,8 @@ export class MachineGroups { machineGroup, options }, - updateOperationSpec, - callback) as Promise; + updateOperationSpec + ); } /** @@ -175,84 +198,46 @@ export class MachineGroups { * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. * @param machineGroupName Machine Group resource name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - deleteMethod(resourceGroupName: string, workspaceName: string, machineGroupName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineGroupName Machine Group resource name. - * @param callback The callback - */ - deleteMethod(resourceGroupName: string, workspaceName: string, machineGroupName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineGroupName Machine Group resource name. - * @param options The optional parameters - * @param callback The callback - */ - deleteMethod(resourceGroupName: string, workspaceName: string, machineGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteMethod(resourceGroupName: string, workspaceName: string, machineGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + delete( + resourceGroupName: string, + workspaceName: string, + machineGroupName: string, + options?: MachineGroupsDeleteOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - workspaceName, - machineGroupName, - options - }, - deleteMethodOperationSpec, - callback); + { resourceGroupName, workspaceName, machineGroupName, options }, + deleteOperationSpec + ); } /** - * Returns all machine groups during the specified time interval. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * ListByWorkspaceNext + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param nextLink The nextLink from the previous successful call to the ListByWorkspace method. + * @param options The options parameters. */ - listByWorkspaceNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listByWorkspaceNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listByWorkspaceNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByWorkspaceNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listByWorkspaceNext( + resourceGroupName: string, + workspaceName: string, + nextLink: string, + options?: MachineGroupsListByWorkspaceNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listByWorkspaceNextOperationSpec, - callback) as Promise; + { resourceGroupName, workspaceName, nextLink, options }, + listByWorkspaceNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listByWorkspaceOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByWorkspaceOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.workspaceName - ], - queryParameters: [ - Parameters.apiVersion, - Parameters.startTime, - Parameters.endTime - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.MachineGroupCollection @@ -261,30 +246,24 @@ const listByWorkspaceOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const createOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups", + queryParameters: [ + Parameters.apiVersion, + Parameters.startTime, + Parameters.endTime + ], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.workspaceName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "machineGroup", - mapper: { - ...Mappers.MachineGroup, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const createOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups", + httpMethod: "POST", responses: { 201: { bodyMapper: Mappers.MachineGroup @@ -293,59 +272,49 @@ const createOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups/{machineGroupName}", + requestBody: Parameters.machineGroup, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.workspaceName, - Parameters.machineGroupName + Parameters.workspaceName ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups/{machineGroupName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.MachineGroup + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, queryParameters: [ Parameters.apiVersion, Parameters.startTime, Parameters.endTime ], - headerParameters: [ - Parameters.acceptLanguage + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName, + Parameters.machineGroupName ], - responses: { - 200: { - bodyMapper: Mappers.MachineGroup - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, + headerParameters: [Parameters.accept], serializer }; - -const updateOperationSpec: msRest.OperationSpec = { +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups/{machineGroupName}", httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups/{machineGroupName}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.workspaceName, - Parameters.machineGroupName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "machineGroup", - mapper: { - ...Mappers.MachineGroup, - required: true - } - }, responses: { 200: { bodyMapper: Mappers.MachineGroup @@ -354,43 +323,43 @@ const updateOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const deleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups/{machineGroupName}", + requestBody: Parameters.machineGroup, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.workspaceName, Parameters.machineGroupName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups/{machineGroupName}", + httpMethod: "DELETE", responses: { 204: {}, default: { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName, + Parameters.machineGroupName + ], + headerParameters: [Parameters.accept], serializer }; - -const listByWorkspaceNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listByWorkspaceNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.MachineGroupCollection @@ -399,5 +368,18 @@ const listByWorkspaceNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [ + Parameters.apiVersion, + Parameters.startTime, + Parameters.endTime + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/service-map/arm-servicemap/src/operations/machines.ts b/sdk/service-map/arm-servicemap/src/operations/machines.ts index 7ea3e060533..cff1b86fe4a 100644 --- a/sdk/service-map/arm-servicemap/src/operations/machines.ts +++ b/sdk/service-map/arm-servicemap/src/operations/machines.ts @@ -1,64 +1,478 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/machinesMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Machines } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { ServicemapManagementClientContext } from "../servicemapManagementClientContext"; +import { ServiceMap } from "../serviceMap"; +import { + Machine, + MachinesListByWorkspaceNextOptionalParams, + MachinesListByWorkspaceOptionalParams, + Connection, + MachinesListConnectionsNextOptionalParams, + MachinesListConnectionsOptionalParams, + Process, + MachinesListProcessesNextOptionalParams, + MachinesListProcessesOptionalParams, + Port, + MachinesListPortsNextOptionalParams, + MachinesListPortsOptionalParams, + MachineGroup, + MachinesListMachineGroupMembershipNextOptionalParams, + MachinesListMachineGroupMembershipOptionalParams, + MachinesListByWorkspaceResponse, + MachinesGetOptionalParams, + MachinesGetResponse, + MachinesGetLivenessOptionalParams, + MachinesGetLivenessResponse, + MachinesListConnectionsResponse, + MachinesListProcessesResponse, + MachinesListPortsResponse, + MachinesListMachineGroupMembershipResponse, + MachinesListByWorkspaceNextResponse, + MachinesListConnectionsNextResponse, + MachinesListProcessesNextResponse, + MachinesListPortsNextResponse, + MachinesListMachineGroupMembershipNextResponse +} from "../models"; -/** Class representing a Machines. */ -export class Machines { - private readonly client: ServicemapManagementClientContext; +/// +/** Class containing Machines operations. */ +export class MachinesImpl implements Machines { + private readonly client: ServiceMap; /** - * Create a Machines. - * @param {ServicemapManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class Machines class. + * @param client Reference to the service client */ - constructor(client: ServicemapManagementClientContext) { + constructor(client: ServiceMap) { this.client = client; } /** * Returns a collection of machines matching the specified conditions. The returned collection - * represents either machines that are active/live during the specified interval of time - * (`live=true` and `startTime`/`endTime` are specified) or that are known to have existed at or - * some time prior to the specified point in time (`live=false` and `timestamp` is specified). + * represents either machines that are active/live during the specified interval of time (`live=true` + * and `startTime`/`endTime` are specified) or that are known to have existed at or some time prior to + * the specified point in time (`live=false` and `timestamp` is specified). * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listByWorkspace(resourceGroupName: string, workspaceName: string, options?: Models.MachinesListByWorkspaceOptionalParams): Promise; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param callback The callback - */ - listByWorkspace(resourceGroupName: string, workspaceName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param options The optional parameters - * @param callback The callback - */ - listByWorkspace(resourceGroupName: string, workspaceName: string, options: Models.MachinesListByWorkspaceOptionalParams, callback: msRest.ServiceCallback): void; - listByWorkspace(resourceGroupName: string, workspaceName: string, options?: Models.MachinesListByWorkspaceOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { + public listByWorkspace( + resourceGroupName: string, + workspaceName: string, + options?: MachinesListByWorkspaceOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByWorkspacePagingAll( + resourceGroupName, + workspaceName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByWorkspacePagingPage( + resourceGroupName, + workspaceName, + options + ); + } + }; + } + + private async *listByWorkspacePagingPage( + resourceGroupName: string, + workspaceName: string, + options?: MachinesListByWorkspaceOptionalParams + ): AsyncIterableIterator { + let result = await this._listByWorkspace( + resourceGroupName, + workspaceName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByWorkspaceNext( resourceGroupName, workspaceName, + continuationToken, options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByWorkspacePagingAll( + resourceGroupName: string, + workspaceName: string, + options?: MachinesListByWorkspaceOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByWorkspacePagingPage( + resourceGroupName, + workspaceName, + options + )) { + yield* page; + } + } + + /** + * Returns a collection of connections terminating or originating at the specified machine + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param options The options parameters. + */ + public listConnections( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesListConnectionsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listConnectionsPagingAll( + resourceGroupName, + workspaceName, + machineName, + options + ); + return { + next() { + return iter.next(); }, - listByWorkspaceOperationSpec, - callback) as Promise; + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listConnectionsPagingPage( + resourceGroupName, + workspaceName, + machineName, + options + ); + } + }; + } + + private async *listConnectionsPagingPage( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesListConnectionsOptionalParams + ): AsyncIterableIterator { + let result = await this._listConnections( + resourceGroupName, + workspaceName, + machineName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listConnectionsNext( + resourceGroupName, + workspaceName, + machineName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listConnectionsPagingAll( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesListConnectionsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listConnectionsPagingPage( + resourceGroupName, + workspaceName, + machineName, + options + )) { + yield* page; + } + } + + /** + * Returns a collection of processes on the specified machine matching the specified conditions. The + * returned collection represents either processes that are active/live during the specified interval + * of time (`live=true` and `startTime`/`endTime` are specified) or that are known to have existed at + * or some time prior to the specified point in time (`live=false` and `timestamp` is specified). + * + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param options The options parameters. + */ + public listProcesses( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesListProcessesOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listProcessesPagingAll( + resourceGroupName, + workspaceName, + machineName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listProcessesPagingPage( + resourceGroupName, + workspaceName, + machineName, + options + ); + } + }; + } + + private async *listProcessesPagingPage( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesListProcessesOptionalParams + ): AsyncIterableIterator { + let result = await this._listProcesses( + resourceGroupName, + workspaceName, + machineName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listProcessesNext( + resourceGroupName, + workspaceName, + machineName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listProcessesPagingAll( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesListProcessesOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listProcessesPagingPage( + resourceGroupName, + workspaceName, + machineName, + options + )) { + yield* page; + } + } + + /** + * Returns a collection of live ports on the specified machine during the specified time interval. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param options The options parameters. + */ + public listPorts( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesListPortsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPortsPagingAll( + resourceGroupName, + workspaceName, + machineName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPortsPagingPage( + resourceGroupName, + workspaceName, + machineName, + options + ); + } + }; + } + + private async *listPortsPagingPage( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesListPortsOptionalParams + ): AsyncIterableIterator { + let result = await this._listPorts( + resourceGroupName, + workspaceName, + machineName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listPortsNext( + resourceGroupName, + workspaceName, + machineName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPortsPagingAll( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesListPortsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPortsPagingPage( + resourceGroupName, + workspaceName, + machineName, + options + )) { + yield* page; + } + } + + /** + * Returns a collection of machine groups this machine belongs to during the specified time interval. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param options The options parameters. + */ + public listMachineGroupMembership( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesListMachineGroupMembershipOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listMachineGroupMembershipPagingAll( + resourceGroupName, + workspaceName, + machineName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listMachineGroupMembershipPagingPage( + resourceGroupName, + workspaceName, + machineName, + options + ); + } + }; + } + + private async *listMachineGroupMembershipPagingPage( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesListMachineGroupMembershipOptionalParams + ): AsyncIterableIterator { + let result = await this._listMachineGroupMembership( + resourceGroupName, + workspaceName, + machineName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listMachineGroupMembershipNext( + resourceGroupName, + workspaceName, + machineName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listMachineGroupMembershipPagingAll( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesListMachineGroupMembershipOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listMachineGroupMembershipPagingPage( + resourceGroupName, + workspaceName, + machineName, + options + )) { + yield* page; + } + } + + /** + * Returns a collection of machines matching the specified conditions. The returned collection + * represents either machines that are active/live during the specified interval of time (`live=true` + * and `startTime`/`endTime` are specified) or that are known to have existed at or some time prior to + * the specified point in time (`live=false` and `timestamp` is specified). + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param options The options parameters. + */ + private _listByWorkspace( + resourceGroupName: string, + workspaceName: string, + options?: MachinesListByWorkspaceOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, workspaceName, options }, + listByWorkspaceOperationSpec + ); } /** @@ -66,35 +480,18 @@ export class Machines { * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. * @param machineName Machine resource name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, workspaceName: string, machineName: string, options?: Models.MachinesGetOptionalParams): Promise; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param callback The callback - */ - get(resourceGroupName: string, workspaceName: string, machineName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, workspaceName: string, machineName: string, options: Models.MachinesGetOptionalParams, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, workspaceName: string, machineName: string, options?: Models.MachinesGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - workspaceName, - machineName, - options - }, - getOperationSpec, - callback) as Promise; + { resourceGroupName, workspaceName, machineName, options }, + getOperationSpec + ); } /** @@ -102,35 +499,18 @@ export class Machines { * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. * @param machineName Machine resource name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - getLiveness(resourceGroupName: string, workspaceName: string, machineName: string, options?: Models.MachinesGetLivenessOptionalParams): Promise; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param callback The callback - */ - getLiveness(resourceGroupName: string, workspaceName: string, machineName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param options The optional parameters - * @param callback The callback - */ - getLiveness(resourceGroupName: string, workspaceName: string, machineName: string, options: Models.MachinesGetLivenessOptionalParams, callback: msRest.ServiceCallback): void; - getLiveness(resourceGroupName: string, workspaceName: string, machineName: string, options?: Models.MachinesGetLivenessOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + getLiveness( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesGetLivenessOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - workspaceName, - machineName, - options - }, - getLivenessOperationSpec, - callback) as Promise; + { resourceGroupName, workspaceName, machineName, options }, + getLivenessOperationSpec + ); } /** @@ -138,75 +518,41 @@ export class Machines { * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. * @param machineName Machine resource name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listConnections(resourceGroupName: string, workspaceName: string, machineName: string, options?: Models.MachinesListConnectionsOptionalParams): Promise; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param callback The callback - */ - listConnections(resourceGroupName: string, workspaceName: string, machineName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param options The optional parameters - * @param callback The callback - */ - listConnections(resourceGroupName: string, workspaceName: string, machineName: string, options: Models.MachinesListConnectionsOptionalParams, callback: msRest.ServiceCallback): void; - listConnections(resourceGroupName: string, workspaceName: string, machineName: string, options?: Models.MachinesListConnectionsOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listConnections( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesListConnectionsOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - workspaceName, - machineName, - options - }, - listConnectionsOperationSpec, - callback) as Promise; + { resourceGroupName, workspaceName, machineName, options }, + listConnectionsOperationSpec + ); } /** - * Returns a collection of processes on the specified machine matching the specified conditions. - * The returned collection represents either processes that are active/live during the specified - * interval of time (`live=true` and `startTime`/`endTime` are specified) or that are known to - * have existed at or some time prior to the specified point in time (`live=false` and `timestamp` - * is specified). + * Returns a collection of processes on the specified machine matching the specified conditions. The + * returned collection represents either processes that are active/live during the specified interval + * of time (`live=true` and `startTime`/`endTime` are specified) or that are known to have existed at + * or some time prior to the specified point in time (`live=false` and `timestamp` is specified). + * * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. * @param machineName Machine resource name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listProcesses(resourceGroupName: string, workspaceName: string, machineName: string, options?: Models.MachinesListProcessesOptionalParams): Promise; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param callback The callback - */ - listProcesses(resourceGroupName: string, workspaceName: string, machineName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param options The optional parameters - * @param callback The callback - */ - listProcesses(resourceGroupName: string, workspaceName: string, machineName: string, options: Models.MachinesListProcessesOptionalParams, callback: msRest.ServiceCallback): void; - listProcesses(resourceGroupName: string, workspaceName: string, machineName: string, options?: Models.MachinesListProcessesOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listProcesses( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesListProcessesOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - workspaceName, - machineName, - options - }, - listProcessesOperationSpec, - callback) as Promise; + { resourceGroupName, workspaceName, machineName, options }, + listProcessesOperationSpec + ); } /** @@ -214,233 +560,158 @@ export class Machines { * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. * @param machineName Machine resource name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listPorts(resourceGroupName: string, workspaceName: string, machineName: string, options?: Models.MachinesListPortsOptionalParams): Promise; + private _listPorts( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesListPortsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, workspaceName, machineName, options }, + listPortsOperationSpec + ); + } + /** + * Returns a collection of machine groups this machine belongs to during the specified time interval. * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. * @param machineName Machine resource name. - * @param callback The callback + * @param options The options parameters. */ - listPorts(resourceGroupName: string, workspaceName: string, machineName: string, callback: msRest.ServiceCallback): void; + private _listMachineGroupMembership( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesListMachineGroupMembershipOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, workspaceName, machineName, options }, + listMachineGroupMembershipOperationSpec + ); + } + /** + * ListByWorkspaceNext + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param nextLink The nextLink from the previous successful call to the ListByWorkspace method. + * @param options The options parameters. + */ + private _listByWorkspaceNext( + resourceGroupName: string, + workspaceName: string, + nextLink: string, + options?: MachinesListByWorkspaceNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, workspaceName, nextLink, options }, + listByWorkspaceNextOperationSpec + ); + } + + /** + * ListConnectionsNext * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. * @param machineName Machine resource name. - * @param options The optional parameters - * @param callback The callback + * @param nextLink The nextLink from the previous successful call to the ListConnections method. + * @param options The options parameters. */ - listPorts(resourceGroupName: string, workspaceName: string, machineName: string, options: Models.MachinesListPortsOptionalParams, callback: msRest.ServiceCallback): void; - listPorts(resourceGroupName: string, workspaceName: string, machineName: string, options?: Models.MachinesListPortsOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listConnectionsNext( + resourceGroupName: string, + workspaceName: string, + machineName: string, + nextLink: string, + options?: MachinesListConnectionsNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - workspaceName, - machineName, - options - }, - listPortsOperationSpec, - callback) as Promise; + { resourceGroupName, workspaceName, machineName, nextLink, options }, + listConnectionsNextOperationSpec + ); } /** - * Returns a collection of machine groups this machine belongs to during the specified time - * interval. + * ListProcessesNext * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. * @param machineName Machine resource name. - * @param [options] The optional parameters - * @returns Promise + * @param nextLink The nextLink from the previous successful call to the ListProcesses method. + * @param options The options parameters. */ - listMachineGroupMembership(resourceGroupName: string, workspaceName: string, machineName: string, options?: Models.MachinesListMachineGroupMembershipOptionalParams): Promise; + private _listProcessesNext( + resourceGroupName: string, + workspaceName: string, + machineName: string, + nextLink: string, + options?: MachinesListProcessesNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, workspaceName, machineName, nextLink, options }, + listProcessesNextOperationSpec + ); + } + /** + * ListPortsNext * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. * @param machineName Machine resource name. - * @param callback The callback + * @param nextLink The nextLink from the previous successful call to the ListPorts method. + * @param options The options parameters. */ - listMachineGroupMembership(resourceGroupName: string, workspaceName: string, machineName: string, callback: msRest.ServiceCallback): void; + private _listPortsNext( + resourceGroupName: string, + workspaceName: string, + machineName: string, + nextLink: string, + options?: MachinesListPortsNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, workspaceName, machineName, nextLink, options }, + listPortsNextOperationSpec + ); + } + /** + * ListMachineGroupMembershipNext * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. * @param machineName Machine resource name. - * @param options The optional parameters - * @param callback The callback + * @param nextLink The nextLink from the previous successful call to the ListMachineGroupMembership + * method. + * @param options The options parameters. */ - listMachineGroupMembership(resourceGroupName: string, workspaceName: string, machineName: string, options: Models.MachinesListMachineGroupMembershipOptionalParams, callback: msRest.ServiceCallback): void; - listMachineGroupMembership(resourceGroupName: string, workspaceName: string, machineName: string, options?: Models.MachinesListMachineGroupMembershipOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listMachineGroupMembershipNext( + resourceGroupName: string, + workspaceName: string, + machineName: string, + nextLink: string, + options?: MachinesListMachineGroupMembershipNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - workspaceName, - machineName, - options - }, - listMachineGroupMembershipOperationSpec, - callback) as Promise; - } - - /** - * Returns a collection of machines matching the specified conditions. The returned collection - * represents either machines that are active/live during the specified interval of time - * (`live=true` and `startTime`/`endTime` are specified) or that are known to have existed at or - * some time prior to the specified point in time (`live=false` and `timestamp` is specified). - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listByWorkspaceNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listByWorkspaceNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listByWorkspaceNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByWorkspaceNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listByWorkspaceNextOperationSpec, - callback) as Promise; - } - - /** - * Returns a collection of connections terminating or originating at the specified machine - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listConnectionsNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listConnectionsNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listConnectionsNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listConnectionsNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listConnectionsNextOperationSpec, - callback) as Promise; - } - - /** - * Returns a collection of processes on the specified machine matching the specified conditions. - * The returned collection represents either processes that are active/live during the specified - * interval of time (`live=true` and `startTime`/`endTime` are specified) or that are known to - * have existed at or some time prior to the specified point in time (`live=false` and `timestamp` - * is specified). - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listProcessesNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listProcessesNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listProcessesNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listProcessesNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listProcessesNextOperationSpec, - callback) as Promise; - } - - /** - * Returns a collection of live ports on the specified machine during the specified time interval. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listPortsNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listPortsNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listPortsNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listPortsNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listPortsNextOperationSpec, - callback) as Promise; - } - - /** - * Returns a collection of machine groups this machine belongs to during the specified time - * interval. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listMachineGroupMembershipNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listMachineGroupMembershipNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listMachineGroupMembershipNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listMachineGroupMembershipNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listMachineGroupMembershipNextOperationSpec, - callback) as Promise; + { resourceGroupName, workspaceName, machineName, nextLink, options }, + listMachineGroupMembershipNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listByWorkspaceOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByWorkspaceOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.workspaceName - ], + responses: { + 200: { + bodyMapper: Mappers.MachineCollection + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, queryParameters: [ Parameters.apiVersion, Parameters.live, @@ -449,36 +720,19 @@ const listByWorkspaceOperationSpec: msRest.OperationSpec = { Parameters.timestamp, Parameters.top ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.MachineCollection - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}", urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.workspaceName, - Parameters.machineName - ], - queryParameters: [ - Parameters.apiVersion, - Parameters.timestamp - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.workspaceName ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.Machine @@ -487,26 +741,21 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const getLivenessOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/liveness", + queryParameters: [Parameters.apiVersion, Parameters.timestamp], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.workspaceName, Parameters.machineName ], - queryParameters: [ - Parameters.apiVersion, - Parameters.startTime, - Parameters.endTime - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept], + serializer +}; +const getLivenessOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/liveness", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.Liveness @@ -515,26 +764,25 @@ const getLivenessOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const listConnectionsOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/connections", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.workspaceName, - Parameters.machineName - ], queryParameters: [ Parameters.apiVersion, Parameters.startTime, Parameters.endTime ], - headerParameters: [ - Parameters.acceptLanguage + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName, + Parameters.machineName ], + headerParameters: [Parameters.accept], + serializer +}; +const listConnectionsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/connections", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ConnectionCollection @@ -543,28 +791,25 @@ const listConnectionsOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const listProcessesOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes", + queryParameters: [ + Parameters.apiVersion, + Parameters.startTime, + Parameters.endTime + ], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.workspaceName, Parameters.machineName ], - queryParameters: [ - Parameters.apiVersion, - Parameters.live, - Parameters.startTime, - Parameters.endTime, - Parameters.timestamp - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept], + serializer +}; +const listProcessesOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ProcessCollection @@ -573,26 +818,27 @@ const listProcessesOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const listPortsOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports", + queryParameters: [ + Parameters.apiVersion, + Parameters.live, + Parameters.startTime, + Parameters.endTime, + Parameters.timestamp + ], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.workspaceName, Parameters.machineName ], - queryParameters: [ - Parameters.apiVersion, - Parameters.startTime, - Parameters.endTime - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept], + serializer +}; +const listPortsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.PortCollection @@ -601,26 +847,25 @@ const listPortsOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const listMachineGroupMembershipOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/machineGroups", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.workspaceName, - Parameters.machineName - ], queryParameters: [ Parameters.apiVersion, Parameters.startTime, Parameters.endTime ], - headerParameters: [ - Parameters.acceptLanguage + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName, + Parameters.machineName ], + headerParameters: [Parameters.accept], + serializer +}; +const listMachineGroupMembershipOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/machineGroups", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.MachineGroupCollection @@ -629,19 +874,24 @@ const listMachineGroupMembershipOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [ + Parameters.apiVersion, + Parameters.startTime, + Parameters.endTime + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName, + Parameters.machineName + ], + headerParameters: [Parameters.accept], serializer }; - -const listByWorkspaceNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listByWorkspaceNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.MachineCollection @@ -650,19 +900,27 @@ const listByWorkspaceNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [ + Parameters.apiVersion, + Parameters.live, + Parameters.startTime, + Parameters.endTime, + Parameters.timestamp, + Parameters.top + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; - -const listConnectionsNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listConnectionsNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ConnectionCollection @@ -671,19 +929,25 @@ const listConnectionsNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [ + Parameters.apiVersion, + Parameters.startTime, + Parameters.endTime + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName, + Parameters.machineName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; - -const listProcessesNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listProcessesNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ProcessCollection @@ -692,19 +956,27 @@ const listProcessesNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [ + Parameters.apiVersion, + Parameters.live, + Parameters.startTime, + Parameters.endTime, + Parameters.timestamp + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName, + Parameters.machineName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; - -const listPortsNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listPortsNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.PortCollection @@ -713,19 +985,25 @@ const listPortsNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [ + Parameters.apiVersion, + Parameters.startTime, + Parameters.endTime + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName, + Parameters.machineName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; - -const listMachineGroupMembershipNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listMachineGroupMembershipNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.MachineGroupCollection @@ -734,5 +1012,19 @@ const listMachineGroupMembershipNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [ + Parameters.apiVersion, + Parameters.startTime, + Parameters.endTime + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName, + Parameters.machineName, + Parameters.nextLink + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/service-map/arm-servicemap/src/operations/maps.ts b/sdk/service-map/arm-servicemap/src/operations/maps.ts index db19321cb34..bba0312ae69 100644 --- a/sdk/service-map/arm-servicemap/src/operations/maps.ts +++ b/sdk/service-map/arm-servicemap/src/operations/maps.ts @@ -1,28 +1,31 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/mapsMappers"; +import { Maps } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { ServicemapManagementClientContext } from "../servicemapManagementClientContext"; +import { ServiceMap } from "../serviceMap"; +import { + MapRequestUnion, + MapsGenerateOptionalParams, + MapsGenerateResponse +} from "../models"; -/** Class representing a Maps. */ -export class Maps { - private readonly client: ServicemapManagementClientContext; +/** Class containing Maps operations. */ +export class MapsImpl implements Maps { + private readonly client: ServiceMap; /** - * Create a Maps. - * @param {ServicemapManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class Maps class. + * @param client Reference to the service client */ - constructor(client: ServicemapManagementClientContext) { + constructor(client: ServiceMap) { this.client = client; } @@ -31,61 +34,27 @@ export class Maps { * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. * @param request Request options. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - generate(resourceGroupName: string, workspaceName: string, request: Models.MapRequestUnion, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param request Request options. - * @param callback The callback - */ - generate(resourceGroupName: string, workspaceName: string, request: Models.MapRequestUnion, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param request Request options. - * @param options The optional parameters - * @param callback The callback - */ - generate(resourceGroupName: string, workspaceName: string, request: Models.MapRequestUnion, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - generate(resourceGroupName: string, workspaceName: string, request: Models.MapRequestUnion, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + generate( + resourceGroupName: string, + workspaceName: string, + request: MapRequestUnion, + options?: MapsGenerateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - workspaceName, - request, - options - }, - generateOperationSpec, - callback) as Promise; + { resourceGroupName, workspaceName, request, options }, + generateOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const generateOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const generateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/generateMap", httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/generateMap", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.workspaceName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "request", - mapper: { - ...Mappers.MapRequest, - required: true - } - }, responses: { 200: { bodyMapper: Mappers.MapResponse @@ -94,5 +63,15 @@ const generateOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + requestBody: Parameters.request, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", serializer }; diff --git a/sdk/service-map/arm-servicemap/src/operations/ports.ts b/sdk/service-map/arm-servicemap/src/operations/ports.ts index ddf5fc3765e..081420bb659 100644 --- a/sdk/service-map/arm-servicemap/src/operations/ports.ts +++ b/sdk/service-map/arm-servicemap/src/operations/ports.ts @@ -1,70 +1,245 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/portsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Ports } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { ServicemapManagementClientContext } from "../servicemapManagementClientContext"; +import { ServiceMap } from "../serviceMap"; +import { + Process, + PortsListAcceptingProcessesNextOptionalParams, + PortsListAcceptingProcessesOptionalParams, + Connection, + PortsListConnectionsNextOptionalParams, + PortsListConnectionsOptionalParams, + PortsGetOptionalParams, + PortsGetResponse, + PortsGetLivenessOptionalParams, + PortsGetLivenessResponse, + PortsListAcceptingProcessesResponse, + PortsListConnectionsResponse, + PortsListAcceptingProcessesNextResponse, + PortsListConnectionsNextResponse +} from "../models"; -/** Class representing a Ports. */ -export class Ports { - private readonly client: ServicemapManagementClientContext; +/// +/** Class containing Ports operations. */ +export class PortsImpl implements Ports { + private readonly client: ServiceMap; /** - * Create a Ports. - * @param {ServicemapManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class Ports class. + * @param client Reference to the service client */ - constructor(client: ServicemapManagementClientContext) { + constructor(client: ServiceMap) { this.client = client; } /** - * Returns the specified port. The port must be live during the specified time interval. If the - * port is not live during the interval, status 404 (Not Found) is returned. + * Returns a collection of processes accepting on the specified port * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. * @param machineName Machine resource name. * @param portName Port resource name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, workspaceName: string, machineName: string, portName: string, options?: Models.PortsGetOptionalParams): Promise; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param portName Port resource name. - * @param callback The callback - */ - get(resourceGroupName: string, workspaceName: string, machineName: string, portName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param portName Port resource name. - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, workspaceName: string, machineName: string, portName: string, options: Models.PortsGetOptionalParams, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, workspaceName: string, machineName: string, portName: string, options?: Models.PortsGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { + public listAcceptingProcesses( + resourceGroupName: string, + workspaceName: string, + machineName: string, + portName: string, + options?: PortsListAcceptingProcessesOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listAcceptingProcessesPagingAll( + resourceGroupName, + workspaceName, + machineName, + portName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listAcceptingProcessesPagingPage( + resourceGroupName, + workspaceName, + machineName, + portName, + options + ); + } + }; + } + + private async *listAcceptingProcessesPagingPage( + resourceGroupName: string, + workspaceName: string, + machineName: string, + portName: string, + options?: PortsListAcceptingProcessesOptionalParams + ): AsyncIterableIterator { + let result = await this._listAcceptingProcesses( + resourceGroupName, + workspaceName, + machineName, + portName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listAcceptingProcessesNext( resourceGroupName, workspaceName, machineName, portName, + continuationToken, options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listAcceptingProcessesPagingAll( + resourceGroupName: string, + workspaceName: string, + machineName: string, + portName: string, + options?: PortsListAcceptingProcessesOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listAcceptingProcessesPagingPage( + resourceGroupName, + workspaceName, + machineName, + portName, + options + )) { + yield* page; + } + } + + /** + * Returns a collection of connections established via the specified port. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param portName Port resource name. + * @param options The options parameters. + */ + public listConnections( + resourceGroupName: string, + workspaceName: string, + machineName: string, + portName: string, + options?: PortsListConnectionsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listConnectionsPagingAll( + resourceGroupName, + workspaceName, + machineName, + portName, + options + ); + return { + next() { + return iter.next(); }, - getOperationSpec, - callback) as Promise; + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listConnectionsPagingPage( + resourceGroupName, + workspaceName, + machineName, + portName, + options + ); + } + }; + } + + private async *listConnectionsPagingPage( + resourceGroupName: string, + workspaceName: string, + machineName: string, + portName: string, + options?: PortsListConnectionsOptionalParams + ): AsyncIterableIterator { + let result = await this._listConnections( + resourceGroupName, + workspaceName, + machineName, + portName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listConnectionsNext( + resourceGroupName, + workspaceName, + machineName, + portName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listConnectionsPagingAll( + resourceGroupName: string, + workspaceName: string, + machineName: string, + portName: string, + options?: PortsListConnectionsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listConnectionsPagingPage( + resourceGroupName, + workspaceName, + machineName, + portName, + options + )) { + yield* page; + } + } + + /** + * Returns the specified port. The port must be live during the specified time interval. If the port is + * not live during the interval, status 404 (Not Found) is returned. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param portName Port resource name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + workspaceName: string, + machineName: string, + portName: string, + options?: PortsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, workspaceName, machineName, portName, options }, + getOperationSpec + ); } /** @@ -73,38 +248,19 @@ export class Ports { * @param workspaceName OMS workspace containing the resources of interest. * @param machineName Machine resource name. * @param portName Port resource name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - getLiveness(resourceGroupName: string, workspaceName: string, machineName: string, portName: string, options?: Models.PortsGetLivenessOptionalParams): Promise; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param portName Port resource name. - * @param callback The callback - */ - getLiveness(resourceGroupName: string, workspaceName: string, machineName: string, portName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param portName Port resource name. - * @param options The optional parameters - * @param callback The callback - */ - getLiveness(resourceGroupName: string, workspaceName: string, machineName: string, portName: string, options: Models.PortsGetLivenessOptionalParams, callback: msRest.ServiceCallback): void; - getLiveness(resourceGroupName: string, workspaceName: string, machineName: string, portName: string, options?: Models.PortsGetLivenessOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + getLiveness( + resourceGroupName: string, + workspaceName: string, + machineName: string, + portName: string, + options?: PortsGetLivenessOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - workspaceName, - machineName, - portName, - options - }, - getLivenessOperationSpec, - callback) as Promise; + { resourceGroupName, workspaceName, machineName, portName, options }, + getLivenessOperationSpec + ); } /** @@ -113,38 +269,19 @@ export class Ports { * @param workspaceName OMS workspace containing the resources of interest. * @param machineName Machine resource name. * @param portName Port resource name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listAcceptingProcesses(resourceGroupName: string, workspaceName: string, machineName: string, portName: string, options?: Models.PortsListAcceptingProcessesOptionalParams): Promise; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param portName Port resource name. - * @param callback The callback - */ - listAcceptingProcesses(resourceGroupName: string, workspaceName: string, machineName: string, portName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param portName Port resource name. - * @param options The optional parameters - * @param callback The callback - */ - listAcceptingProcesses(resourceGroupName: string, workspaceName: string, machineName: string, portName: string, options: Models.PortsListAcceptingProcessesOptionalParams, callback: msRest.ServiceCallback): void; - listAcceptingProcesses(resourceGroupName: string, workspaceName: string, machineName: string, portName: string, options?: Models.PortsListAcceptingProcessesOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listAcceptingProcesses( + resourceGroupName: string, + workspaceName: string, + machineName: string, + portName: string, + options?: PortsListAcceptingProcessesOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - workspaceName, - machineName, - portName, - options - }, - listAcceptingProcessesOperationSpec, - callback) as Promise; + { resourceGroupName, workspaceName, machineName, portName, options }, + listAcceptingProcessesOperationSpec + ); } /** @@ -153,117 +290,88 @@ export class Ports { * @param workspaceName OMS workspace containing the resources of interest. * @param machineName Machine resource name. * @param portName Port resource name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listConnections(resourceGroupName: string, workspaceName: string, machineName: string, portName: string, options?: Models.PortsListConnectionsOptionalParams): Promise; + private _listConnections( + resourceGroupName: string, + workspaceName: string, + machineName: string, + portName: string, + options?: PortsListConnectionsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, workspaceName, machineName, portName, options }, + listConnectionsOperationSpec + ); + } + /** + * ListAcceptingProcessesNext * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. * @param machineName Machine resource name. * @param portName Port resource name. - * @param callback The callback + * @param nextLink The nextLink from the previous successful call to the ListAcceptingProcesses method. + * @param options The options parameters. */ - listConnections(resourceGroupName: string, workspaceName: string, machineName: string, portName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param portName Port resource name. - * @param options The optional parameters - * @param callback The callback - */ - listConnections(resourceGroupName: string, workspaceName: string, machineName: string, portName: string, options: Models.PortsListConnectionsOptionalParams, callback: msRest.ServiceCallback): void; - listConnections(resourceGroupName: string, workspaceName: string, machineName: string, portName: string, options?: Models.PortsListConnectionsOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listAcceptingProcessesNext( + resourceGroupName: string, + workspaceName: string, + machineName: string, + portName: string, + nextLink: string, + options?: PortsListAcceptingProcessesNextOptionalParams + ): Promise { return this.client.sendOperationRequest( { resourceGroupName, workspaceName, machineName, portName, + nextLink, options }, - listConnectionsOperationSpec, - callback) as Promise; + listAcceptingProcessesNextOperationSpec + ); } /** - * Returns a collection of processes accepting on the specified port - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * ListConnectionsNext + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param portName Port resource name. + * @param nextLink The nextLink from the previous successful call to the ListConnections method. + * @param options The options parameters. */ - listAcceptingProcessesNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listAcceptingProcessesNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listAcceptingProcessesNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listAcceptingProcessesNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listConnectionsNext( + resourceGroupName: string, + workspaceName: string, + machineName: string, + portName: string, + nextLink: string, + options?: PortsListConnectionsNextOptionalParams + ): Promise { return this.client.sendOperationRequest( { - nextPageLink, + resourceGroupName, + workspaceName, + machineName, + portName, + nextLink, options }, - listAcceptingProcessesNextOperationSpec, - callback) as Promise; - } - - /** - * Returns a collection of connections established via the specified port. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listConnectionsNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listConnectionsNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listConnectionsNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listConnectionsNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listConnectionsNextOperationSpec, - callback) as Promise; + listConnectionsNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports/{portName}", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports/{portName}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.workspaceName, - Parameters.machineName, - Parameters.portName - ], - queryParameters: [ - Parameters.apiVersion, - Parameters.startTime, - Parameters.endTime - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.Port @@ -272,27 +380,26 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const getLivenessOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports/{portName}/liveness", + queryParameters: [ + Parameters.apiVersion, + Parameters.startTime, + Parameters.endTime + ], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.workspaceName, Parameters.machineName, Parameters.portName ], - queryParameters: [ - Parameters.apiVersion, - Parameters.startTime, - Parameters.endTime - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept], + serializer +}; +const getLivenessOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports/{portName}/liveness", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.Liveness @@ -301,27 +408,26 @@ const getLivenessOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const listAcceptingProcessesOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports/{portName}/acceptingProcesses", + queryParameters: [ + Parameters.apiVersion, + Parameters.startTime, + Parameters.endTime + ], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.workspaceName, Parameters.machineName, Parameters.portName ], - queryParameters: [ - Parameters.apiVersion, - Parameters.startTime, - Parameters.endTime - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept], + serializer +}; +const listAcceptingProcessesOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports/{portName}/acceptingProcesses", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ProcessCollection @@ -330,27 +436,26 @@ const listAcceptingProcessesOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const listConnectionsOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports/{portName}/connections", + queryParameters: [ + Parameters.apiVersion, + Parameters.startTime, + Parameters.endTime + ], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.workspaceName, Parameters.machineName, Parameters.portName ], - queryParameters: [ - Parameters.apiVersion, - Parameters.startTime, - Parameters.endTime - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept], + serializer +}; +const listConnectionsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports/{portName}/connections", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ConnectionCollection @@ -359,19 +464,25 @@ const listConnectionsOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [ + Parameters.apiVersion, + Parameters.startTime, + Parameters.endTime + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName, + Parameters.machineName, + Parameters.portName + ], + headerParameters: [Parameters.accept], serializer }; - -const listAcceptingProcessesNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listAcceptingProcessesNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ProcessCollection @@ -380,19 +491,26 @@ const listAcceptingProcessesNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [ + Parameters.apiVersion, + Parameters.startTime, + Parameters.endTime + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName, + Parameters.machineName, + Parameters.nextLink, + Parameters.portName + ], + headerParameters: [Parameters.accept], serializer }; - -const listConnectionsNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listConnectionsNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ConnectionCollection @@ -401,5 +519,20 @@ const listConnectionsNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [ + Parameters.apiVersion, + Parameters.startTime, + Parameters.endTime + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName, + Parameters.machineName, + Parameters.nextLink, + Parameters.portName + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/service-map/arm-servicemap/src/operations/processes.ts b/sdk/service-map/arm-servicemap/src/operations/processes.ts index 5c34f1fec16..dd6ca9aae3b 100644 --- a/sdk/service-map/arm-servicemap/src/operations/processes.ts +++ b/sdk/service-map/arm-servicemap/src/operations/processes.ts @@ -1,69 +1,244 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/processesMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Processes } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { ServicemapManagementClientContext } from "../servicemapManagementClientContext"; +import { ServiceMap } from "../serviceMap"; +import { + Port, + ProcessesListAcceptingPortsNextOptionalParams, + ProcessesListAcceptingPortsOptionalParams, + Connection, + ProcessesListConnectionsNextOptionalParams, + ProcessesListConnectionsOptionalParams, + ProcessesGetOptionalParams, + ProcessesGetResponse, + ProcessesGetLivenessOptionalParams, + ProcessesGetLivenessResponse, + ProcessesListAcceptingPortsResponse, + ProcessesListConnectionsResponse, + ProcessesListAcceptingPortsNextResponse, + ProcessesListConnectionsNextResponse +} from "../models"; -/** Class representing a Processes. */ -export class Processes { - private readonly client: ServicemapManagementClientContext; +/// +/** Class containing Processes operations. */ +export class ProcessesImpl implements Processes { + private readonly client: ServiceMap; /** - * Create a Processes. - * @param {ServicemapManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class Processes class. + * @param client Reference to the service client */ - constructor(client: ServicemapManagementClientContext) { + constructor(client: ServiceMap) { this.client = client; } + /** + * Returns a collection of ports on which this process is accepting + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param processName Process resource name. + * @param options The options parameters. + */ + public listAcceptingPorts( + resourceGroupName: string, + workspaceName: string, + machineName: string, + processName: string, + options?: ProcessesListAcceptingPortsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listAcceptingPortsPagingAll( + resourceGroupName, + workspaceName, + machineName, + processName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listAcceptingPortsPagingPage( + resourceGroupName, + workspaceName, + machineName, + processName, + options + ); + } + }; + } + + private async *listAcceptingPortsPagingPage( + resourceGroupName: string, + workspaceName: string, + machineName: string, + processName: string, + options?: ProcessesListAcceptingPortsOptionalParams + ): AsyncIterableIterator { + let result = await this._listAcceptingPorts( + resourceGroupName, + workspaceName, + machineName, + processName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listAcceptingPortsNext( + resourceGroupName, + workspaceName, + machineName, + processName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listAcceptingPortsPagingAll( + resourceGroupName: string, + workspaceName: string, + machineName: string, + processName: string, + options?: ProcessesListAcceptingPortsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listAcceptingPortsPagingPage( + resourceGroupName, + workspaceName, + machineName, + processName, + options + )) { + yield* page; + } + } + + /** + * Returns a collection of connections terminating or originating at the specified process + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param processName Process resource name. + * @param options The options parameters. + */ + public listConnections( + resourceGroupName: string, + workspaceName: string, + machineName: string, + processName: string, + options?: ProcessesListConnectionsOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listConnectionsPagingAll( + resourceGroupName, + workspaceName, + machineName, + processName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listConnectionsPagingPage( + resourceGroupName, + workspaceName, + machineName, + processName, + options + ); + } + }; + } + + private async *listConnectionsPagingPage( + resourceGroupName: string, + workspaceName: string, + machineName: string, + processName: string, + options?: ProcessesListConnectionsOptionalParams + ): AsyncIterableIterator { + let result = await this._listConnections( + resourceGroupName, + workspaceName, + machineName, + processName, + options + ); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listConnectionsNext( + resourceGroupName, + workspaceName, + machineName, + processName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listConnectionsPagingAll( + resourceGroupName: string, + workspaceName: string, + machineName: string, + processName: string, + options?: ProcessesListConnectionsOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listConnectionsPagingPage( + resourceGroupName, + workspaceName, + machineName, + processName, + options + )) { + yield* page; + } + } + /** * Returns the specified process. * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. * @param machineName Machine resource name. * @param processName Process resource name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, workspaceName: string, machineName: string, processName: string, options?: Models.ProcessesGetOptionalParams): Promise; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param processName Process resource name. - * @param callback The callback - */ - get(resourceGroupName: string, workspaceName: string, machineName: string, processName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param processName Process resource name. - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, workspaceName: string, machineName: string, processName: string, options: Models.ProcessesGetOptionalParams, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, workspaceName: string, machineName: string, processName: string, options?: Models.ProcessesGetOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + workspaceName: string, + machineName: string, + processName: string, + options?: ProcessesGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - workspaceName, - machineName, - processName, - options - }, - getOperationSpec, - callback) as Promise; + { resourceGroupName, workspaceName, machineName, processName, options }, + getOperationSpec + ); } /** @@ -72,38 +247,19 @@ export class Processes { * @param workspaceName OMS workspace containing the resources of interest. * @param machineName Machine resource name. * @param processName Process resource name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - getLiveness(resourceGroupName: string, workspaceName: string, machineName: string, processName: string, options?: Models.ProcessesGetLivenessOptionalParams): Promise; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param processName Process resource name. - * @param callback The callback - */ - getLiveness(resourceGroupName: string, workspaceName: string, machineName: string, processName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param processName Process resource name. - * @param options The optional parameters - * @param callback The callback - */ - getLiveness(resourceGroupName: string, workspaceName: string, machineName: string, processName: string, options: Models.ProcessesGetLivenessOptionalParams, callback: msRest.ServiceCallback): void; - getLiveness(resourceGroupName: string, workspaceName: string, machineName: string, processName: string, options?: Models.ProcessesGetLivenessOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + getLiveness( + resourceGroupName: string, + workspaceName: string, + machineName: string, + processName: string, + options?: ProcessesGetLivenessOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - workspaceName, - machineName, - processName, - options - }, - getLivenessOperationSpec, - callback) as Promise; + { resourceGroupName, workspaceName, machineName, processName, options }, + getLivenessOperationSpec + ); } /** @@ -112,38 +268,19 @@ export class Processes { * @param workspaceName OMS workspace containing the resources of interest. * @param machineName Machine resource name. * @param processName Process resource name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listAcceptingPorts(resourceGroupName: string, workspaceName: string, machineName: string, processName: string, options?: Models.ProcessesListAcceptingPortsOptionalParams): Promise; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param processName Process resource name. - * @param callback The callback - */ - listAcceptingPorts(resourceGroupName: string, workspaceName: string, machineName: string, processName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param processName Process resource name. - * @param options The optional parameters - * @param callback The callback - */ - listAcceptingPorts(resourceGroupName: string, workspaceName: string, machineName: string, processName: string, options: Models.ProcessesListAcceptingPortsOptionalParams, callback: msRest.ServiceCallback): void; - listAcceptingPorts(resourceGroupName: string, workspaceName: string, machineName: string, processName: string, options?: Models.ProcessesListAcceptingPortsOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listAcceptingPorts( + resourceGroupName: string, + workspaceName: string, + machineName: string, + processName: string, + options?: ProcessesListAcceptingPortsOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - workspaceName, - machineName, - processName, - options - }, - listAcceptingPortsOperationSpec, - callback) as Promise; + { resourceGroupName, workspaceName, machineName, processName, options }, + listAcceptingPortsOperationSpec + ); } /** @@ -152,116 +289,88 @@ export class Processes { * @param workspaceName OMS workspace containing the resources of interest. * @param machineName Machine resource name. * @param processName Process resource name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listConnections(resourceGroupName: string, workspaceName: string, machineName: string, processName: string, options?: Models.ProcessesListConnectionsOptionalParams): Promise; + private _listConnections( + resourceGroupName: string, + workspaceName: string, + machineName: string, + processName: string, + options?: ProcessesListConnectionsOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, workspaceName, machineName, processName, options }, + listConnectionsOperationSpec + ); + } + /** + * ListAcceptingPortsNext * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. * @param machineName Machine resource name. * @param processName Process resource name. - * @param callback The callback + * @param nextLink The nextLink from the previous successful call to the ListAcceptingPorts method. + * @param options The options parameters. */ - listConnections(resourceGroupName: string, workspaceName: string, machineName: string, processName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param machineName Machine resource name. - * @param processName Process resource name. - * @param options The optional parameters - * @param callback The callback - */ - listConnections(resourceGroupName: string, workspaceName: string, machineName: string, processName: string, options: Models.ProcessesListConnectionsOptionalParams, callback: msRest.ServiceCallback): void; - listConnections(resourceGroupName: string, workspaceName: string, machineName: string, processName: string, options?: Models.ProcessesListConnectionsOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listAcceptingPortsNext( + resourceGroupName: string, + workspaceName: string, + machineName: string, + processName: string, + nextLink: string, + options?: ProcessesListAcceptingPortsNextOptionalParams + ): Promise { return this.client.sendOperationRequest( { resourceGroupName, workspaceName, machineName, processName, + nextLink, options }, - listConnectionsOperationSpec, - callback) as Promise; + listAcceptingPortsNextOperationSpec + ); } /** - * Returns a collection of ports on which this process is accepting - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * ListConnectionsNext + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param processName Process resource name. + * @param nextLink The nextLink from the previous successful call to the ListConnections method. + * @param options The options parameters. */ - listAcceptingPortsNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listAcceptingPortsNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listAcceptingPortsNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listAcceptingPortsNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listConnectionsNext( + resourceGroupName: string, + workspaceName: string, + machineName: string, + processName: string, + nextLink: string, + options?: ProcessesListConnectionsNextOptionalParams + ): Promise { return this.client.sendOperationRequest( { - nextPageLink, + resourceGroupName, + workspaceName, + machineName, + processName, + nextLink, options }, - listAcceptingPortsNextOperationSpec, - callback) as Promise; - } - - /** - * Returns a collection of connections terminating or originating at the specified process - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listConnectionsNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listConnectionsNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listConnectionsNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listConnectionsNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listConnectionsNextOperationSpec, - callback) as Promise; + listConnectionsNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes/{processName}", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes/{processName}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.workspaceName, - Parameters.machineName, - Parameters.processName - ], - queryParameters: [ - Parameters.apiVersion, - Parameters.timestamp - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.Process @@ -270,27 +379,22 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const getLivenessOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes/{processName}/liveness", + queryParameters: [Parameters.apiVersion, Parameters.timestamp], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.workspaceName, Parameters.machineName, Parameters.processName ], - queryParameters: [ - Parameters.apiVersion, - Parameters.startTime, - Parameters.endTime - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept], + serializer +}; +const getLivenessOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes/{processName}/liveness", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.Liveness @@ -299,27 +403,26 @@ const getLivenessOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const listAcceptingPortsOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes/{processName}/acceptingPorts", + queryParameters: [ + Parameters.apiVersion, + Parameters.startTime, + Parameters.endTime + ], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.workspaceName, Parameters.machineName, Parameters.processName ], - queryParameters: [ - Parameters.apiVersion, - Parameters.startTime, - Parameters.endTime - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept], + serializer +}; +const listAcceptingPortsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes/{processName}/acceptingPorts", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.PortCollection @@ -328,27 +431,26 @@ const listAcceptingPortsOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const listConnectionsOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes/{processName}/connections", + queryParameters: [ + Parameters.apiVersion, + Parameters.startTime, + Parameters.endTime + ], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.workspaceName, Parameters.machineName, Parameters.processName ], - queryParameters: [ - Parameters.apiVersion, - Parameters.startTime, - Parameters.endTime - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept], + serializer +}; +const listConnectionsOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes/{processName}/connections", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ConnectionCollection @@ -357,19 +459,25 @@ const listConnectionsOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [ + Parameters.apiVersion, + Parameters.startTime, + Parameters.endTime + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName, + Parameters.machineName, + Parameters.processName + ], + headerParameters: [Parameters.accept], serializer }; - -const listAcceptingPortsNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listAcceptingPortsNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.PortCollection @@ -378,19 +486,26 @@ const listAcceptingPortsNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [ + Parameters.apiVersion, + Parameters.startTime, + Parameters.endTime + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName, + Parameters.machineName, + Parameters.nextLink, + Parameters.processName + ], + headerParameters: [Parameters.accept], serializer }; - -const listConnectionsNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listConnectionsNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ConnectionCollection @@ -399,5 +514,20 @@ const listConnectionsNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [ + Parameters.apiVersion, + Parameters.startTime, + Parameters.endTime + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName, + Parameters.machineName, + Parameters.nextLink, + Parameters.processName + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/service-map/arm-servicemap/src/operations/summaries.ts b/sdk/service-map/arm-servicemap/src/operations/summaries.ts index 578b8264a0d..07bb0708b64 100644 --- a/sdk/service-map/arm-servicemap/src/operations/summaries.ts +++ b/sdk/service-map/arm-servicemap/src/operations/summaries.ts @@ -1,28 +1,30 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/summariesMappers"; +import { Summaries } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { ServicemapManagementClientContext } from "../servicemapManagementClientContext"; +import { ServiceMap } from "../serviceMap"; +import { + SummariesGetMachinesOptionalParams, + SummariesGetMachinesResponse +} from "../models"; -/** Class representing a Summaries. */ -export class Summaries { - private readonly client: ServicemapManagementClientContext; +/** Class containing Summaries operations. */ +export class SummariesImpl implements Summaries { + private readonly client: ServiceMap; /** - * Create a Summaries. - * @param {ServicemapManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class Summaries class. + * @param client Reference to the service client */ - constructor(client: ServicemapManagementClientContext) { + constructor(client: ServiceMap) { this.client = client; } @@ -30,53 +32,26 @@ export class Summaries { * Returns summary information about the machines in the workspace. * @param resourceGroupName Resource group name within the specified subscriptionId. * @param workspaceName OMS workspace containing the resources of interest. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - getMachines(resourceGroupName: string, workspaceName: string, options?: Models.SummariesGetMachinesOptionalParams): Promise; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param callback The callback - */ - getMachines(resourceGroupName: string, workspaceName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Resource group name within the specified subscriptionId. - * @param workspaceName OMS workspace containing the resources of interest. - * @param options The optional parameters - * @param callback The callback - */ - getMachines(resourceGroupName: string, workspaceName: string, options: Models.SummariesGetMachinesOptionalParams, callback: msRest.ServiceCallback): void; - getMachines(resourceGroupName: string, workspaceName: string, options?: Models.SummariesGetMachinesOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + getMachines( + resourceGroupName: string, + workspaceName: string, + options?: SummariesGetMachinesOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - workspaceName, - options - }, - getMachinesOperationSpec, - callback) as Promise; + { resourceGroupName, workspaceName, options }, + getMachinesOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getMachinesOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getMachinesOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/summaries/machines", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/summaries/machines", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.workspaceName - ], - queryParameters: [ - Parameters.apiVersion, - Parameters.startTime, - Parameters.endTime - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.MachinesSummary @@ -85,5 +60,17 @@ const getMachinesOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [ + Parameters.apiVersion, + Parameters.startTime, + Parameters.endTime + ], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workspaceName + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/service-map/arm-servicemap/src/operationsInterfaces/clientGroups.ts b/sdk/service-map/arm-servicemap/src/operationsInterfaces/clientGroups.ts new file mode 100644 index 00000000000..a1a46f919bc --- /dev/null +++ b/sdk/service-map/arm-servicemap/src/operationsInterfaces/clientGroups.ts @@ -0,0 +1,61 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + ClientGroupMember, + ClientGroupsListMembersOptionalParams, + ClientGroupsGetOptionalParams, + ClientGroupsGetResponse, + ClientGroupsGetMembersCountOptionalParams, + ClientGroupsGetMembersCountResponse +} from "../models"; + +/// +/** Interface representing a ClientGroups. */ +export interface ClientGroups { + /** + * Returns the members of the client group during the specified time interval. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param clientGroupName Client Group resource name. + * @param options The options parameters. + */ + listMembers( + resourceGroupName: string, + workspaceName: string, + clientGroupName: string, + options?: ClientGroupsListMembersOptionalParams + ): PagedAsyncIterableIterator; + /** + * Retrieves the specified client group + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param clientGroupName Client Group resource name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + workspaceName: string, + clientGroupName: string, + options?: ClientGroupsGetOptionalParams + ): Promise; + /** + * Returns the approximate number of members in the client group. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param clientGroupName Client Group resource name. + * @param options The options parameters. + */ + getMembersCount( + resourceGroupName: string, + workspaceName: string, + clientGroupName: string, + options?: ClientGroupsGetMembersCountOptionalParams + ): Promise; +} diff --git a/sdk/service-map/arm-servicemap/src/operationsInterfaces/index.ts b/sdk/service-map/arm-servicemap/src/operationsInterfaces/index.ts new file mode 100644 index 00000000000..d84217c1cff --- /dev/null +++ b/sdk/service-map/arm-servicemap/src/operationsInterfaces/index.ts @@ -0,0 +1,15 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./machines"; +export * from "./processes"; +export * from "./ports"; +export * from "./clientGroups"; +export * from "./maps"; +export * from "./summaries"; +export * from "./machineGroups"; diff --git a/sdk/service-map/arm-servicemap/src/operationsInterfaces/machineGroups.ts b/sdk/service-map/arm-servicemap/src/operationsInterfaces/machineGroups.ts new file mode 100644 index 00000000000..882e5616f68 --- /dev/null +++ b/sdk/service-map/arm-servicemap/src/operationsInterfaces/machineGroups.ts @@ -0,0 +1,90 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + MachineGroup, + MachineGroupsListByWorkspaceOptionalParams, + MachineGroupsCreateOptionalParams, + MachineGroupsCreateResponse, + MachineGroupsGetOptionalParams, + MachineGroupsGetResponse, + MachineGroupsUpdateOptionalParams, + MachineGroupsUpdateResponse, + MachineGroupsDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a MachineGroups. */ +export interface MachineGroups { + /** + * Returns all machine groups during the specified time interval. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param options The options parameters. + */ + listByWorkspace( + resourceGroupName: string, + workspaceName: string, + options?: MachineGroupsListByWorkspaceOptionalParams + ): PagedAsyncIterableIterator; + /** + * Creates a new machine group. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineGroup Machine Group resource to create. + * @param options The options parameters. + */ + create( + resourceGroupName: string, + workspaceName: string, + machineGroup: MachineGroup, + options?: MachineGroupsCreateOptionalParams + ): Promise; + /** + * Returns the specified machine group as it existed during the specified time interval. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineGroupName Machine Group resource name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + workspaceName: string, + machineGroupName: string, + options?: MachineGroupsGetOptionalParams + ): Promise; + /** + * Updates a machine group. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineGroupName Machine Group resource name. + * @param machineGroup Machine Group resource to update. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + workspaceName: string, + machineGroupName: string, + machineGroup: MachineGroup, + options?: MachineGroupsUpdateOptionalParams + ): Promise; + /** + * Deletes the specified Machine Group. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineGroupName Machine Group resource name. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + workspaceName: string, + machineGroupName: string, + options?: MachineGroupsDeleteOptionalParams + ): Promise; +} diff --git a/sdk/service-map/arm-servicemap/src/operationsInterfaces/machines.ts b/sdk/service-map/arm-servicemap/src/operationsInterfaces/machines.ts new file mode 100644 index 00000000000..bd21094e514 --- /dev/null +++ b/sdk/service-map/arm-servicemap/src/operationsInterfaces/machines.ts @@ -0,0 +1,126 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + Machine, + MachinesListByWorkspaceOptionalParams, + Connection, + MachinesListConnectionsOptionalParams, + Process, + MachinesListProcessesOptionalParams, + Port, + MachinesListPortsOptionalParams, + MachineGroup, + MachinesListMachineGroupMembershipOptionalParams, + MachinesGetOptionalParams, + MachinesGetResponse, + MachinesGetLivenessOptionalParams, + MachinesGetLivenessResponse +} from "../models"; + +/// +/** Interface representing a Machines. */ +export interface Machines { + /** + * Returns a collection of machines matching the specified conditions. The returned collection + * represents either machines that are active/live during the specified interval of time (`live=true` + * and `startTime`/`endTime` are specified) or that are known to have existed at or some time prior to + * the specified point in time (`live=false` and `timestamp` is specified). + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param options The options parameters. + */ + listByWorkspace( + resourceGroupName: string, + workspaceName: string, + options?: MachinesListByWorkspaceOptionalParams + ): PagedAsyncIterableIterator; + /** + * Returns a collection of connections terminating or originating at the specified machine + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param options The options parameters. + */ + listConnections( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesListConnectionsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Returns a collection of processes on the specified machine matching the specified conditions. The + * returned collection represents either processes that are active/live during the specified interval + * of time (`live=true` and `startTime`/`endTime` are specified) or that are known to have existed at + * or some time prior to the specified point in time (`live=false` and `timestamp` is specified). + * + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param options The options parameters. + */ + listProcesses( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesListProcessesOptionalParams + ): PagedAsyncIterableIterator; + /** + * Returns a collection of live ports on the specified machine during the specified time interval. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param options The options parameters. + */ + listPorts( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesListPortsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Returns a collection of machine groups this machine belongs to during the specified time interval. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param options The options parameters. + */ + listMachineGroupMembership( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesListMachineGroupMembershipOptionalParams + ): PagedAsyncIterableIterator; + /** + * Returns the specified machine. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesGetOptionalParams + ): Promise; + /** + * Obtains the liveness status of the machine during the specified time interval. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param options The options parameters. + */ + getLiveness( + resourceGroupName: string, + workspaceName: string, + machineName: string, + options?: MachinesGetLivenessOptionalParams + ): Promise; +} diff --git a/sdk/service-map/arm-servicemap/src/operationsInterfaces/maps.ts b/sdk/service-map/arm-servicemap/src/operationsInterfaces/maps.ts new file mode 100644 index 00000000000..92a1caefb14 --- /dev/null +++ b/sdk/service-map/arm-servicemap/src/operationsInterfaces/maps.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + MapRequestUnion, + MapsGenerateOptionalParams, + MapsGenerateResponse +} from "../models"; + +/** Interface representing a Maps. */ +export interface Maps { + /** + * Generates the specified map. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param request Request options. + * @param options The options parameters. + */ + generate( + resourceGroupName: string, + workspaceName: string, + request: MapRequestUnion, + options?: MapsGenerateOptionalParams + ): Promise; +} diff --git a/sdk/service-map/arm-servicemap/src/operationsInterfaces/ports.ts b/sdk/service-map/arm-servicemap/src/operationsInterfaces/ports.ts new file mode 100644 index 00000000000..498801777aa --- /dev/null +++ b/sdk/service-map/arm-servicemap/src/operationsInterfaces/ports.ts @@ -0,0 +1,85 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + Process, + PortsListAcceptingProcessesOptionalParams, + Connection, + PortsListConnectionsOptionalParams, + PortsGetOptionalParams, + PortsGetResponse, + PortsGetLivenessOptionalParams, + PortsGetLivenessResponse +} from "../models"; + +/// +/** Interface representing a Ports. */ +export interface Ports { + /** + * Returns a collection of processes accepting on the specified port + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param portName Port resource name. + * @param options The options parameters. + */ + listAcceptingProcesses( + resourceGroupName: string, + workspaceName: string, + machineName: string, + portName: string, + options?: PortsListAcceptingProcessesOptionalParams + ): PagedAsyncIterableIterator; + /** + * Returns a collection of connections established via the specified port. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param portName Port resource name. + * @param options The options parameters. + */ + listConnections( + resourceGroupName: string, + workspaceName: string, + machineName: string, + portName: string, + options?: PortsListConnectionsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Returns the specified port. The port must be live during the specified time interval. If the port is + * not live during the interval, status 404 (Not Found) is returned. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param portName Port resource name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + workspaceName: string, + machineName: string, + portName: string, + options?: PortsGetOptionalParams + ): Promise; + /** + * Obtains the liveness status of the port during the specified time interval. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param portName Port resource name. + * @param options The options parameters. + */ + getLiveness( + resourceGroupName: string, + workspaceName: string, + machineName: string, + portName: string, + options?: PortsGetLivenessOptionalParams + ): Promise; +} diff --git a/sdk/service-map/arm-servicemap/src/operationsInterfaces/processes.ts b/sdk/service-map/arm-servicemap/src/operationsInterfaces/processes.ts new file mode 100644 index 00000000000..9da2f6e08ae --- /dev/null +++ b/sdk/service-map/arm-servicemap/src/operationsInterfaces/processes.ts @@ -0,0 +1,84 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + Port, + ProcessesListAcceptingPortsOptionalParams, + Connection, + ProcessesListConnectionsOptionalParams, + ProcessesGetOptionalParams, + ProcessesGetResponse, + ProcessesGetLivenessOptionalParams, + ProcessesGetLivenessResponse +} from "../models"; + +/// +/** Interface representing a Processes. */ +export interface Processes { + /** + * Returns a collection of ports on which this process is accepting + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param processName Process resource name. + * @param options The options parameters. + */ + listAcceptingPorts( + resourceGroupName: string, + workspaceName: string, + machineName: string, + processName: string, + options?: ProcessesListAcceptingPortsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Returns a collection of connections terminating or originating at the specified process + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param processName Process resource name. + * @param options The options parameters. + */ + listConnections( + resourceGroupName: string, + workspaceName: string, + machineName: string, + processName: string, + options?: ProcessesListConnectionsOptionalParams + ): PagedAsyncIterableIterator; + /** + * Returns the specified process. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param processName Process resource name. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + workspaceName: string, + machineName: string, + processName: string, + options?: ProcessesGetOptionalParams + ): Promise; + /** + * Obtains the liveness status of the process during the specified time interval. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param machineName Machine resource name. + * @param processName Process resource name. + * @param options The options parameters. + */ + getLiveness( + resourceGroupName: string, + workspaceName: string, + machineName: string, + processName: string, + options?: ProcessesGetLivenessOptionalParams + ): Promise; +} diff --git a/sdk/service-map/arm-servicemap/src/operationsInterfaces/summaries.ts b/sdk/service-map/arm-servicemap/src/operationsInterfaces/summaries.ts new file mode 100644 index 00000000000..2ad43ceac18 --- /dev/null +++ b/sdk/service-map/arm-servicemap/src/operationsInterfaces/summaries.ts @@ -0,0 +1,27 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + SummariesGetMachinesOptionalParams, + SummariesGetMachinesResponse +} from "../models"; + +/** Interface representing a Summaries. */ +export interface Summaries { + /** + * Returns summary information about the machines in the workspace. + * @param resourceGroupName Resource group name within the specified subscriptionId. + * @param workspaceName OMS workspace containing the resources of interest. + * @param options The options parameters. + */ + getMachines( + resourceGroupName: string, + workspaceName: string, + options?: SummariesGetMachinesOptionalParams + ): Promise; +} diff --git a/sdk/service-map/arm-servicemap/src/serviceMap.ts b/sdk/service-map/arm-servicemap/src/serviceMap.ts new file mode 100644 index 00000000000..35c6073aa1c --- /dev/null +++ b/sdk/service-map/arm-servicemap/src/serviceMap.ts @@ -0,0 +1,103 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; +import * as coreAuth from "@azure/core-auth"; +import { + MachinesImpl, + ProcessesImpl, + PortsImpl, + ClientGroupsImpl, + MapsImpl, + SummariesImpl, + MachineGroupsImpl +} from "./operations"; +import { + Machines, + Processes, + Ports, + ClientGroups, + Maps, + Summaries, + MachineGroups +} from "./operationsInterfaces"; +import { ServiceMapOptionalParams } from "./models"; + +export class ServiceMap extends coreClient.ServiceClient { + $host: string; + subscriptionId: string; + apiVersion: string; + + /** + * Initializes a new instance of the ServiceMap class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId Azure subscription identifier. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: ServiceMapOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (subscriptionId === undefined) { + throw new Error("'subscriptionId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: ServiceMapOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-servicemap/3.0.0-beta.1`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + if (!options.credentialScopes) { + options.credentialScopes = ["https://management.azure.com/.default"]; + } + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: options.endpoint || "https://management.azure.com" + }; + super(optionsWithDefaults); + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2015-11-01-preview"; + this.machines = new MachinesImpl(this); + this.processes = new ProcessesImpl(this); + this.ports = new PortsImpl(this); + this.clientGroups = new ClientGroupsImpl(this); + this.maps = new MapsImpl(this); + this.summaries = new SummariesImpl(this); + this.machineGroups = new MachineGroupsImpl(this); + } + + machines: Machines; + processes: Processes; + ports: Ports; + clientGroups: ClientGroups; + maps: Maps; + summaries: Summaries; + machineGroups: MachineGroups; +} diff --git a/sdk/service-map/arm-servicemap/src/servicemapManagementClient.ts b/sdk/service-map/arm-servicemap/src/servicemapManagementClient.ts deleted file mode 100644 index 22ab164d4ac..00000000000 --- a/sdk/service-map/arm-servicemap/src/servicemapManagementClient.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "./models"; -import * as Mappers from "./models/mappers"; -import * as operations from "./operations"; -import { ServicemapManagementClientContext } from "./servicemapManagementClientContext"; - - -class ServicemapManagementClient extends ServicemapManagementClientContext { - // Operation groups - machines: operations.Machines; - processes: operations.Processes; - ports: operations.Ports; - clientGroups: operations.ClientGroups; - maps: operations.Maps; - summaries: operations.Summaries; - machineGroups: operations.MachineGroups; - - /** - * Initializes a new instance of the ServicemapManagementClient class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param subscriptionId Azure subscription identifier. - * @param [options] The parameter options - */ - constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.ServicemapManagementClientOptions) { - super(credentials, subscriptionId, options); - this.machines = new operations.Machines(this); - this.processes = new operations.Processes(this); - this.ports = new operations.Ports(this); - this.clientGroups = new operations.ClientGroups(this); - this.maps = new operations.Maps(this); - this.summaries = new operations.Summaries(this); - this.machineGroups = new operations.MachineGroups(this); - } -} - -// Operation Specifications - -export { - ServicemapManagementClient, - ServicemapManagementClientContext, - Models as ServicemapManagementModels, - Mappers as ServicemapManagementMappers -}; -export * from "./operations"; diff --git a/sdk/service-map/arm-servicemap/src/servicemapManagementClientContext.ts b/sdk/service-map/arm-servicemap/src/servicemapManagementClientContext.ts deleted file mode 100644 index 782f1814057..00000000000 --- a/sdk/service-map/arm-servicemap/src/servicemapManagementClientContext.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import * as Models from "./models"; -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; - -const packageName = "@azure/arm-servicemap"; -const packageVersion = "2.2.0"; - -export class ServicemapManagementClientContext extends msRestAzure.AzureServiceClient { - credentials: msRest.ServiceClientCredentials; - subscriptionId: string; - apiVersion?: string; - - /** - * Initializes a new instance of the ServicemapManagementClient class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param subscriptionId Azure subscription identifier. - * @param [options] The parameter options - */ - constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.ServicemapManagementClientOptions) { - if (credentials == undefined) { - throw new Error('\'credentials\' cannot be null.'); - } - if (subscriptionId == undefined) { - throw new Error('\'subscriptionId\' cannot be null.'); - } - - if (!options) { - options = {}; - } - if(!options.userAgent) { - const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); - options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; - } - - super(credentials, options); - - this.apiVersion = '2015-11-01-preview'; - this.acceptLanguage = 'en-US'; - this.longRunningOperationRetryTimeout = 30; - this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; - this.requestContentType = "application/json; charset=utf-8"; - this.credentials = credentials; - this.subscriptionId = subscriptionId; - - if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { - this.acceptLanguage = options.acceptLanguage; - } - if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { - this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; - } - } -} diff --git a/sdk/service-map/arm-servicemap/test/sampleTest.ts b/sdk/service-map/arm-servicemap/test/sampleTest.ts new file mode 100644 index 00000000000..7ed89b043e1 --- /dev/null +++ b/sdk/service-map/arm-servicemap/test/sampleTest.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + env, + record, + RecorderEnvironmentSetup, + Recorder +} from "@azure-tools/test-recorder"; +import * as assert from "assert"; + +const recorderEnvSetup: RecorderEnvironmentSetup = { + replaceableVariables: { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" + }, + customizationsOnRecordings: [ + (recording: any): any => + recording.replace( + /"access_token":"[^"]*"/g, + `"access_token":"access_token"` + ) + ], + queryParametersToSkip: [] +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function() { + recorder = record(this, recorderEnvSetup); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/service-map/arm-servicemap/tsconfig.json b/sdk/service-map/arm-servicemap/tsconfig.json index 422b584abd5..1ec8a4c4bf4 100644 --- a/sdk/service-map/arm-servicemap/tsconfig.json +++ b/sdk/service-map/arm-servicemap/tsconfig.json @@ -3,7 +3,7 @@ "module": "es6", "moduleResolution": "node", "strict": true, - "target": "es5", + "target": "es6", "sourceMap": true, "declarationMap": true, "esModuleInterop": true, @@ -11,9 +11,10 @@ "forceConsistentCasingInFileNames": true, "lib": ["es6", "dom"], "declaration": true, - "outDir": "./esm", - "importHelpers": true + "outDir": "./dist-esm", + "importHelpers": true, + "paths": { "@azure/arm-servicemap": ["./src/index"] } }, - "include": ["./src/**/*.ts"], + "include": ["./src/**/*.ts", "./test/**/*.ts", "samples-dev/**/*.ts"], "exclude": ["node_modules"] } diff --git a/sdk/service-map/ci.yml b/sdk/service-map/ci.yml new file mode 100644 index 00000000000..0bd22a865a6 --- /dev/null +++ b/sdk/service-map/ci.yml @@ -0,0 +1,30 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/service-map/ + +pr: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/service-map/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: service-map + Artifacts: + - name: azure-arm-servicemap + safeName: azurearmservicemap + \ No newline at end of file diff --git a/sdk/signalr/arm-signalr/CHANGELOG.md b/sdk/signalr/arm-signalr/CHANGELOG.md new file mode 100644 index 00000000000..14a51e55aa0 --- /dev/null +++ b/sdk/signalr/arm-signalr/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 5.0.0 (2022-01-21) + +The package of @azure/arm-signalr is using our next generation design principles since version 5.0.0, which contains breaking changes. + +To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog). + +To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/signalr/arm-signalr/LICENSE b/sdk/signalr/arm-signalr/LICENSE new file mode 100644 index 00000000000..5d1d36e0af8 --- /dev/null +++ b/sdk/signalr/arm-signalr/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/signalr/arm-signalr/README.md b/sdk/signalr/arm-signalr/README.md index e7ef96e7209..60cad7fe035 100644 --- a/sdk/signalr/arm-signalr/README.md +++ b/sdk/signalr/arm-signalr/README.md @@ -1,107 +1,98 @@ -## Azure SignalRManagementClient SDK for JavaScript +# Azure SignalRManagement client library for JavaScript -This package contains an isomorphic SDK for SignalRManagementClient. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure SignalRManagement client. + +REST API for Azure SignalR Service + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/signalr/arm-signalr) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-signalr) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-signalr) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started ### Currently supported environments - [LTS versions of Node.js](https://nodejs.org/about/releases/) -- Latest versions of Safari, Chrome, Edge, and Firefox. +- Latest versions of Safari, Chrome, Edge and Firefox. -### How to Install +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-signalr` package + +Install the Azure SignalRManagement client library for JavaScript with `npm`: ```bash npm install @azure/arm-signalr ``` -### How to use +### Create and authenticate a `SignalRManagementClient` -#### nodejs - client creation and list operations as an example written in TypeScript. +To create a client object to access the Azure SignalRManagement API, you will need the `endpoint` of your Azure SignalRManagement resource and a `credential`. The Azure SignalRManagement client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure SignalRManagement resource in the [Azure Portal][azure_portal]. -##### Install @azure/ms-rest-nodeauth +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). -- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`. +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/ms-rest-nodeauth@"^3.0.0" +npm install @azure/identity ``` -##### Sample code +You will also need to **register a new AAD application and grant access to Azure SignalRManagement** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. -While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). -```typescript -const msRestNodeAuth = require("@azure/ms-rest-nodeauth"); +```javascript const { SignalRManagementClient } = require("@azure/arm-signalr"); -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; - -msRestNodeAuth - .interactiveLogin() - .then((creds) => { - const client = new SignalRManagementClient(creds, subscriptionId); - client.operations.list().then((result) => { - console.log("The result is:"); - console.log(result); - }); - }) - .catch((err) => { - console.error(err); - }); +const { DefaultAzureCredential } = require("@azure/identity"); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new SignalRManagementClient(new DefaultAzureCredential(), subscriptionId); ``` -#### browser - Authentication, client creation and list operations as an example written in JavaScript. -##### Install @azure/ms-rest-browserauth +### 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). -```bash -npm install @azure/ms-rest-browserauth +## Key concepts + +### SignalRManagementClient + +`SignalRManagementClient` is the primary interface for developers using the Azure SignalRManagement client library. Explore the methods on this client object to understand the different features of the Azure SignalRManagement 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"); ``` -##### Sample code +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). -See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. +## Next steps -- index.html +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. -```html - - - - @azure/arm-signalr sample - - - - - - - - -``` +## 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) +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/signalr/arm-signalr/README.png) +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fsignalr%2Farm-signalr%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/signalr/arm-signalr/_meta.json b/sdk/signalr/arm-signalr/_meta.json new file mode 100644 index 00000000000..5a3939dd750 --- /dev/null +++ b/sdk/signalr/arm-signalr/_meta.json @@ -0,0 +1,7 @@ +{ + "commit": "f9a6cb686bcc0f1b23761db19f2491c5c4df95cb", + "readme": "specification/signalr/resource-manager/readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/signalr/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20220114.1 --generate-sample=true", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "use": "@autorest/typescript@6.0.0-alpha.16.20220114.1" +} \ No newline at end of file diff --git a/sdk/signalr/arm-signalr/api-extractor.json b/sdk/signalr/arm-signalr/api-extractor.json new file mode 100644 index 00000000000..f2479276b65 --- /dev/null +++ b/sdk/signalr/arm-signalr/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-signalr.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/signalr/arm-signalr/package.json b/sdk/signalr/arm-signalr/package.json index d6e619813da..ad340542695 100644 --- a/sdk/signalr/arm-signalr/package.json +++ b/sdk/signalr/arm-signalr/package.json @@ -1,58 +1,103 @@ { "name": "@azure/arm-signalr", + "sdk-type": "mgmt", "author": "Microsoft Corporation", - "description": "SignalRManagementClient Library with typescript type definitions for node.js and browser.", - "version": "4.0.0", + "description": "A generated SDK for SignalRManagementClient.", + "version": "5.0.0", + "engines": { "node": ">=12.0.0" }, "dependencies": { - "@azure/ms-rest-azure-js": "^2.0.1", - "@azure/ms-rest-js": "^2.0.4", - "tslib": "^1.10.0" + "@azure/core-lro": "^2.2.0", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.1.0", + "tslib": "^2.2.0" }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], + "keywords": ["node", "azure", "typescript", "browser", "isomorphic"], "license": "MIT", - "main": "./dist/arm-signalr.js", - "module": "./esm/signalRManagementClient.js", - "types": "./esm/signalRManagementClient.d.ts", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-signalr.d.ts", "devDependencies": { - "typescript": "^3.5.3", - "rollup": "^1.18.0", - "rollup-plugin-node-resolve": "^5.2.0", + "@microsoft/api-extractor": "^7.18.11", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "mkdirp": "^1.0.4", + "rollup": "^1.16.3", "rollup-plugin-sourcemaps": "^0.4.2", - "uglify-js": "^3.6.0" + "typescript": "~4.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^1.0.0", + "mocha": "^7.1.1", + "cross-env": "^7.0.2" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/signalr/arm-signalr", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" }, - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, + "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, "files": [ "dist/**/*.js", "dist/**/*.js.map", "dist/**/*.d.ts", "dist/**/*.d.ts.map", - "esm/**/*.js", - "esm/**/*.js.map", - "esm/**/*.d.ts", - "esm/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", "src/**/*.ts", "README.md", + "LICENSE", "rollup.config.js", - "tsconfig.json" + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" ], "scripts": { - "build": "tsc && rollup -c rollup.config.js && npm run minify", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-signalr.js.map'\" -o ./dist/arm-signalr.min.js ./dist/arm-signalr.js", - "prepack": "npm install && npm run build" + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" }, "sideEffects": false, - "autoPublish": true + "//metadata": { + "constantPaths": [ + { "path": "src/SignalRManagementClient.ts", "prefix": "packageDetails" } + ] + }, + "autoPublish": true, + "//sampleConfiguration": { + "productName": "", + "productSlugs": ["azure"], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-signalr?view=azure-node-preview" + } } diff --git a/sdk/signalr/arm-signalr/recordings/node/my_test/recording_sample_test.js b/sdk/signalr/arm-signalr/recordings/node/my_test/recording_sample_test.js new file mode 100644 index 00000000000..0f6ecb857ac --- /dev/null +++ b/sdk/signalr/arm-signalr/recordings/node/my_test/recording_sample_test.js @@ -0,0 +1,5 @@ +let nock = require('nock'); + +module.exports.hash = "7a6be38bb8cb644d64b4094802301751"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} diff --git a/sdk/signalr/arm-signalr/review/arm-signalr.api.md b/sdk/signalr/arm-signalr/review/arm-signalr.api.md new file mode 100644 index 00000000000..f143251c709 --- /dev/null +++ b/sdk/signalr/arm-signalr/review/arm-signalr.api.md @@ -0,0 +1,873 @@ +## API Report File for "@azure/arm-signalr" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { PollOperationState } from '@azure/core-lro'; + +// @public +export type ACLAction = string; + +// @public +export type CreatedByType = string; + +// @public +export interface Dimension { + displayName?: string; + internalName?: string; + name?: string; + toBeExportedForShoebox?: boolean; +} + +// @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 type FeatureFlags = string; + +// @public +type KeyType_2 = string; +export { KeyType_2 as KeyType } + +// @public +export enum KnownACLAction { + // (undocumented) + Allow = "Allow", + // (undocumented) + Deny = "Deny" +} + +// @public +export enum KnownCreatedByType { + // (undocumented) + Application = "Application", + // (undocumented) + Key = "Key", + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + User = "User" +} + +// @public +export enum KnownFeatureFlags { + // (undocumented) + EnableConnectivityLogs = "EnableConnectivityLogs", + // (undocumented) + EnableLiveTrace = "EnableLiveTrace", + // (undocumented) + EnableMessagingLogs = "EnableMessagingLogs", + // (undocumented) + ServiceMode = "ServiceMode" +} + +// @public +export enum KnownKeyType { + // (undocumented) + Primary = "Primary", + // (undocumented) + Salt = "Salt", + // (undocumented) + Secondary = "Secondary" +} + +// @public +export enum KnownManagedIdentityType { + // (undocumented) + None = "None", + // (undocumented) + SystemAssigned = "SystemAssigned", + // (undocumented) + UserAssigned = "UserAssigned" +} + +// @public +export enum KnownPrivateLinkServiceConnectionStatus { + // (undocumented) + Approved = "Approved", + // (undocumented) + Disconnected = "Disconnected", + // (undocumented) + Pending = "Pending", + // (undocumented) + Rejected = "Rejected" +} + +// @public +export enum KnownProvisioningState { + // (undocumented) + Canceled = "Canceled", + // (undocumented) + Creating = "Creating", + // (undocumented) + Deleting = "Deleting", + // (undocumented) + Failed = "Failed", + // (undocumented) + Moving = "Moving", + // (undocumented) + Running = "Running", + // (undocumented) + Succeeded = "Succeeded", + // (undocumented) + Unknown = "Unknown", + // (undocumented) + Updating = "Updating" +} + +// @public +export enum KnownScaleType { + // (undocumented) + Automatic = "Automatic", + // (undocumented) + Manual = "Manual", + // (undocumented) + None = "None" +} + +// @public +export enum KnownServiceKind { + // (undocumented) + RawWebSockets = "RawWebSockets", + // (undocumented) + SignalR = "SignalR" +} + +// @public +export enum KnownSharedPrivateLinkResourceStatus { + // (undocumented) + Approved = "Approved", + // (undocumented) + Disconnected = "Disconnected", + // (undocumented) + Pending = "Pending", + // (undocumented) + Rejected = "Rejected", + // (undocumented) + Timeout = "Timeout" +} + +// @public +export enum KnownSignalRRequestType { + // (undocumented) + ClientConnection = "ClientConnection", + // (undocumented) + Restapi = "RESTAPI", + // (undocumented) + ServerConnection = "ServerConnection", + // (undocumented) + Trace = "Trace" +} + +// @public +export enum KnownSignalRSkuTier { + // (undocumented) + Basic = "Basic", + // (undocumented) + Free = "Free", + // (undocumented) + Premium = "Premium", + // (undocumented) + Standard = "Standard" +} + +// @public +export enum KnownUpstreamAuthType { + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + None = "None" +} + +// @public +export interface LogSpecification { + displayName?: string; + name?: string; +} + +// @public +export interface ManagedIdentity { + readonly principalId?: string; + readonly tenantId?: string; + type?: ManagedIdentityType; + userAssignedIdentities?: { + [propertyName: string]: UserAssignedIdentityProperty; + }; +} + +// @public +export interface ManagedIdentitySettings { + resource?: string; +} + +// @public +export type ManagedIdentityType = string; + +// @public +export interface MetricSpecification { + aggregationType?: string; + category?: string; + dimensions?: Dimension[]; + displayDescription?: string; + displayName?: string; + fillGapWithZero?: string; + name?: string; + unit?: string; +} + +// @public +export interface NameAvailability { + message?: string; + nameAvailable?: boolean; + reason?: string; +} + +// @public +export interface NameAvailabilityParameters { + name: string; + type: string; +} + +// @public +export interface NetworkACL { + allow?: SignalRRequestType[]; + deny?: SignalRRequestType[]; +} + +// @public +export interface Operation { + display?: OperationDisplay; + isDataAction?: boolean; + name?: string; + origin?: string; + properties?: OperationProperties; +} + +// @public +export interface OperationDisplay { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public +export interface OperationList { + nextLink?: string; + value?: Operation[]; +} + +// @public +export interface OperationProperties { + serviceSpecification?: ServiceSpecification; +} + +// @public +export interface Operations { + list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListNextResponse = OperationList; + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = OperationList; + +// @public +export interface PrivateEndpoint { + id?: string; +} + +// @public +export type PrivateEndpointACL = NetworkACL & { + name: string; +}; + +// @public +export type PrivateEndpointConnection = ProxyResource & { + readonly systemData?: SystemData; + readonly provisioningState?: ProvisioningState; + privateEndpoint?: PrivateEndpoint; + readonly groupIds?: string[]; + privateLinkServiceConnectionState?: PrivateLinkServiceConnectionState; +}; + +// @public +export interface PrivateEndpointConnectionList { + nextLink?: string; + value?: PrivateEndpointConnection[]; +} + +// @public +export type PrivateLinkResource = ProxyResource & { + groupId?: string; + requiredMembers?: string[]; + requiredZoneNames?: string[]; + shareablePrivateLinkResourceTypes?: ShareablePrivateLinkResourceType[]; +}; + +// @public +export interface PrivateLinkResourceList { + nextLink?: string; + value?: PrivateLinkResource[]; +} + +// @public +export interface PrivateLinkServiceConnectionState { + actionsRequired?: string; + description?: string; + status?: PrivateLinkServiceConnectionStatus; +} + +// @public +export type PrivateLinkServiceConnectionStatus = string; + +// @public +export type ProvisioningState = string; + +// @public +export type ProxyResource = Resource & {}; + +// @public +export interface RegenerateKeyParameters { + keyType?: KeyType_2; +} + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +// @public +export interface ResourceLogCategory { + enabled?: string; + name?: string; +} + +// @public +export interface ResourceLogConfiguration { + categories?: ResourceLogCategory[]; +} + +// @public +export interface ResourceSku { + capacity?: number; + readonly family?: string; + name: string; + readonly size?: string; + tier?: SignalRSkuTier; +} + +// @public +export type ScaleType = string; + +// @public +export interface ServerlessUpstreamSettings { + templates?: UpstreamTemplate[]; +} + +// @public +export type ServiceKind = string; + +// @public +export interface ServiceSpecification { + logSpecifications?: LogSpecification[]; + metricSpecifications?: MetricSpecification[]; +} + +// @public +export interface ShareablePrivateLinkResourceProperties { + description?: string; + groupId?: string; + type?: string; +} + +// @public +export interface ShareablePrivateLinkResourceType { + name?: string; + properties?: ShareablePrivateLinkResourceProperties; +} + +// @public +export type SharedPrivateLinkResource = ProxyResource & { + readonly systemData?: SystemData; + groupId?: string; + privateLinkResourceId?: string; + readonly provisioningState?: ProvisioningState; + requestMessage?: string; + readonly status?: SharedPrivateLinkResourceStatus; +}; + +// @public +export interface SharedPrivateLinkResourceList { + nextLink?: string; + value?: SharedPrivateLinkResource[]; +} + +// @public +export type SharedPrivateLinkResourceStatus = string; + +// @public +export interface SignalR { + beginCreateOrUpdate(resourceGroupName: string, resourceName: string, parameters: SignalRResource, options?: SignalRCreateOrUpdateOptionalParams): Promise, SignalRCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, resourceName: string, parameters: SignalRResource, options?: SignalRCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, resourceName: string, options?: SignalRDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, resourceName: string, options?: SignalRDeleteOptionalParams): Promise; + beginRegenerateKey(resourceGroupName: string, resourceName: string, parameters: RegenerateKeyParameters, options?: SignalRRegenerateKeyOptionalParams): Promise, SignalRRegenerateKeyResponse>>; + beginRegenerateKeyAndWait(resourceGroupName: string, resourceName: string, parameters: RegenerateKeyParameters, options?: SignalRRegenerateKeyOptionalParams): Promise; + beginRestart(resourceGroupName: string, resourceName: string, options?: SignalRRestartOptionalParams): Promise, void>>; + beginRestartAndWait(resourceGroupName: string, resourceName: string, options?: SignalRRestartOptionalParams): Promise; + beginUpdate(resourceGroupName: string, resourceName: string, parameters: SignalRResource, options?: SignalRUpdateOptionalParams): Promise, SignalRUpdateResponse>>; + beginUpdateAndWait(resourceGroupName: string, resourceName: string, parameters: SignalRResource, options?: SignalRUpdateOptionalParams): Promise; + checkNameAvailability(location: string, parameters: NameAvailabilityParameters, options?: SignalRCheckNameAvailabilityOptionalParams): Promise; + get(resourceGroupName: string, resourceName: string, options?: SignalRGetOptionalParams): Promise; + listByResourceGroup(resourceGroupName: string, options?: SignalRListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listBySubscription(options?: SignalRListBySubscriptionOptionalParams): PagedAsyncIterableIterator; + listKeys(resourceGroupName: string, resourceName: string, options?: SignalRListKeysOptionalParams): Promise; + listSkus(resourceGroupName: string, resourceName: string, options?: SignalRListSkusOptionalParams): Promise; +} + +// @public +export interface SignalRCheckNameAvailabilityOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SignalRCheckNameAvailabilityResponse = NameAvailability; + +// @public +export interface SignalRCorsSettings { + allowedOrigins?: string[]; +} + +// @public +export interface SignalRCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type SignalRCreateOrUpdateResponse = SignalRResource; + +// @public +export interface SignalRDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface SignalRFeature { + flag: FeatureFlags; + properties?: { + [propertyName: string]: string; + }; + value: string; +} + +// @public +export interface SignalRGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SignalRGetResponse = SignalRResource; + +// @public +export interface SignalRKeys { + primaryConnectionString?: string; + primaryKey?: string; + secondaryConnectionString?: string; + secondaryKey?: string; +} + +// @public +export interface SignalRListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SignalRListByResourceGroupNextResponse = SignalRResourceList; + +// @public +export interface SignalRListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SignalRListByResourceGroupResponse = SignalRResourceList; + +// @public +export interface SignalRListBySubscriptionNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SignalRListBySubscriptionNextResponse = SignalRResourceList; + +// @public +export interface SignalRListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SignalRListBySubscriptionResponse = SignalRResourceList; + +// @public +export interface SignalRListKeysOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SignalRListKeysResponse = SignalRKeys; + +// @public +export interface SignalRListSkusOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SignalRListSkusResponse = SkuList; + +// @public (undocumented) +export class SignalRManagementClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: SignalRManagementClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + operations: Operations; + // (undocumented) + signalR: SignalR; + // (undocumented) + signalRPrivateEndpointConnections: SignalRPrivateEndpointConnections; + // (undocumented) + signalRPrivateLinkResources: SignalRPrivateLinkResources; + // (undocumented) + signalRSharedPrivateLinkResources: SignalRSharedPrivateLinkResources; + // (undocumented) + subscriptionId: string; + // (undocumented) + usages: Usages; +} + +// @public +export interface SignalRManagementClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export interface SignalRNetworkACLs { + defaultAction?: ACLAction; + privateEndpoints?: PrivateEndpointACL[]; + publicNetwork?: NetworkACL; +} + +// @public +export interface SignalRPrivateEndpointConnections { + beginDelete(privateEndpointConnectionName: string, resourceGroupName: string, resourceName: string, options?: SignalRPrivateEndpointConnectionsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(privateEndpointConnectionName: string, resourceGroupName: string, resourceName: string, options?: SignalRPrivateEndpointConnectionsDeleteOptionalParams): Promise; + get(privateEndpointConnectionName: string, resourceGroupName: string, resourceName: string, options?: SignalRPrivateEndpointConnectionsGetOptionalParams): Promise; + list(resourceGroupName: string, resourceName: string, options?: SignalRPrivateEndpointConnectionsListOptionalParams): PagedAsyncIterableIterator; + update(privateEndpointConnectionName: string, resourceGroupName: string, resourceName: string, parameters: PrivateEndpointConnection, options?: SignalRPrivateEndpointConnectionsUpdateOptionalParams): Promise; +} + +// @public +export interface SignalRPrivateEndpointConnectionsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface SignalRPrivateEndpointConnectionsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SignalRPrivateEndpointConnectionsGetResponse = PrivateEndpointConnection; + +// @public +export interface SignalRPrivateEndpointConnectionsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SignalRPrivateEndpointConnectionsListNextResponse = PrivateEndpointConnectionList; + +// @public +export interface SignalRPrivateEndpointConnectionsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SignalRPrivateEndpointConnectionsListResponse = PrivateEndpointConnectionList; + +// @public +export interface SignalRPrivateEndpointConnectionsUpdateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SignalRPrivateEndpointConnectionsUpdateResponse = PrivateEndpointConnection; + +// @public +export interface SignalRPrivateLinkResources { + list(resourceGroupName: string, resourceName: string, options?: SignalRPrivateLinkResourcesListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface SignalRPrivateLinkResourcesListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SignalRPrivateLinkResourcesListNextResponse = PrivateLinkResourceList; + +// @public +export interface SignalRPrivateLinkResourcesListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SignalRPrivateLinkResourcesListResponse = PrivateLinkResourceList; + +// @public +export interface SignalRRegenerateKeyOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type SignalRRegenerateKeyResponse = SignalRKeys; + +// @public +export type SignalRRequestType = string; + +// @public +export type SignalRResource = TrackedResource & { + sku?: ResourceSku; + kind?: ServiceKind; + identity?: ManagedIdentity; + readonly systemData?: SystemData; + readonly provisioningState?: ProvisioningState; + readonly externalIP?: string; + readonly hostName?: string; + readonly publicPort?: number; + readonly serverPort?: number; + readonly version?: string; + readonly privateEndpointConnections?: PrivateEndpointConnection[]; + readonly sharedPrivateLinkResources?: SharedPrivateLinkResource[]; + tls?: SignalRTlsSettings; + readonly hostNamePrefix?: string; + features?: SignalRFeature[]; + resourceLogConfiguration?: ResourceLogConfiguration; + cors?: SignalRCorsSettings; + upstream?: ServerlessUpstreamSettings; + networkACLs?: SignalRNetworkACLs; + publicNetworkAccess?: string; + disableLocalAuth?: boolean; + disableAadAuth?: boolean; +}; + +// @public +export interface SignalRResourceList { + nextLink?: string; + value?: SignalRResource[]; +} + +// @public +export interface SignalRRestartOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface SignalRSharedPrivateLinkResources { + beginCreateOrUpdate(sharedPrivateLinkResourceName: string, resourceGroupName: string, resourceName: string, parameters: SharedPrivateLinkResource, options?: SignalRSharedPrivateLinkResourcesCreateOrUpdateOptionalParams): Promise, SignalRSharedPrivateLinkResourcesCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(sharedPrivateLinkResourceName: string, resourceGroupName: string, resourceName: string, parameters: SharedPrivateLinkResource, options?: SignalRSharedPrivateLinkResourcesCreateOrUpdateOptionalParams): Promise; + beginDelete(sharedPrivateLinkResourceName: string, resourceGroupName: string, resourceName: string, options?: SignalRSharedPrivateLinkResourcesDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(sharedPrivateLinkResourceName: string, resourceGroupName: string, resourceName: string, options?: SignalRSharedPrivateLinkResourcesDeleteOptionalParams): Promise; + get(sharedPrivateLinkResourceName: string, resourceGroupName: string, resourceName: string, options?: SignalRSharedPrivateLinkResourcesGetOptionalParams): Promise; + list(resourceGroupName: string, resourceName: string, options?: SignalRSharedPrivateLinkResourcesListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface SignalRSharedPrivateLinkResourcesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type SignalRSharedPrivateLinkResourcesCreateOrUpdateResponse = SharedPrivateLinkResource; + +// @public +export interface SignalRSharedPrivateLinkResourcesDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface SignalRSharedPrivateLinkResourcesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SignalRSharedPrivateLinkResourcesGetResponse = SharedPrivateLinkResource; + +// @public +export interface SignalRSharedPrivateLinkResourcesListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SignalRSharedPrivateLinkResourcesListNextResponse = SharedPrivateLinkResourceList; + +// @public +export interface SignalRSharedPrivateLinkResourcesListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SignalRSharedPrivateLinkResourcesListResponse = SharedPrivateLinkResourceList; + +// @public +export type SignalRSkuTier = string; + +// @public +export interface SignalRTlsSettings { + clientCertEnabled?: boolean; +} + +// @public +export interface SignalRUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type SignalRUpdateResponse = SignalRResource; + +// @public +export interface SignalRUsage { + currentValue?: number; + id?: string; + limit?: number; + name?: SignalRUsageName; + unit?: string; +} + +// @public +export interface SignalRUsageList { + nextLink?: string; + value?: SignalRUsage[]; +} + +// @public +export interface SignalRUsageName { + localizedValue?: string; + value?: string; +} + +// @public +export interface Sku { + readonly capacity?: SkuCapacity; + readonly resourceType?: string; + readonly sku?: ResourceSku; +} + +// @public +export interface SkuCapacity { + readonly allowedValues?: number[]; + readonly default?: number; + readonly maximum?: number; + readonly minimum?: number; + readonly scaleType?: ScaleType; +} + +// @public +export interface SkuList { + readonly nextLink?: string; + readonly value?: Sku[]; +} + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export type TrackedResource = Resource & { + location?: string; + tags?: { + [propertyName: string]: string; + }; +}; + +// @public +export interface UpstreamAuthSettings { + managedIdentity?: ManagedIdentitySettings; + type?: UpstreamAuthType; +} + +// @public +export type UpstreamAuthType = string; + +// @public +export interface UpstreamTemplate { + auth?: UpstreamAuthSettings; + categoryPattern?: string; + eventPattern?: string; + hubPattern?: string; + urlTemplate: string; +} + +// @public +export interface Usages { + list(location: string, options?: UsagesListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface UsagesListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type UsagesListNextResponse = SignalRUsageList; + +// @public +export interface UsagesListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type UsagesListResponse = SignalRUsageList; + +// @public +export interface UserAssignedIdentityProperty { + readonly clientId?: string; + readonly principalId?: string; +} + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/signalr/arm-signalr/rollup.config.js b/sdk/signalr/arm-signalr/rollup.config.js index 7592cd72d34..9be1955eb7f 100644 --- a/sdk/signalr/arm-signalr/rollup.config.js +++ b/sdk/signalr/arm-signalr/rollup.config.js @@ -1,31 +1,188 @@ -import rollup from "rollup"; -import nodeResolve from "rollup-plugin-node-resolve"; -import sourcemaps from "rollup-plugin-sourcemaps"; - -/** - * @type {rollup.RollupFileOptions} - */ -const config = { - input: "./esm/signalRManagementClient.js", - external: ["@azure/ms-rest-js", "@azure/ms-rest-azure-js"], - output: { - file: "./dist/arm-signalr.js", - format: "umd", - name: "Azure.ArmSignalr", - sourcemap: true, - globals: { - "@azure/ms-rest-js": "msRest", - "@azure/ms-rest-azure-js": "msRestAzure" - }, - banner: `/* +/* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */` - }, - plugins: [nodeResolve({ mainFields: ["module", "main"] }), sourcemaps()] + */ + +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"; + +/** + * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. + * + * NOTE: this manual configuration is only needed because OpenTelemetry uses an + * __exportStar downleveled helper function to declare its exports which confuses + * rollup's automatic discovery mechanism. + * + * @returns an object reference that can be `...`'d into your cjs() configuration. + */ +export function openTelemetryCommonJs() { + const namedExports = {}; + + for (const key of [ + "@opentelemetry/api", + "@azure/core-tracing/node_modules/@opentelemetry/api" + ]) { + namedExports[key] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "SpanStatusCode", + "getSpanContext", + "setSpanContext" + ]; + } + + const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; + + for (const version of releasedOpenTelemetryVersions) { + namedExports[ + // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. + `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` + ] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "StatusCode", + "CanonicalCode", + "getSpanContext", + "setSpanContext" + ]; + } + + return namedExports; +} + +// #region Warning Handler + +/** + * A function that can determine whether a rollupwarning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEvalWarnings(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependencyWarnings(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ + ignoreChaiCircularDependencyWarnings, + ignoreNiseSinonEvalWarnings +]; + +/** + * 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({ + namedExports: { + // Chai's strange internal architecture makes it impossible to statically + // analyze its exports. + chai: [ + "version", + "use", + "util", + "config", + "expect", + "should", + "assert" + ], + ...openTelemetryCommonJs() + } + }), + 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 default config; +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(), cjs()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/signalr/arm-signalr/sample.env b/sdk/signalr/arm-signalr/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/signalr/arm-signalr/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/signalr/arm-signalr/samples-dev/operationsList.ts b/sdk/signalr/arm-signalr/samples-dev/operationsList.ts new file mode 100644 index 00000000000..7235078d511 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/operationsList.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Lists all of the available REST API operations of the Microsoft.SignalRService provider. + * + * @summary Lists all of the available REST API operations of the Microsoft.SignalRService provider. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/Operations_List.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function operationsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +operationsList().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples-dev/signalRCheckNameAvailability.ts b/sdk/signalr/arm-signalr/samples-dev/signalRCheckNameAvailability.ts new file mode 100644 index 00000000000..989707e69a1 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/signalRCheckNameAvailability.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Checks that the resource name is valid and is not already in use. + * + * @summary Checks that the resource name is valid and is not already in use. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_CheckNameAvailability.json + */ +import { + NameAvailabilityParameters, + SignalRManagementClient +} from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRCheckNameAvailability() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const location = "eastus"; + const parameters: NameAvailabilityParameters = { + name: "mySignalRService", + type: "Microsoft.SignalRService/SignalR" + }; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.checkNameAvailability( + location, + parameters + ); + console.log(result); +} + +signalRCheckNameAvailability().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples-dev/signalRCreateOrUpdate.ts b/sdk/signalr/arm-signalr/samples-dev/signalRCreateOrUpdate.ts new file mode 100644 index 00000000000..983166c5c17 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/signalRCreateOrUpdate.ts @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update a resource. + * + * @summary Create or update a resource. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_CreateOrUpdate.json + */ +import { SignalRResource, SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRCreateOrUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const parameters: SignalRResource = { + cors: { allowedOrigins: ["https://foo.com", "https://bar.com"] }, + disableAadAuth: false, + disableLocalAuth: false, + features: [ + { flag: "ServiceMode", properties: {}, value: "Serverless" }, + { flag: "EnableConnectivityLogs", properties: {}, value: "True" }, + { flag: "EnableMessagingLogs", properties: {}, value: "False" }, + { flag: "EnableLiveTrace", properties: {}, value: "False" } + ], + identity: { type: "SystemAssigned" }, + kind: "SignalR", + location: "eastus", + networkACLs: { + defaultAction: "Deny", + privateEndpoints: [ + { + name: "mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e", + allow: ["ServerConnection"] + } + ], + publicNetwork: { allow: ["ClientConnection"] } + }, + publicNetworkAccess: "Enabled", + sku: { name: "Standard_S1", capacity: 1, tier: "Standard" }, + tags: { key1: "value1" }, + tls: { clientCertEnabled: false }, + upstream: { + templates: [ + { + auth: { + type: "ManagedIdentity", + managedIdentity: { resource: "api://example" } + }, + categoryPattern: "*", + eventPattern: "connect,disconnect", + hubPattern: "*", + urlTemplate: "https://example.com/chat/api/connect" + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +signalRCreateOrUpdate().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples-dev/signalRDelete.ts b/sdk/signalr/arm-signalr/samples-dev/signalRDelete.ts new file mode 100644 index 00000000000..85b16053cde --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/signalRDelete.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Operation to delete a resource. + * + * @summary Operation to delete a resource. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_Delete.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRDelete() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.beginDeleteAndWait( + resourceGroupName, + resourceName + ); + console.log(result); +} + +signalRDelete().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples-dev/signalRGet.ts b/sdk/signalr/arm-signalr/samples-dev/signalRGet.ts new file mode 100644 index 00000000000..9ea134b87d1 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/signalRGet.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the resource and its properties. + * + * @summary Get the resource and its properties. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_Get.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.get(resourceGroupName, resourceName); + console.log(result); +} + +signalRGet().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples-dev/signalRListByResourceGroup.ts b/sdk/signalr/arm-signalr/samples-dev/signalRListByResourceGroup.ts new file mode 100644 index 00000000000..21068895302 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/signalRListByResourceGroup.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Handles requests to list all resources in a resource group. + * + * @summary Handles requests to list all resources in a resource group. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_ListByResourceGroup.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRListByResourceGroup() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.signalR.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +signalRListByResourceGroup().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples-dev/signalRListBySubscription.ts b/sdk/signalr/arm-signalr/samples-dev/signalRListBySubscription.ts new file mode 100644 index 00000000000..2391d8584c9 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/signalRListBySubscription.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Handles requests to list all resources in a subscription. + * + * @summary Handles requests to list all resources in a subscription. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_ListBySubscription.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRListBySubscription() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.signalR.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +signalRListBySubscription().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples-dev/signalRListKeys.ts b/sdk/signalr/arm-signalr/samples-dev/signalRListKeys.ts new file mode 100644 index 00000000000..74b59e3949a --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/signalRListKeys.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the access keys of the resource. + * + * @summary Get the access keys of the resource. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_ListKeys.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRListKeys() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.listKeys(resourceGroupName, resourceName); + console.log(result); +} + +signalRListKeys().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples-dev/signalRListSkus.ts b/sdk/signalr/arm-signalr/samples-dev/signalRListSkus.ts new file mode 100644 index 00000000000..83ef473e64f --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/signalRListSkus.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List all available skus of the resource. + * + * @summary List all available skus of the resource. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_ListSkus.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRListSkus() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.listSkus(resourceGroupName, resourceName); + console.log(result); +} + +signalRListSkus().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples-dev/signalRPrivateEndpointConnectionsDelete.ts b/sdk/signalr/arm-signalr/samples-dev/signalRPrivateEndpointConnectionsDelete.ts new file mode 100644 index 00000000000..4d5479364c2 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/signalRPrivateEndpointConnectionsDelete.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Delete the specified private endpoint connection + * + * @summary Delete the specified private endpoint connection + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateEndpointConnections_Delete.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRPrivateEndpointConnectionsDelete() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const privateEndpointConnectionName = + "mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalRPrivateEndpointConnections.beginDeleteAndWait( + privateEndpointConnectionName, + resourceGroupName, + resourceName + ); + console.log(result); +} + +signalRPrivateEndpointConnectionsDelete().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples-dev/signalRPrivateEndpointConnectionsGet.ts b/sdk/signalr/arm-signalr/samples-dev/signalRPrivateEndpointConnectionsGet.ts new file mode 100644 index 00000000000..9cd8817d98f --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/signalRPrivateEndpointConnectionsGet.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the specified private endpoint connection + * + * @summary Get the specified private endpoint connection + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateEndpointConnections_Get.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRPrivateEndpointConnectionsGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const privateEndpointConnectionName = + "mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalRPrivateEndpointConnections.get( + privateEndpointConnectionName, + resourceGroupName, + resourceName + ); + console.log(result); +} + +signalRPrivateEndpointConnectionsGet().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples-dev/signalRPrivateEndpointConnectionsList.ts b/sdk/signalr/arm-signalr/samples-dev/signalRPrivateEndpointConnectionsList.ts new file mode 100644 index 00000000000..f54d9b4fb39 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/signalRPrivateEndpointConnectionsList.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List private endpoint connections + * + * @summary List private endpoint connections + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateEndpointConnections_List.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRPrivateEndpointConnectionsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.signalRPrivateEndpointConnections.list( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +signalRPrivateEndpointConnectionsList().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples-dev/signalRPrivateEndpointConnectionsUpdate.ts b/sdk/signalr/arm-signalr/samples-dev/signalRPrivateEndpointConnectionsUpdate.ts new file mode 100644 index 00000000000..5ed7c2acf82 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/signalRPrivateEndpointConnectionsUpdate.ts @@ -0,0 +1,50 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Update the state of specified private endpoint connection + * + * @summary Update the state of specified private endpoint connection + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateEndpointConnections_Update.json + */ +import { + PrivateEndpointConnection, + SignalRManagementClient +} from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRPrivateEndpointConnectionsUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const privateEndpointConnectionName = + "mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const parameters: PrivateEndpointConnection = { + privateEndpoint: { + id: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint" + }, + privateLinkServiceConnectionState: { + actionsRequired: "None", + status: "Approved" + } + }; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalRPrivateEndpointConnections.update( + privateEndpointConnectionName, + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +signalRPrivateEndpointConnectionsUpdate().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples-dev/signalRPrivateLinkResourcesList.ts b/sdk/signalr/arm-signalr/samples-dev/signalRPrivateLinkResourcesList.ts new file mode 100644 index 00000000000..4e97bfa4402 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/signalRPrivateLinkResourcesList.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the private link resources that need to be created for a resource. + * + * @summary Get the private link resources that need to be created for a resource. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateLinkResources_List.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRPrivateLinkResourcesList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.signalRPrivateLinkResources.list( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +signalRPrivateLinkResourcesList().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples-dev/signalRRegenerateKey.ts b/sdk/signalr/arm-signalr/samples-dev/signalRRegenerateKey.ts new file mode 100644 index 00000000000..31f551c9e91 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/signalRRegenerateKey.ts @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @summary Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_RegenerateKey.json + */ +import { + RegenerateKeyParameters, + SignalRManagementClient +} from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRRegenerateKey() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const parameters: RegenerateKeyParameters = { keyType: "Primary" }; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.beginRegenerateKeyAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +signalRRegenerateKey().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples-dev/signalRRestart.ts b/sdk/signalr/arm-signalr/samples-dev/signalRRestart.ts new file mode 100644 index 00000000000..20092ddd302 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/signalRRestart.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Operation to restart a resource. + * + * @summary Operation to restart a resource. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_Restart.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRRestart() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.beginRestartAndWait( + resourceGroupName, + resourceName + ); + console.log(result); +} + +signalRRestart().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples-dev/signalRSharedPrivateLinkResourcesCreateOrUpdate.ts b/sdk/signalr/arm-signalr/samples-dev/signalRSharedPrivateLinkResourcesCreateOrUpdate.ts new file mode 100644 index 00000000000..727cdadd0ae --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/signalRSharedPrivateLinkResourcesCreateOrUpdate.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update a shared private link resource + * + * @summary Create or update a shared private link resource + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRSharedPrivateLinkResources_CreateOrUpdate.json + */ +import { + SharedPrivateLinkResource, + SignalRManagementClient +} from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRSharedPrivateLinkResourcesCreateOrUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const sharedPrivateLinkResourceName = "upstream"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const parameters: SharedPrivateLinkResource = { + groupId: "sites", + privateLinkResourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp", + requestMessage: "Please approve" + }; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalRSharedPrivateLinkResources.beginCreateOrUpdateAndWait( + sharedPrivateLinkResourceName, + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +signalRSharedPrivateLinkResourcesCreateOrUpdate().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples-dev/signalRSharedPrivateLinkResourcesDelete.ts b/sdk/signalr/arm-signalr/samples-dev/signalRSharedPrivateLinkResourcesDelete.ts new file mode 100644 index 00000000000..663826583a7 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/signalRSharedPrivateLinkResourcesDelete.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Delete the specified shared private link resource + * + * @summary Delete the specified shared private link resource + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRSharedPrivateLinkResources_Delete.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRSharedPrivateLinkResourcesDelete() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const sharedPrivateLinkResourceName = "upstream"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalRSharedPrivateLinkResources.beginDeleteAndWait( + sharedPrivateLinkResourceName, + resourceGroupName, + resourceName + ); + console.log(result); +} + +signalRSharedPrivateLinkResourcesDelete().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples-dev/signalRSharedPrivateLinkResourcesGet.ts b/sdk/signalr/arm-signalr/samples-dev/signalRSharedPrivateLinkResourcesGet.ts new file mode 100644 index 00000000000..479ddbf51d1 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/signalRSharedPrivateLinkResourcesGet.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the specified shared private link resource + * + * @summary Get the specified shared private link resource + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRSharedPrivateLinkResources_Get.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRSharedPrivateLinkResourcesGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const sharedPrivateLinkResourceName = "upstream"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalRSharedPrivateLinkResources.get( + sharedPrivateLinkResourceName, + resourceGroupName, + resourceName + ); + console.log(result); +} + +signalRSharedPrivateLinkResourcesGet().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples-dev/signalRSharedPrivateLinkResourcesList.ts b/sdk/signalr/arm-signalr/samples-dev/signalRSharedPrivateLinkResourcesList.ts new file mode 100644 index 00000000000..220f85cfcbc --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/signalRSharedPrivateLinkResourcesList.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List shared private link resources + * + * @summary List shared private link resources + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRSharedPrivateLinkResources_List.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRSharedPrivateLinkResourcesList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.signalRSharedPrivateLinkResources.list( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +signalRSharedPrivateLinkResourcesList().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples-dev/signalRUpdate.ts b/sdk/signalr/arm-signalr/samples-dev/signalRUpdate.ts new file mode 100644 index 00000000000..4c0a01a71d9 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/signalRUpdate.ts @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Operation to update an exiting resource. + * + * @summary Operation to update an exiting resource. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_Update.json + */ +import { SignalRResource, SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const parameters: SignalRResource = { + cors: { allowedOrigins: ["https://foo.com", "https://bar.com"] }, + disableAadAuth: false, + disableLocalAuth: false, + features: [ + { flag: "ServiceMode", properties: {}, value: "Serverless" }, + { flag: "EnableConnectivityLogs", properties: {}, value: "True" }, + { flag: "EnableMessagingLogs", properties: {}, value: "False" }, + { flag: "EnableLiveTrace", properties: {}, value: "False" } + ], + identity: { type: "SystemAssigned" }, + kind: "SignalR", + location: "eastus", + networkACLs: { + defaultAction: "Deny", + privateEndpoints: [ + { + name: "mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e", + allow: ["ServerConnection"] + } + ], + publicNetwork: { allow: ["ClientConnection"] } + }, + publicNetworkAccess: "Enabled", + sku: { name: "Standard_S1", capacity: 1, tier: "Standard" }, + tags: { key1: "value1" }, + tls: { clientCertEnabled: false }, + upstream: { + templates: [ + { + auth: { + type: "ManagedIdentity", + managedIdentity: { resource: "api://example" } + }, + categoryPattern: "*", + eventPattern: "connect,disconnect", + hubPattern: "*", + urlTemplate: "https://example.com/chat/api/connect" + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.beginUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +signalRUpdate().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples-dev/usagesList.ts b/sdk/signalr/arm-signalr/samples-dev/usagesList.ts new file mode 100644 index 00000000000..c209db27bd9 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples-dev/usagesList.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List resource usage quotas by location. + * + * @summary List resource usage quotas by location. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/Usages_List.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function usagesList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const location = "eastus"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.usages.list(location)) { + resArray.push(item); + } + console.log(resArray); +} + +usagesList().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/README.md b/sdk/signalr/arm-signalr/samples/v5/javascript/README.md new file mode 100644 index 00000000000..6f39037109c --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/README.md @@ -0,0 +1,92 @@ +# client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [operationsList.js][operationslist] | Lists all of the available REST API operations of the Microsoft.SignalRService provider. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/Operations_List.json | +| [signalRCheckNameAvailability.js][signalrchecknameavailability] | Checks that the resource name is valid and is not already in use. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_CheckNameAvailability.json | +| [signalRCreateOrUpdate.js][signalrcreateorupdate] | Create or update a resource. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_CreateOrUpdate.json | +| [signalRDelete.js][signalrdelete] | Operation to delete a resource. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_Delete.json | +| [signalRGet.js][signalrget] | Get the resource and its properties. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_Get.json | +| [signalRListByResourceGroup.js][signalrlistbyresourcegroup] | Handles requests to list all resources in a resource group. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_ListByResourceGroup.json | +| [signalRListBySubscription.js][signalrlistbysubscription] | Handles requests to list all resources in a subscription. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_ListBySubscription.json | +| [signalRListKeys.js][signalrlistkeys] | Get the access keys of the resource. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_ListKeys.json | +| [signalRListSkus.js][signalrlistskus] | List all available skus of the resource. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_ListSkus.json | +| [signalRPrivateEndpointConnectionsDelete.js][signalrprivateendpointconnectionsdelete] | Delete the specified private endpoint connection x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateEndpointConnections_Delete.json | +| [signalRPrivateEndpointConnectionsGet.js][signalrprivateendpointconnectionsget] | Get the specified private endpoint connection x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateEndpointConnections_Get.json | +| [signalRPrivateEndpointConnectionsList.js][signalrprivateendpointconnectionslist] | List private endpoint connections x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateEndpointConnections_List.json | +| [signalRPrivateEndpointConnectionsUpdate.js][signalrprivateendpointconnectionsupdate] | Update the state of specified private endpoint connection x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateEndpointConnections_Update.json | +| [signalRPrivateLinkResourcesList.js][signalrprivatelinkresourceslist] | Get the private link resources that need to be created for a resource. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateLinkResources_List.json | +| [signalRRegenerateKey.js][signalrregeneratekey] | Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_RegenerateKey.json | +| [signalRRestart.js][signalrrestart] | Operation to restart a resource. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_Restart.json | +| [signalRSharedPrivateLinkResourcesCreateOrUpdate.js][signalrsharedprivatelinkresourcescreateorupdate] | Create or update a shared private link resource x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRSharedPrivateLinkResources_CreateOrUpdate.json | +| [signalRSharedPrivateLinkResourcesDelete.js][signalrsharedprivatelinkresourcesdelete] | Delete the specified shared private link resource x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRSharedPrivateLinkResources_Delete.json | +| [signalRSharedPrivateLinkResourcesGet.js][signalrsharedprivatelinkresourcesget] | Get the specified shared private link resource x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRSharedPrivateLinkResources_Get.json | +| [signalRSharedPrivateLinkResourcesList.js][signalrsharedprivatelinkresourceslist] | List shared private link resources x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRSharedPrivateLinkResources_List.json | +| [signalRUpdate.js][signalrupdate] | Operation to update an exiting resource. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_Update.json | +| [usagesList.js][usageslist] | List resource usage quotas by location. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/Usages_List.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node operationsList.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node operationsList.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[operationslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/operationsList.js +[signalrchecknameavailability]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/signalRCheckNameAvailability.js +[signalrcreateorupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/signalRCreateOrUpdate.js +[signalrdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/signalRDelete.js +[signalrget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/signalRGet.js +[signalrlistbyresourcegroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/signalRListByResourceGroup.js +[signalrlistbysubscription]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/signalRListBySubscription.js +[signalrlistkeys]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/signalRListKeys.js +[signalrlistskus]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/signalRListSkus.js +[signalrprivateendpointconnectionsdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateEndpointConnectionsDelete.js +[signalrprivateendpointconnectionsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateEndpointConnectionsGet.js +[signalrprivateendpointconnectionslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateEndpointConnectionsList.js +[signalrprivateendpointconnectionsupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateEndpointConnectionsUpdate.js +[signalrprivatelinkresourceslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateLinkResourcesList.js +[signalrregeneratekey]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/signalRRegenerateKey.js +[signalrrestart]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/signalRRestart.js +[signalrsharedprivatelinkresourcescreateorupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/signalRSharedPrivateLinkResourcesCreateOrUpdate.js +[signalrsharedprivatelinkresourcesdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/signalRSharedPrivateLinkResourcesDelete.js +[signalrsharedprivatelinkresourcesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/signalRSharedPrivateLinkResourcesGet.js +[signalrsharedprivatelinkresourceslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/signalRSharedPrivateLinkResourcesList.js +[signalrupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/signalRUpdate.js +[usageslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/javascript/usagesList.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-signalr?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/signalr/arm-signalr/README.md diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/operationsList.js b/sdk/signalr/arm-signalr/samples/v5/javascript/operationsList.js new file mode 100644 index 00000000000..0f23f343332 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/operationsList.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Lists all of the available REST API operations of the Microsoft.SignalRService provider. + * + * @summary Lists all of the available REST API operations of the Microsoft.SignalRService provider. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/Operations_List.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function operationsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +operationsList().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/package.json b/sdk/signalr/arm-signalr/samples/v5/javascript/package.json new file mode 100644 index 00000000000..3cddc429120 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "azure-arm-signalr-samples-js", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript", + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/signalr/arm-signalr" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/signalr/arm-signalr", + "dependencies": { + "@azure/arm-signalr": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/sample.env b/sdk/signalr/arm-signalr/samples/v5/javascript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/signalRCheckNameAvailability.js b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRCheckNameAvailability.js new file mode 100644 index 00000000000..9ea5c9c46d1 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRCheckNameAvailability.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Checks that the resource name is valid and is not already in use. + * + * @summary Checks that the resource name is valid and is not already in use. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_CheckNameAvailability.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function signalRCheckNameAvailability() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const location = "eastus"; + const parameters = { + name: "mySignalRService", + type: "Microsoft.SignalRService/SignalR", + }; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.checkNameAvailability(location, parameters); + console.log(result); +} + +signalRCheckNameAvailability().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/signalRCreateOrUpdate.js b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRCreateOrUpdate.js new file mode 100644 index 00000000000..8fd4349ee60 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRCreateOrUpdate.js @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update a resource. + * + * @summary Create or update a resource. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_CreateOrUpdate.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function signalRCreateOrUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const parameters = { + cors: { allowedOrigins: ["https://foo.com", "https://bar.com"] }, + disableAadAuth: false, + disableLocalAuth: false, + features: [ + { flag: "ServiceMode", properties: {}, value: "Serverless" }, + { flag: "EnableConnectivityLogs", properties: {}, value: "True" }, + { flag: "EnableMessagingLogs", properties: {}, value: "False" }, + { flag: "EnableLiveTrace", properties: {}, value: "False" }, + ], + identity: { type: "SystemAssigned" }, + kind: "SignalR", + location: "eastus", + networkACLs: { + defaultAction: "Deny", + privateEndpoints: [ + { + name: "mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e", + allow: ["ServerConnection"], + }, + ], + publicNetwork: { allow: ["ClientConnection"] }, + }, + publicNetworkAccess: "Enabled", + sku: { name: "Standard_S1", capacity: 1, tier: "Standard" }, + tags: { key1: "value1" }, + tls: { clientCertEnabled: false }, + upstream: { + templates: [ + { + auth: { + type: "ManagedIdentity", + managedIdentity: { resource: "api://example" }, + }, + categoryPattern: "*", + eventPattern: "connect,disconnect", + hubPattern: "*", + urlTemplate: "https://example.com/chat/api/connect", + }, + ], + }, + }; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +signalRCreateOrUpdate().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/signalRDelete.js b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRDelete.js new file mode 100644 index 00000000000..fc72358dd28 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRDelete.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Operation to delete a resource. + * + * @summary Operation to delete a resource. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_Delete.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function signalRDelete() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.beginDeleteAndWait(resourceGroupName, resourceName); + console.log(result); +} + +signalRDelete().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/signalRGet.js b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRGet.js new file mode 100644 index 00000000000..f649b893007 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRGet.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the resource and its properties. + * + * @summary Get the resource and its properties. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_Get.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function signalRGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.get(resourceGroupName, resourceName); + console.log(result); +} + +signalRGet().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/signalRListByResourceGroup.js b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRListByResourceGroup.js new file mode 100644 index 00000000000..261dd462cc6 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRListByResourceGroup.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Handles requests to list all resources in a resource group. + * + * @summary Handles requests to list all resources in a resource group. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_ListByResourceGroup.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function signalRListByResourceGroup() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.signalR.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +signalRListByResourceGroup().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/signalRListBySubscription.js b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRListBySubscription.js new file mode 100644 index 00000000000..b87b023f88e --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRListBySubscription.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Handles requests to list all resources in a subscription. + * + * @summary Handles requests to list all resources in a subscription. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_ListBySubscription.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function signalRListBySubscription() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.signalR.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +signalRListBySubscription().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/signalRListKeys.js b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRListKeys.js new file mode 100644 index 00000000000..8d1af1605a3 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRListKeys.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the access keys of the resource. + * + * @summary Get the access keys of the resource. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_ListKeys.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function signalRListKeys() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.listKeys(resourceGroupName, resourceName); + console.log(result); +} + +signalRListKeys().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/signalRListSkus.js b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRListSkus.js new file mode 100644 index 00000000000..c31bcde4029 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRListSkus.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List all available skus of the resource. + * + * @summary List all available skus of the resource. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_ListSkus.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function signalRListSkus() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.listSkus(resourceGroupName, resourceName); + console.log(result); +} + +signalRListSkus().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateEndpointConnectionsDelete.js b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateEndpointConnectionsDelete.js new file mode 100644 index 00000000000..ac8c82a98f5 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateEndpointConnectionsDelete.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Delete the specified private endpoint connection + * + * @summary Delete the specified private endpoint connection + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateEndpointConnections_Delete.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function signalRPrivateEndpointConnectionsDelete() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const privateEndpointConnectionName = "mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalRPrivateEndpointConnections.beginDeleteAndWait( + privateEndpointConnectionName, + resourceGroupName, + resourceName + ); + console.log(result); +} + +signalRPrivateEndpointConnectionsDelete().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateEndpointConnectionsGet.js b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateEndpointConnectionsGet.js new file mode 100644 index 00000000000..451010425c1 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateEndpointConnectionsGet.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the specified private endpoint connection + * + * @summary Get the specified private endpoint connection + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateEndpointConnections_Get.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function signalRPrivateEndpointConnectionsGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const privateEndpointConnectionName = "mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalRPrivateEndpointConnections.get( + privateEndpointConnectionName, + resourceGroupName, + resourceName + ); + console.log(result); +} + +signalRPrivateEndpointConnectionsGet().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateEndpointConnectionsList.js b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateEndpointConnectionsList.js new file mode 100644 index 00000000000..c3fa2dfb5be --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateEndpointConnectionsList.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List private endpoint connections + * + * @summary List private endpoint connections + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateEndpointConnections_List.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function signalRPrivateEndpointConnectionsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.signalRPrivateEndpointConnections.list( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +signalRPrivateEndpointConnectionsList().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateEndpointConnectionsUpdate.js b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateEndpointConnectionsUpdate.js new file mode 100644 index 00000000000..6b070388a84 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateEndpointConnectionsUpdate.js @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Update the state of specified private endpoint connection + * + * @summary Update the state of specified private endpoint connection + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateEndpointConnections_Update.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function signalRPrivateEndpointConnectionsUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const privateEndpointConnectionName = "mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const parameters = { + privateEndpoint: { + id: "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint", + }, + privateLinkServiceConnectionState: { + actionsRequired: "None", + status: "Approved", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalRPrivateEndpointConnections.update( + privateEndpointConnectionName, + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +signalRPrivateEndpointConnectionsUpdate().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateLinkResourcesList.js b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateLinkResourcesList.js new file mode 100644 index 00000000000..ed0c29b168c --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRPrivateLinkResourcesList.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the private link resources that need to be created for a resource. + * + * @summary Get the private link resources that need to be created for a resource. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateLinkResources_List.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function signalRPrivateLinkResourcesList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.signalRPrivateLinkResources.list(resourceGroupName, resourceName)) { + resArray.push(item); + } + console.log(resArray); +} + +signalRPrivateLinkResourcesList().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/signalRRegenerateKey.js b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRRegenerateKey.js new file mode 100644 index 00000000000..d2dd3d7ff21 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRRegenerateKey.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @summary Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_RegenerateKey.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function signalRRegenerateKey() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const parameters = { keyType: "Primary" }; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.beginRegenerateKeyAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +signalRRegenerateKey().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/signalRRestart.js b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRRestart.js new file mode 100644 index 00000000000..c5817510221 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRRestart.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Operation to restart a resource. + * + * @summary Operation to restart a resource. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_Restart.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function signalRRestart() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.beginRestartAndWait(resourceGroupName, resourceName); + console.log(result); +} + +signalRRestart().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/signalRSharedPrivateLinkResourcesCreateOrUpdate.js b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRSharedPrivateLinkResourcesCreateOrUpdate.js new file mode 100644 index 00000000000..ba25897087a --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRSharedPrivateLinkResourcesCreateOrUpdate.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update a shared private link resource + * + * @summary Create or update a shared private link resource + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRSharedPrivateLinkResources_CreateOrUpdate.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function signalRSharedPrivateLinkResourcesCreateOrUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const sharedPrivateLinkResourceName = "upstream"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const parameters = { + groupId: "sites", + privateLinkResourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp", + requestMessage: "Please approve", + }; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalRSharedPrivateLinkResources.beginCreateOrUpdateAndWait( + sharedPrivateLinkResourceName, + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +signalRSharedPrivateLinkResourcesCreateOrUpdate().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/signalRSharedPrivateLinkResourcesDelete.js b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRSharedPrivateLinkResourcesDelete.js new file mode 100644 index 00000000000..22c4447415a --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRSharedPrivateLinkResourcesDelete.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Delete the specified shared private link resource + * + * @summary Delete the specified shared private link resource + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRSharedPrivateLinkResources_Delete.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function signalRSharedPrivateLinkResourcesDelete() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const sharedPrivateLinkResourceName = "upstream"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalRSharedPrivateLinkResources.beginDeleteAndWait( + sharedPrivateLinkResourceName, + resourceGroupName, + resourceName + ); + console.log(result); +} + +signalRSharedPrivateLinkResourcesDelete().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/signalRSharedPrivateLinkResourcesGet.js b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRSharedPrivateLinkResourcesGet.js new file mode 100644 index 00000000000..53f533856cb --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRSharedPrivateLinkResourcesGet.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the specified shared private link resource + * + * @summary Get the specified shared private link resource + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRSharedPrivateLinkResources_Get.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function signalRSharedPrivateLinkResourcesGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const sharedPrivateLinkResourceName = "upstream"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalRSharedPrivateLinkResources.get( + sharedPrivateLinkResourceName, + resourceGroupName, + resourceName + ); + console.log(result); +} + +signalRSharedPrivateLinkResourcesGet().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/signalRSharedPrivateLinkResourcesList.js b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRSharedPrivateLinkResourcesList.js new file mode 100644 index 00000000000..78a23404ed4 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRSharedPrivateLinkResourcesList.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List shared private link resources + * + * @summary List shared private link resources + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRSharedPrivateLinkResources_List.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function signalRSharedPrivateLinkResourcesList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.signalRSharedPrivateLinkResources.list( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +signalRSharedPrivateLinkResourcesList().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/signalRUpdate.js b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRUpdate.js new file mode 100644 index 00000000000..e5ad050daea --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/signalRUpdate.js @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Operation to update an exiting resource. + * + * @summary Operation to update an exiting resource. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_Update.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function signalRUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const parameters = { + cors: { allowedOrigins: ["https://foo.com", "https://bar.com"] }, + disableAadAuth: false, + disableLocalAuth: false, + features: [ + { flag: "ServiceMode", properties: {}, value: "Serverless" }, + { flag: "EnableConnectivityLogs", properties: {}, value: "True" }, + { flag: "EnableMessagingLogs", properties: {}, value: "False" }, + { flag: "EnableLiveTrace", properties: {}, value: "False" }, + ], + identity: { type: "SystemAssigned" }, + kind: "SignalR", + location: "eastus", + networkACLs: { + defaultAction: "Deny", + privateEndpoints: [ + { + name: "mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e", + allow: ["ServerConnection"], + }, + ], + publicNetwork: { allow: ["ClientConnection"] }, + }, + publicNetworkAccess: "Enabled", + sku: { name: "Standard_S1", capacity: 1, tier: "Standard" }, + tags: { key1: "value1" }, + tls: { clientCertEnabled: false }, + upstream: { + templates: [ + { + auth: { + type: "ManagedIdentity", + managedIdentity: { resource: "api://example" }, + }, + categoryPattern: "*", + eventPattern: "connect,disconnect", + hubPattern: "*", + urlTemplate: "https://example.com/chat/api/connect", + }, + ], + }, + }; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.beginUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +signalRUpdate().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/javascript/usagesList.js b/sdk/signalr/arm-signalr/samples/v5/javascript/usagesList.js new file mode 100644 index 00000000000..253ba9cd1a3 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/javascript/usagesList.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List resource usage quotas by location. + * + * @summary List resource usage quotas by location. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/Usages_List.json + */ +const { SignalRManagementClient } = require("@azure/arm-signalr"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function usagesList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const location = "eastus"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.usages.list(location)) { + resArray.push(item); + } + console.log(resArray); +} + +usagesList().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/README.md b/sdk/signalr/arm-signalr/samples/v5/typescript/README.md new file mode 100644 index 00000000000..5360837114b --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/README.md @@ -0,0 +1,105 @@ +# client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [operationsList.ts][operationslist] | Lists all of the available REST API operations of the Microsoft.SignalRService provider. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/Operations_List.json | +| [signalRCheckNameAvailability.ts][signalrchecknameavailability] | Checks that the resource name is valid and is not already in use. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_CheckNameAvailability.json | +| [signalRCreateOrUpdate.ts][signalrcreateorupdate] | Create or update a resource. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_CreateOrUpdate.json | +| [signalRDelete.ts][signalrdelete] | Operation to delete a resource. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_Delete.json | +| [signalRGet.ts][signalrget] | Get the resource and its properties. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_Get.json | +| [signalRListByResourceGroup.ts][signalrlistbyresourcegroup] | Handles requests to list all resources in a resource group. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_ListByResourceGroup.json | +| [signalRListBySubscription.ts][signalrlistbysubscription] | Handles requests to list all resources in a subscription. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_ListBySubscription.json | +| [signalRListKeys.ts][signalrlistkeys] | Get the access keys of the resource. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_ListKeys.json | +| [signalRListSkus.ts][signalrlistskus] | List all available skus of the resource. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_ListSkus.json | +| [signalRPrivateEndpointConnectionsDelete.ts][signalrprivateendpointconnectionsdelete] | Delete the specified private endpoint connection x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateEndpointConnections_Delete.json | +| [signalRPrivateEndpointConnectionsGet.ts][signalrprivateendpointconnectionsget] | Get the specified private endpoint connection x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateEndpointConnections_Get.json | +| [signalRPrivateEndpointConnectionsList.ts][signalrprivateendpointconnectionslist] | List private endpoint connections x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateEndpointConnections_List.json | +| [signalRPrivateEndpointConnectionsUpdate.ts][signalrprivateendpointconnectionsupdate] | Update the state of specified private endpoint connection x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateEndpointConnections_Update.json | +| [signalRPrivateLinkResourcesList.ts][signalrprivatelinkresourceslist] | Get the private link resources that need to be created for a resource. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateLinkResources_List.json | +| [signalRRegenerateKey.ts][signalrregeneratekey] | Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_RegenerateKey.json | +| [signalRRestart.ts][signalrrestart] | Operation to restart a resource. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_Restart.json | +| [signalRSharedPrivateLinkResourcesCreateOrUpdate.ts][signalrsharedprivatelinkresourcescreateorupdate] | Create or update a shared private link resource x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRSharedPrivateLinkResources_CreateOrUpdate.json | +| [signalRSharedPrivateLinkResourcesDelete.ts][signalrsharedprivatelinkresourcesdelete] | Delete the specified shared private link resource x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRSharedPrivateLinkResources_Delete.json | +| [signalRSharedPrivateLinkResourcesGet.ts][signalrsharedprivatelinkresourcesget] | Get the specified shared private link resource x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRSharedPrivateLinkResources_Get.json | +| [signalRSharedPrivateLinkResourcesList.ts][signalrsharedprivatelinkresourceslist] | List shared private link resources x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRSharedPrivateLinkResources_List.json | +| [signalRUpdate.ts][signalrupdate] | Operation to update an exiting resource. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_Update.json | +| [usagesList.ts][usageslist] | List resource usage quotas by location. x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/Usages_List.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/operationsList.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node dist/operationsList.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[operationslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/operationsList.ts +[signalrchecknameavailability]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRCheckNameAvailability.ts +[signalrcreateorupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRCreateOrUpdate.ts +[signalrdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRDelete.ts +[signalrget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRGet.ts +[signalrlistbyresourcegroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRListByResourceGroup.ts +[signalrlistbysubscription]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRListBySubscription.ts +[signalrlistkeys]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRListKeys.ts +[signalrlistskus]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRListSkus.ts +[signalrprivateendpointconnectionsdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateEndpointConnectionsDelete.ts +[signalrprivateendpointconnectionsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateEndpointConnectionsGet.ts +[signalrprivateendpointconnectionslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateEndpointConnectionsList.ts +[signalrprivateendpointconnectionsupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateEndpointConnectionsUpdate.ts +[signalrprivatelinkresourceslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateLinkResourcesList.ts +[signalrregeneratekey]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRRegenerateKey.ts +[signalrrestart]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRRestart.ts +[signalrsharedprivatelinkresourcescreateorupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRSharedPrivateLinkResourcesCreateOrUpdate.ts +[signalrsharedprivatelinkresourcesdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRSharedPrivateLinkResourcesDelete.ts +[signalrsharedprivatelinkresourcesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRSharedPrivateLinkResourcesGet.ts +[signalrsharedprivatelinkresourceslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRSharedPrivateLinkResourcesList.ts +[signalrupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRUpdate.ts +[usageslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/signalr/arm-signalr/samples/v5/typescript/src/usagesList.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-signalr?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/signalr/arm-signalr/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/package.json b/sdk/signalr/arm-signalr/samples/v5/typescript/package.json new file mode 100644 index 00000000000..e8afec95f3a --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "azure-arm-signalr-samples-ts", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript", + "engines": { + "node": ">=12.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/signalr/arm-signalr" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/signalr/arm-signalr", + "dependencies": { + "@azure/arm-signalr": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^12.0.0", + "typescript": "~4.4.0", + "rimraf": "latest" + } +} diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/sample.env b/sdk/signalr/arm-signalr/samples/v5/typescript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/operationsList.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/operationsList.ts new file mode 100644 index 00000000000..7235078d511 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/operationsList.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Lists all of the available REST API operations of the Microsoft.SignalRService provider. + * + * @summary Lists all of the available REST API operations of the Microsoft.SignalRService provider. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/Operations_List.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function operationsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +operationsList().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRCheckNameAvailability.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRCheckNameAvailability.ts new file mode 100644 index 00000000000..989707e69a1 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRCheckNameAvailability.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Checks that the resource name is valid and is not already in use. + * + * @summary Checks that the resource name is valid and is not already in use. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_CheckNameAvailability.json + */ +import { + NameAvailabilityParameters, + SignalRManagementClient +} from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRCheckNameAvailability() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const location = "eastus"; + const parameters: NameAvailabilityParameters = { + name: "mySignalRService", + type: "Microsoft.SignalRService/SignalR" + }; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.checkNameAvailability( + location, + parameters + ); + console.log(result); +} + +signalRCheckNameAvailability().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRCreateOrUpdate.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRCreateOrUpdate.ts new file mode 100644 index 00000000000..983166c5c17 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRCreateOrUpdate.ts @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update a resource. + * + * @summary Create or update a resource. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_CreateOrUpdate.json + */ +import { SignalRResource, SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRCreateOrUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const parameters: SignalRResource = { + cors: { allowedOrigins: ["https://foo.com", "https://bar.com"] }, + disableAadAuth: false, + disableLocalAuth: false, + features: [ + { flag: "ServiceMode", properties: {}, value: "Serverless" }, + { flag: "EnableConnectivityLogs", properties: {}, value: "True" }, + { flag: "EnableMessagingLogs", properties: {}, value: "False" }, + { flag: "EnableLiveTrace", properties: {}, value: "False" } + ], + identity: { type: "SystemAssigned" }, + kind: "SignalR", + location: "eastus", + networkACLs: { + defaultAction: "Deny", + privateEndpoints: [ + { + name: "mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e", + allow: ["ServerConnection"] + } + ], + publicNetwork: { allow: ["ClientConnection"] } + }, + publicNetworkAccess: "Enabled", + sku: { name: "Standard_S1", capacity: 1, tier: "Standard" }, + tags: { key1: "value1" }, + tls: { clientCertEnabled: false }, + upstream: { + templates: [ + { + auth: { + type: "ManagedIdentity", + managedIdentity: { resource: "api://example" } + }, + categoryPattern: "*", + eventPattern: "connect,disconnect", + hubPattern: "*", + urlTemplate: "https://example.com/chat/api/connect" + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.beginCreateOrUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +signalRCreateOrUpdate().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRDelete.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRDelete.ts new file mode 100644 index 00000000000..85b16053cde --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRDelete.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Operation to delete a resource. + * + * @summary Operation to delete a resource. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_Delete.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRDelete() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.beginDeleteAndWait( + resourceGroupName, + resourceName + ); + console.log(result); +} + +signalRDelete().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRGet.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRGet.ts new file mode 100644 index 00000000000..9ea134b87d1 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRGet.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the resource and its properties. + * + * @summary Get the resource and its properties. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_Get.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.get(resourceGroupName, resourceName); + console.log(result); +} + +signalRGet().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRListByResourceGroup.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRListByResourceGroup.ts new file mode 100644 index 00000000000..21068895302 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRListByResourceGroup.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Handles requests to list all resources in a resource group. + * + * @summary Handles requests to list all resources in a resource group. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_ListByResourceGroup.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRListByResourceGroup() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.signalR.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +signalRListByResourceGroup().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRListBySubscription.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRListBySubscription.ts new file mode 100644 index 00000000000..2391d8584c9 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRListBySubscription.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Handles requests to list all resources in a subscription. + * + * @summary Handles requests to list all resources in a subscription. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_ListBySubscription.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRListBySubscription() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.signalR.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +signalRListBySubscription().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRListKeys.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRListKeys.ts new file mode 100644 index 00000000000..74b59e3949a --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRListKeys.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the access keys of the resource. + * + * @summary Get the access keys of the resource. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_ListKeys.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRListKeys() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.listKeys(resourceGroupName, resourceName); + console.log(result); +} + +signalRListKeys().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRListSkus.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRListSkus.ts new file mode 100644 index 00000000000..83ef473e64f --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRListSkus.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List all available skus of the resource. + * + * @summary List all available skus of the resource. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_ListSkus.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRListSkus() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.listSkus(resourceGroupName, resourceName); + console.log(result); +} + +signalRListSkus().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateEndpointConnectionsDelete.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateEndpointConnectionsDelete.ts new file mode 100644 index 00000000000..4d5479364c2 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateEndpointConnectionsDelete.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Delete the specified private endpoint connection + * + * @summary Delete the specified private endpoint connection + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateEndpointConnections_Delete.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRPrivateEndpointConnectionsDelete() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const privateEndpointConnectionName = + "mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalRPrivateEndpointConnections.beginDeleteAndWait( + privateEndpointConnectionName, + resourceGroupName, + resourceName + ); + console.log(result); +} + +signalRPrivateEndpointConnectionsDelete().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateEndpointConnectionsGet.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateEndpointConnectionsGet.ts new file mode 100644 index 00000000000..9cd8817d98f --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateEndpointConnectionsGet.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the specified private endpoint connection + * + * @summary Get the specified private endpoint connection + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateEndpointConnections_Get.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRPrivateEndpointConnectionsGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const privateEndpointConnectionName = + "mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalRPrivateEndpointConnections.get( + privateEndpointConnectionName, + resourceGroupName, + resourceName + ); + console.log(result); +} + +signalRPrivateEndpointConnectionsGet().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateEndpointConnectionsList.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateEndpointConnectionsList.ts new file mode 100644 index 00000000000..f54d9b4fb39 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateEndpointConnectionsList.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List private endpoint connections + * + * @summary List private endpoint connections + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateEndpointConnections_List.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRPrivateEndpointConnectionsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.signalRPrivateEndpointConnections.list( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +signalRPrivateEndpointConnectionsList().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateEndpointConnectionsUpdate.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateEndpointConnectionsUpdate.ts new file mode 100644 index 00000000000..5ed7c2acf82 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateEndpointConnectionsUpdate.ts @@ -0,0 +1,50 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Update the state of specified private endpoint connection + * + * @summary Update the state of specified private endpoint connection + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateEndpointConnections_Update.json + */ +import { + PrivateEndpointConnection, + SignalRManagementClient +} from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRPrivateEndpointConnectionsUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const privateEndpointConnectionName = + "mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const parameters: PrivateEndpointConnection = { + privateEndpoint: { + id: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint" + }, + privateLinkServiceConnectionState: { + actionsRequired: "None", + status: "Approved" + } + }; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalRPrivateEndpointConnections.update( + privateEndpointConnectionName, + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +signalRPrivateEndpointConnectionsUpdate().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateLinkResourcesList.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateLinkResourcesList.ts new file mode 100644 index 00000000000..4e97bfa4402 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRPrivateLinkResourcesList.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the private link resources that need to be created for a resource. + * + * @summary Get the private link resources that need to be created for a resource. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRPrivateLinkResources_List.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRPrivateLinkResourcesList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.signalRPrivateLinkResources.list( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +signalRPrivateLinkResourcesList().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRRegenerateKey.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRRegenerateKey.ts new file mode 100644 index 00000000000..31f551c9e91 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRRegenerateKey.ts @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @summary Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_RegenerateKey.json + */ +import { + RegenerateKeyParameters, + SignalRManagementClient +} from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRRegenerateKey() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const parameters: RegenerateKeyParameters = { keyType: "Primary" }; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.beginRegenerateKeyAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +signalRRegenerateKey().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRRestart.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRRestart.ts new file mode 100644 index 00000000000..20092ddd302 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRRestart.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Operation to restart a resource. + * + * @summary Operation to restart a resource. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_Restart.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRRestart() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.beginRestartAndWait( + resourceGroupName, + resourceName + ); + console.log(result); +} + +signalRRestart().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRSharedPrivateLinkResourcesCreateOrUpdate.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRSharedPrivateLinkResourcesCreateOrUpdate.ts new file mode 100644 index 00000000000..727cdadd0ae --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRSharedPrivateLinkResourcesCreateOrUpdate.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update a shared private link resource + * + * @summary Create or update a shared private link resource + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRSharedPrivateLinkResources_CreateOrUpdate.json + */ +import { + SharedPrivateLinkResource, + SignalRManagementClient +} from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRSharedPrivateLinkResourcesCreateOrUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const sharedPrivateLinkResourceName = "upstream"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const parameters: SharedPrivateLinkResource = { + groupId: "sites", + privateLinkResourceId: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp", + requestMessage: "Please approve" + }; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalRSharedPrivateLinkResources.beginCreateOrUpdateAndWait( + sharedPrivateLinkResourceName, + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +signalRSharedPrivateLinkResourcesCreateOrUpdate().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRSharedPrivateLinkResourcesDelete.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRSharedPrivateLinkResourcesDelete.ts new file mode 100644 index 00000000000..663826583a7 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRSharedPrivateLinkResourcesDelete.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Delete the specified shared private link resource + * + * @summary Delete the specified shared private link resource + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRSharedPrivateLinkResources_Delete.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRSharedPrivateLinkResourcesDelete() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const sharedPrivateLinkResourceName = "upstream"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalRSharedPrivateLinkResources.beginDeleteAndWait( + sharedPrivateLinkResourceName, + resourceGroupName, + resourceName + ); + console.log(result); +} + +signalRSharedPrivateLinkResourcesDelete().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRSharedPrivateLinkResourcesGet.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRSharedPrivateLinkResourcesGet.ts new file mode 100644 index 00000000000..479ddbf51d1 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRSharedPrivateLinkResourcesGet.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the specified shared private link resource + * + * @summary Get the specified shared private link resource + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRSharedPrivateLinkResources_Get.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRSharedPrivateLinkResourcesGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const sharedPrivateLinkResourceName = "upstream"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalRSharedPrivateLinkResources.get( + sharedPrivateLinkResourceName, + resourceGroupName, + resourceName + ); + console.log(result); +} + +signalRSharedPrivateLinkResourcesGet().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRSharedPrivateLinkResourcesList.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRSharedPrivateLinkResourcesList.ts new file mode 100644 index 00000000000..220f85cfcbc --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRSharedPrivateLinkResourcesList.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List shared private link resources + * + * @summary List shared private link resources + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalRSharedPrivateLinkResources_List.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRSharedPrivateLinkResourcesList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.signalRSharedPrivateLinkResources.list( + resourceGroupName, + resourceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +signalRSharedPrivateLinkResourcesList().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRUpdate.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRUpdate.ts new file mode 100644 index 00000000000..4c0a01a71d9 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/signalRUpdate.ts @@ -0,0 +1,76 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Operation to update an exiting resource. + * + * @summary Operation to update an exiting resource. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/SignalR_Update.json + */ +import { SignalRResource, SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function signalRUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "myResourceGroup"; + const resourceName = "mySignalRService"; + const parameters: SignalRResource = { + cors: { allowedOrigins: ["https://foo.com", "https://bar.com"] }, + disableAadAuth: false, + disableLocalAuth: false, + features: [ + { flag: "ServiceMode", properties: {}, value: "Serverless" }, + { flag: "EnableConnectivityLogs", properties: {}, value: "True" }, + { flag: "EnableMessagingLogs", properties: {}, value: "False" }, + { flag: "EnableLiveTrace", properties: {}, value: "False" } + ], + identity: { type: "SystemAssigned" }, + kind: "SignalR", + location: "eastus", + networkACLs: { + defaultAction: "Deny", + privateEndpoints: [ + { + name: "mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e", + allow: ["ServerConnection"] + } + ], + publicNetwork: { allow: ["ClientConnection"] } + }, + publicNetworkAccess: "Enabled", + sku: { name: "Standard_S1", capacity: 1, tier: "Standard" }, + tags: { key1: "value1" }, + tls: { clientCertEnabled: false }, + upstream: { + templates: [ + { + auth: { + type: "ManagedIdentity", + managedIdentity: { resource: "api://example" } + }, + categoryPattern: "*", + eventPattern: "connect,disconnect", + hubPattern: "*", + urlTemplate: "https://example.com/chat/api/connect" + } + ] + } + }; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const result = await client.signalR.beginUpdateAndWait( + resourceGroupName, + resourceName, + parameters + ); + console.log(result); +} + +signalRUpdate().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/src/usagesList.ts b/sdk/signalr/arm-signalr/samples/v5/typescript/src/usagesList.ts new file mode 100644 index 00000000000..c209db27bd9 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/src/usagesList.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to List resource usage quotas by location. + * + * @summary List resource usage quotas by location. + * x-ms-original-file: specification/signalr/resource-manager/Microsoft.SignalRService/stable/2021-10-01/examples/Usages_List.json + */ +import { SignalRManagementClient } from "@azure/arm-signalr"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function usagesList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const location = "eastus"; + const credential = new DefaultAzureCredential(); + const client = new SignalRManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.usages.list(location)) { + resArray.push(item); + } + console.log(resArray); +} + +usagesList().catch(console.error); diff --git a/sdk/signalr/arm-signalr/samples/v5/typescript/tsconfig.json b/sdk/signalr/arm-signalr/samples/v5/typescript/tsconfig.json new file mode 100644 index 00000000000..416c2dd82e0 --- /dev/null +++ b/sdk/signalr/arm-signalr/samples/v5/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2018", + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "alwaysStrict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src/**.ts" + ] +} diff --git a/sdk/signalr/arm-signalr/src/index.ts b/sdk/signalr/arm-signalr/src/index.ts new file mode 100644 index 00000000000..025dc94a044 --- /dev/null +++ b/sdk/signalr/arm-signalr/src/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +/// +export * from "./models"; +export { SignalRManagementClient } from "./signalRManagementClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/signalr/arm-signalr/src/lroImpl.ts b/sdk/signalr/arm-signalr/src/lroImpl.ts new file mode 100644 index 00000000000..518d5f053b4 --- /dev/null +++ b/sdk/signalr/arm-signalr/src/lroImpl.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export class LroImpl implements LongRunningOperation { + constructor( + private sendOperationFn: (args: any, spec: any) => Promise>, + private args: Record, + private spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record, + public requestPath: string = spec.path!, + public requestMethod: string = spec.httpMethod + ) {} + public async sendInitialRequest(): Promise> { + return this.sendOperationFn(this.args, this.spec); + } + public async sendPollRequest(path: string): Promise> { + const { requestBody, ...restSpec } = this.spec; + return this.sendOperationFn(this.args, { + ...restSpec, + path, + httpMethod: "GET" + }); + } +} diff --git a/sdk/signalr/arm-signalr/src/models/index.ts b/sdk/signalr/arm-signalr/src/models/index.ts index 710d9553782..b19d3847953 100644 --- a/sdk/signalr/arm-signalr/src/models/index.ts +++ b/sdk/signalr/arm-signalr/src/models/index.ts @@ -6,461 +6,215 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export { BaseResource, CloudError }; - -/** - * Specifications of the Dimension of metrics. - */ -export interface Dimension { +/** Result of the request to list REST API operations. It contains a list of operations. */ +export interface OperationList { + /** List of operations supported by the resource provider. */ + value?: Operation[]; /** - * The public facing name of the dimension. + * The URL the client should use to fetch the next page (per server side paging). + * It's null for now, added for future use. */ - name?: string; - /** - * Localized friendly display name of the dimension. - */ - displayName?: string; - /** - * Name of the dimension as it appears in MDM. - */ - internalName?: string; - /** - * A Boolean flag indicating whether this dimension should be included for the shoebox export - * scenario. - */ - toBeExportedForShoebox?: boolean; + nextLink?: string; } -/** - * Specifications of the Logs for Azure Monitoring. - */ -export interface LogSpecification { - /** - * Name of the log. - */ - name?: string; - /** - * Localized friendly display name of the log. - */ - displayName?: string; -} - -/** - * Properties of user assigned identity. - */ -export interface UserAssignedIdentityProperty { - /** - * Get the principal id for the user assigned identity - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly principalId?: string; - /** - * Get the client id for the user assigned identity - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly clientId?: string; -} - -/** - * A class represent managed identities used for request and response - */ -export interface ManagedIdentity { - /** - * Represent the identity type: systemAssigned, userAssigned, None. Possible values include: - * 'None', 'SystemAssigned', 'UserAssigned' - */ - type?: ManagedIdentityType; - /** - * Get or set the user assigned identities - */ - userAssignedIdentities?: { [propertyName: string]: UserAssignedIdentityProperty }; - /** - * Get the principal id for the system assigned identity. - * Only be used in response. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly principalId?: string; - /** - * Get the tenant id for the system assigned identity. - * Only be used in response - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly tenantId?: string; -} - -/** - * Managed identity settings for upstream. - */ -export interface ManagedIdentitySettings { - /** - * The Resource indicating the App ID URI of the target resource. - * It also appears in the aud (audience) claim of the issued token. - */ - resource?: string; -} - -/** - * Specifications of the Metrics for Azure Monitoring. - */ -export interface MetricSpecification { - /** - * Name of the metric. - */ - name?: string; - /** - * Localized friendly display name of the metric. - */ - displayName?: string; - /** - * Localized friendly description of the metric. - */ - displayDescription?: string; - /** - * The unit that makes sense for the metric. - */ - unit?: string; - /** - * Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. - */ - aggregationType?: string; - /** - * Optional. If set to true, then zero will be returned for time duration where no metric is - * emitted/published. - * Ex. a metric that returns the number of times a particular error code was emitted. The error - * code may not appear - * often, instead of the RP publishing 0, Shoebox can auto fill in 0s for time periods where - * nothing was emitted. - */ - fillGapWithZero?: string; - /** - * The name of the metric category that the metric belongs to. A metric can only belong to a - * single category. - */ - category?: string; - /** - * The dimensions of the metrics. - */ - dimensions?: Dimension[]; -} - -/** - * Result of the request to check name availability. It contains a flag and possible reason of - * failure. - */ -export interface NameAvailability { - /** - * Indicates whether the name is available or not. - */ - nameAvailable?: boolean; - /** - * The reason of the availability. Required if name is not available. - */ - reason?: string; - /** - * The message of the operation. - */ - message?: string; -} - -/** - * Data POST-ed to the nameAvailability action - */ -export interface NameAvailabilityParameters { - /** - * The resource type. Can be "Microsoft.SignalRService/SignalR" or - * "Microsoft.SignalRService/webPubSub" - */ - type: string; - /** - * The resource name to validate. e.g."my-resource-name" - */ - name: string; -} - -/** - * Network ACL - */ -export interface NetworkACL { - /** - * Allowed request types. The value can be one or more of: ClientConnection, ServerConnection, - * RESTAPI. - */ - allow?: SignalRRequestType[]; - /** - * Denied request types. The value can be one or more of: ClientConnection, ServerConnection, - * RESTAPI. - */ - deny?: SignalRRequestType[]; -} - -/** - * The object that describes a operation. - */ -export interface OperationDisplay { - /** - * Friendly name of the resource provider - */ - provider?: string; - /** - * Resource type on which the operation is performed. - */ - resource?: string; - /** - * The localized friendly name for the operation. - */ - operation?: string; - /** - * The localized friendly description for the operation - */ - description?: string; -} - -/** - * An object that describes a specification. - */ -export interface ServiceSpecification { - /** - * Specifications of the Metrics for Azure Monitoring. - */ - metricSpecifications?: MetricSpecification[]; - /** - * Specifications of the Logs for Azure Monitoring. - */ - logSpecifications?: LogSpecification[]; -} - -/** - * Extra Operation properties. - */ -export interface OperationProperties { - /** - * The service specifications. - */ - serviceSpecification?: ServiceSpecification; -} - -/** - * REST API operation supported by resource provider. - */ +/** REST API operation supported by resource provider. */ export interface Operation { - /** - * Name of the operation with format: {provider}/{resource}/{operation} - */ + /** Name of the operation with format: {provider}/{resource}/{operation} */ name?: string; - /** - * If the operation is a data action. (for data plane rbac) - */ + /** If the operation is a data action. (for data plane rbac) */ isDataAction?: boolean; - /** - * The object that describes the operation. - */ + /** The object that describes a operation. */ display?: OperationDisplay; - /** - * Optional. The intended executor of the operation; governs the display of the operation in the - * RBAC UX and the audit logs UX. - */ + /** Optional. The intended executor of the operation; governs the display of the operation in the RBAC UX and the audit logs UX. */ origin?: string; - /** - * Extra properties for the operation. - */ + /** Extra Operation properties. */ properties?: OperationProperties; } -/** - * Private endpoint - */ -export interface PrivateEndpoint { - /** - * Full qualified Id of the private endpoint - */ - id?: string; +/** The object that describes a operation. */ +export interface OperationDisplay { + /** Friendly name of the resource provider */ + provider?: string; + /** Resource type on which the operation is performed. */ + resource?: string; + /** The localized friendly name for the operation. */ + operation?: string; + /** The localized friendly description for the operation */ + description?: string; } -/** - * ACL for a private endpoint - */ -export interface PrivateEndpointACL extends NetworkACL { +/** Extra Operation properties. */ +export interface OperationProperties { + /** An object that describes a specification. */ + serviceSpecification?: ServiceSpecification; +} + +/** An object that describes a specification. */ +export interface ServiceSpecification { + /** Specifications of the Metrics for Azure Monitoring. */ + metricSpecifications?: MetricSpecification[]; + /** Specifications of the Logs for Azure Monitoring. */ + logSpecifications?: LogSpecification[]; +} + +/** Specifications of the Metrics for Azure Monitoring. */ +export interface MetricSpecification { + /** Name of the metric. */ + name?: string; + /** Localized friendly display name of the metric. */ + displayName?: string; + /** Localized friendly description of the metric. */ + displayDescription?: string; + /** The unit that makes sense for the metric. */ + unit?: string; + /** Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. */ + aggregationType?: string; /** - * Name of the private endpoint connection + * Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. + * Ex. a metric that returns the number of times a particular error code was emitted. The error code may not appear + * often, instead of the RP publishing 0, Shoebox can auto fill in 0s for time periods where nothing was emitted. */ + fillGapWithZero?: string; + /** The name of the metric category that the metric belongs to. A metric can only belong to a single category. */ + category?: string; + /** The dimensions of the metrics. */ + dimensions?: Dimension[]; +} + +/** Specifications of the Dimension of metrics. */ +export interface Dimension { + /** The public facing name of the dimension. */ + name?: string; + /** Localized friendly display name of the dimension. */ + displayName?: string; + /** Name of the dimension as it appears in MDM. */ + internalName?: string; + /** A Boolean flag indicating whether this dimension should be included for the shoebox export scenario. */ + toBeExportedForShoebox?: boolean; +} + +/** Specifications of the Logs for Azure Monitoring. */ +export interface LogSpecification { + /** Name of the log. */ + name?: string; + /** Localized friendly display name of the log. */ + displayName?: string; +} + +/** Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). */ +export interface ErrorResponse { + /** The error object. */ + error?: ErrorDetail; +} + +/** The error detail. */ +export interface ErrorDetail { + /** + * The error code. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly code?: string; + /** + * The error message. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; + /** + * The error target. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly target?: string; + /** + * The error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly details?: ErrorDetail[]; + /** + * The error additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly additionalInfo?: ErrorAdditionalInfo[]; +} + +/** The resource management error additional info. */ +export interface ErrorAdditionalInfo { + /** + * The additional info type. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The additional info. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly info?: Record; +} + +/** Data POST-ed to the nameAvailability action */ +export interface NameAvailabilityParameters { + /** The resource type. Can be "Microsoft.SignalRService/SignalR" or "Microsoft.SignalRService/webPubSub" */ + type: string; + /** The resource name to validate. e.g."my-resource-name" */ name: string; } -/** - * 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. Possible values include: 'User', - * 'Application', 'ManagedIdentity', 'Key' - */ - 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. Possible values include: 'User', - * 'Application', 'ManagedIdentity', 'Key' - */ - lastModifiedByType?: CreatedByType; - /** - * The timestamp of resource last modification (UTC) - */ - lastModifiedAt?: Date; +/** Result of the request to check name availability. It contains a flag and possible reason of failure. */ +export interface NameAvailability { + /** Indicates whether the name is available or not. */ + nameAvailable?: boolean; + /** The reason of the availability. Required if name is not available. */ + reason?: string; + /** The message of the operation. */ + message?: string; } -/** - * Connection state of the private endpoint connection - */ -export interface PrivateLinkServiceConnectionState { +/** Object that includes an array of the resource usages and a possible link for next set. */ +export interface SignalRUsageList { + /** List of the resource usages */ + value?: SignalRUsage[]; /** - * Indicates whether the connection has been Approved/Rejected/Removed by the owner of the - * service. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected' + * The URL the client should use to fetch the next page (per server side paging). + * It's null for now, added for future use. */ - status?: PrivateLinkServiceConnectionStatus; - /** - * The reason for approval/rejection of the connection. - */ - description?: string; - /** - * A message indicating if changes on the service provider require any updates on the consumer. - */ - actionsRequired?: string; + nextLink?: string; } -/** - * The core properties of ARM resources. - */ -export interface Resource extends BaseResource { - /** - * Fully qualified resource Id for the resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * The name of the resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * The type of the resource - e.g. "Microsoft.SignalRService/SignalR" - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; +/** Object that describes a specific usage of the resources. */ +export interface SignalRUsage { + /** Fully qualified ARM resource id */ + id?: string; + /** Current value for the usage quota. */ + currentValue?: number; + /** The maximum permitted value for the usage quota. If there is no limit, this value will be -1. */ + limit?: number; + /** Localizable String object containing the name and a localized value. */ + name?: SignalRUsageName; + /** Representing the units of the usage quota. Possible values are: Count, Bytes, Seconds, Percent, CountPerSecond, BytesPerSecond. */ + unit?: string; } -/** - * The resource model definition for a ARM proxy resource. It will have everything other than - * required location and tags - */ -export interface ProxyResource extends Resource {} - -/** - * A private endpoint connection to an azure resource - */ -export interface PrivateEndpointConnection extends ProxyResource { - /** - * Metadata pertaining to creation and last modification of the resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly systemData?: SystemData; - /** - * Provisioning state of the private endpoint connection. Possible values include: 'Unknown', - * 'Succeeded', 'Failed', 'Canceled', 'Running', 'Creating', 'Updating', 'Deleting', 'Moving' - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly provisioningState?: ProvisioningState; - /** - * Private endpoint associated with the private endpoint connection - */ - privateEndpoint?: PrivateEndpoint; - /** - * Connection state - */ - privateLinkServiceConnectionState?: PrivateLinkServiceConnectionState; +/** Localizable String object containing the name and a localized value. */ +export interface SignalRUsageName { + /** The identifier of the usage. */ + value?: string; + /** Localized name of the usage. */ + localizedValue?: string; } -/** - * Describes the properties of a resource type that has been onboarded to private link service - */ -export interface ShareablePrivateLinkResourceProperties { +/** Object that includes an array of resources and a possible link for next set. */ +export interface SignalRResourceList { + /** List of the resources */ + value?: SignalRResource[]; /** - * The description of the resource type that has been onboarded to private link service + * The URL the client should use to fetch the next page (per server side paging). + * It's null for now, added for future use. */ - description?: string; - /** - * The resource provider group id for the resource that has been onboarded to private link - * service - */ - groupId?: string; - /** - * The resource provider type for the resource that has been onboarded to private link service - */ - type?: string; + nextLink?: string; } -/** - * Describes a resource type that has been onboarded to private link service - */ -export interface ShareablePrivateLinkResourceType { - /** - * The name of the resource type that has been onboarded to private link service - */ - name?: string; - /** - * Describes the properties of a resource type that has been onboarded to private link service - */ - properties?: ShareablePrivateLinkResourceProperties; -} - -/** - * Private link resource - */ -export interface PrivateLinkResource extends ProxyResource { - /** - * Group Id of the private link resource - */ - groupId?: string; - /** - * Required members of the private link resource - */ - requiredMembers?: string[]; - /** - * Required private DNS zone names - */ - requiredZoneNames?: string[]; - /** - * The list of resources that are onboarded to private link service - */ - shareablePrivateLinkResourceTypes?: ShareablePrivateLinkResourceType[]; -} - -/** - * Parameters describes the request to regenerate access keys - */ -export interface RegenerateKeyParameters { - /** - * The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). Possible - * values include: 'Primary', 'Secondary' - */ - keyType?: KeyType; -} - -/** - * The billing information of the resource. - */ +/** The billing information of the resource. */ export interface ResourceSku { /** * The name of the SKU. Required. @@ -471,1202 +225,1035 @@ export interface ResourceSku { /** * Optional tier of this particular SKU. 'Standard' or 'Free'. * - * `Basic` is deprecated, use `Standard` instead. Possible values include: 'Free', 'Basic', - * 'Standard', 'Premium' + * `Basic` is deprecated, use `Standard` instead. */ tier?: SignalRSkuTier; /** * Not used. Retained for future use. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly size?: string; /** * Not used. Retained for future use. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly family?: string; /** * Optional, integer. The unit count of the resource. 1 by default. * * If present, following values are allowed: - * Free: 1 - * Standard: 1,2,5,10,20,50,100 + * Free: 1 + * Standard: 1,2,5,10,20,50,100 */ capacity?: number; } -/** - * Upstream auth settings. - */ -export interface UpstreamAuthSettings { +/** 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; +} + +/** Private endpoint */ +export interface PrivateEndpoint { + /** Full qualified Id of the private endpoint */ + id?: string; +} + +/** Connection state of the private endpoint connection */ +export interface PrivateLinkServiceConnectionState { + /** Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. */ + status?: PrivateLinkServiceConnectionStatus; + /** The reason for approval/rejection of the connection. */ + description?: string; + /** A message indicating if changes on the service provider require any updates on the consumer. */ + actionsRequired?: string; +} + +/** The core properties of ARM resources. */ +export interface Resource { /** - * Gets or sets the type of auth. None or ManagedIdentity is supported now. Possible values - * include: 'None', 'ManagedIdentity' + * Fully qualified resource Id for the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - type?: UpstreamAuthType; + readonly id?: string; /** - * Gets or sets the managed identity settings. It's required if the auth type is set to - * ManagedIdentity. + * The name of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - managedIdentity?: ManagedIdentitySettings; + readonly name?: string; + /** + * The type of the resource - e.g. "Microsoft.SignalRService/SignalR" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; +} + +/** TLS settings for the resource */ +export interface SignalRTlsSettings { + /** Request client certificate during TLS handshake if enabled */ + clientCertEnabled?: boolean; +} + +/** Feature of a resource, which controls the runtime behavior. */ +export interface SignalRFeature { + /** + * FeatureFlags is the supported features of Azure SignalR service. + * - ServiceMode: Flag for backend server for SignalR service. Values allowed: "Default": have your own backend server; "Serverless": your application doesn't have a backend server; "Classic": for backward compatibility. Support both Default and Serverless mode but not recommended; "PredefinedOnly": for future use. + * - EnableConnectivityLogs: "true"/"false", to enable/disable the connectivity log category respectively. + * - EnableMessagingLogs: "true"/"false", to enable/disable the connectivity log category respectively. + * - EnableLiveTrace: Live Trace allows you to know what's happening inside Azure SignalR service, it will give you live traces in real time, it will be helpful when you developing your own Azure SignalR based web application or self-troubleshooting some issues. Please note that live traces are counted as outbound messages that will be charged. Values allowed: "true"/"false", to enable/disable live trace feature. + */ + flag: FeatureFlags; + /** Value of the feature flag. See Azure SignalR service document https://docs.microsoft.com/azure/azure-signalr/ for allowed values. */ + value: string; + /** Optional properties related to this feature. */ + properties?: { [propertyName: string]: string }; +} + +/** Resource log configuration of a Microsoft.SignalRService resource. */ +export interface ResourceLogConfiguration { + /** Gets or sets the list of category configurations. */ + categories?: ResourceLogCategory[]; +} + +/** Resource log category configuration of a Microsoft.SignalRService resource. */ +export interface ResourceLogCategory { + /** + * Gets or sets the resource log category's name. + * Available values: ConnectivityLogs, MessagingLogs. + * Case insensitive. + */ + name?: string; + /** + * Indicates whether or the resource log category is enabled. + * Available values: true, false. + * Case insensitive. + */ + enabled?: string; +} + +/** Cross-Origin Resource Sharing (CORS) settings. */ +export interface SignalRCorsSettings { + /** Gets or sets the list of origins that should be allowed to make cross-origin calls (for example: http://example.com:12345). Use "*" to allow all. If omitted, allow all by default. */ + allowedOrigins?: string[]; +} + +/** The settings for the Upstream when the service is in server-less mode. */ +export interface ServerlessUpstreamSettings { + /** Gets or sets the list of Upstream URL templates. Order matters, and the first matching template takes effects. */ + templates?: UpstreamTemplate[]; } /** * Upstream template item settings. It defines the Upstream URL of the incoming requests. - * The template defines the pattern of the event, the hub or the category of the incoming request - * that matches current URL template. + * The template defines the pattern of the event, the hub or the category of the incoming request that matches current URL template. */ export interface UpstreamTemplate { /** * Gets or sets the matching pattern for hub names. If not set, it matches any hub. * There are 3 kind of patterns supported: - * 1. "*", it to matches any hub name - * 2. Combine multiple hubs with ",", for example "hub1,hub2", it matches "hub1" and "hub2" - * 3. The single hub name, for example, "hub1", it matches "hub1" + * 1. "*", it to matches any hub name + * 2. Combine multiple hubs with ",", for example "hub1,hub2", it matches "hub1" and "hub2" + * 3. The single hub name, for example, "hub1", it matches "hub1" */ hubPattern?: string; /** * Gets or sets the matching pattern for event names. If not set, it matches any event. * There are 3 kind of patterns supported: - * 1. "*", it to matches any event name - * 2. Combine multiple events with ",", for example "connect,disconnect", it matches event - * "connect" and "disconnect" - * 3. The single event name, for example, "connect", it matches "connect" + * 1. "*", it to matches any event name + * 2. Combine multiple events with ",", for example "connect,disconnect", it matches event "connect" and "disconnect" + * 3. The single event name, for example, "connect", it matches "connect" */ eventPattern?: string; /** * Gets or sets the matching pattern for category names. If not set, it matches any category. * There are 3 kind of patterns supported: - * 1. "*", it to matches any category name - * 2. Combine multiple categories with ",", for example "connections,messages", it matches - * category "connections" and "messages" - * 3. The single category name, for example, "connections", it matches the category "connections" + * 1. "*", it to matches any category name + * 2. Combine multiple categories with ",", for example "connections,messages", it matches category "connections" and "messages" + * 3. The single category name, for example, "connections", it matches the category "connections" */ categoryPattern?: string; /** - * Gets or sets the Upstream URL template. You can use 3 predefined parameters {hub}, {category} - * {event} inside the template, the value of the Upstream URL is dynamically calculated when the - * client request comes in. - * For example, if the urlTemplate is `http://example.com/{hub}/api/{event}`, with a client - * request from hub `chat` connects, it will first POST to this URL: - * `http://example.com/chat/api/connect`. + * Gets or sets the Upstream URL template. You can use 3 predefined parameters {hub}, {category} {event} inside the template, the value of the Upstream URL is dynamically calculated when the client request comes in. + * For example, if the urlTemplate is `http://example.com/{hub}/api/{event}`, with a client request from hub `chat` connects, it will first POST to this URL: `http://example.com/chat/api/connect`. */ urlTemplate: string; - /** - * Gets or sets the auth settings for an upstream. If not set, no auth is used for upstream - * messages. - */ + /** Upstream auth settings. If not set, no auth is used for upstream messages. */ auth?: UpstreamAuthSettings; } -/** - * The settings for the Upstream when the service is in server-less mode. - */ -export interface ServerlessUpstreamSettings { - /** - * Gets or sets the list of Upstream URL templates. Order matters, and the first matching - * template takes effects. - */ - templates?: UpstreamTemplate[]; +/** Upstream auth settings. If not set, no auth is used for upstream messages. */ +export interface UpstreamAuthSettings { + /** Upstream auth type enum. */ + type?: UpstreamAuthType; + /** Managed identity settings for upstream. */ + managedIdentity?: ManagedIdentitySettings; } -/** - * Describes a Shared Private Link Resource - */ -export interface SharedPrivateLinkResource extends ProxyResource { +/** Managed identity settings for upstream. */ +export interface ManagedIdentitySettings { /** - * Metadata pertaining to creation and last modification of the resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * The Resource indicating the App ID URI of the target resource. + * It also appears in the aud (audience) claim of the issued token. */ - readonly systemData?: SystemData; - /** - * The group id from the provider of resource the shared private link resource is for - */ - groupId: string; - /** - * The resource id of the resource the shared private link resource is for - */ - privateLinkResourceId: string; - /** - * Provisioning state of the shared private link resource. Possible values include: 'Unknown', - * 'Succeeded', 'Failed', 'Canceled', 'Running', 'Creating', 'Updating', 'Deleting', 'Moving' - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly provisioningState?: ProvisioningState; - /** - * The request message for requesting approval of the shared private link resource - */ - requestMessage?: string; - /** - * Status of the shared private link resource. Possible values include: 'Pending', 'Approved', - * 'Rejected', 'Disconnected', 'Timeout' - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly status?: SharedPrivateLinkResourceStatus; + resource?: string; } -/** - * Cross-Origin Resource Sharing (CORS) settings. - */ -export interface SignalRCorsSettings { - /** - * Gets or sets the list of origins that should be allowed to make cross-origin calls (for - * example: http://example.com:12345). Use "*" to allow all. If omitted, allow all by default. - */ - allowedOrigins?: string[]; -} - -/** - * Feature of a SignalR resource, which controls the SignalR runtime behavior. - */ -export interface SignalRFeature { - /** - * FeatureFlags is the supported features of Azure SignalR service. - * - ServiceMode: Flag for backend server for SignalR service. Values allowed: "Default": have - * your own backend server; "Serverless": your application doesn't have a backend server; - * "Classic": for backward compatibility. Support both Default and Serverless mode but not - * recommended; "PredefinedOnly": for future use. - * - EnableConnectivityLogs: "true"/"false", to enable/disable the connectivity log category - * respectively. - * - EnableMessagingLogs: "true"/"false", to enable/disable the connectivity log category - * respectively. - * - EnableLiveTrace: Live Trace allows you to know what's happening inside Azure SignalR - * service, it will give you live traces in real time, it will be helpful when you developing - * your own Azure SignalR based web application or self-troubleshooting some issues. Please note - * that live traces are counted as outbound messages that will be charged. Values allowed: - * "true"/"false", to enable/disable live trace feature. Possible values include: 'ServiceMode', - * 'EnableConnectivityLogs', 'EnableMessagingLogs', 'EnableLiveTrace' - */ - flag: FeatureFlags; - /** - * Value of the feature flag. See Azure SignalR service document - * https://docs.microsoft.com/azure/azure-signalr/ for allowed values. - */ - value: string; - /** - * Optional properties related to this feature. - */ - properties?: { [propertyName: string]: string }; -} - -/** - * A class represents the access keys of the resource. - */ -export interface SignalRKeys { - /** - * The primary access key. - */ - primaryKey?: string; - /** - * The secondary access key. - */ - secondaryKey?: string; - /** - * Connection string constructed via the primaryKey - */ - primaryConnectionString?: string; - /** - * Connection string constructed via the secondaryKey - */ - secondaryConnectionString?: string; -} - -/** - * Network ACLs for the resource - */ +/** Network ACLs for the resource */ export interface SignalRNetworkACLs { - /** - * Default action when no other rule matches. Possible values include: 'Allow', 'Deny' - */ + /** Azure Networking ACL Action. */ defaultAction?: ACLAction; - /** - * ACL for requests from public network - */ + /** Network ACL */ publicNetwork?: NetworkACL; - /** - * ACLs for requests from private endpoints - */ + /** ACLs for requests from private endpoints */ privateEndpoints?: PrivateEndpointACL[]; } -/** - * TLS settings for the resource - */ -export interface SignalRTlsSettings { - /** - * Request client certificate during TLS handshake if enabled - */ - clientCertEnabled?: boolean; +/** Network ACL */ +export interface NetworkACL { + /** Allowed request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. */ + allow?: SignalRRequestType[]; + /** Denied request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. */ + deny?: SignalRRequestType[]; } -/** - * The resource model definition for a ARM tracked top level resource. - */ -export interface TrackedResource extends Resource { +/** A class represent managed identities used for request and response */ +export interface ManagedIdentity { + /** Represents the identity type: systemAssigned, userAssigned, None */ + type?: ManagedIdentityType; + /** Get or set the user assigned identities */ + userAssignedIdentities?: { + [propertyName: string]: UserAssignedIdentityProperty; + }; /** - * The GEO location of the resource. e.g. West US | East US | North Central US | South Central - * US. + * Get the principal id for the system assigned identity. + * Only be used in response. + * NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly principalId?: string; + /** + * Get the tenant id for the system assigned identity. + * Only be used in response + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tenantId?: string; +} + +/** Properties of user assigned identity. */ +export interface UserAssignedIdentityProperty { + /** + * Get the principal id for the user assigned identity + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * Get the client id for the user assigned identity + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly clientId?: string; +} + +/** A class represents the access keys of the resource. */ +export interface SignalRKeys { + /** The primary access key. */ + primaryKey?: string; + /** The secondary access key. */ + secondaryKey?: string; + /** Connection string constructed via the primaryKey */ + primaryConnectionString?: string; + /** Connection string constructed via the secondaryKey */ + secondaryConnectionString?: string; +} + +/** A list of private endpoint connections */ +export interface PrivateEndpointConnectionList { + /** The list of the private endpoint connections */ + value?: PrivateEndpointConnection[]; + /** Request URL that can be used to query next page of private endpoint connections. Returned when the total number of requested private endpoint connections exceed maximum page size. */ + nextLink?: string; +} + +/** Contains a list of PrivateLinkResource and a possible link to query more results */ +export interface PrivateLinkResourceList { + /** List of PrivateLinkResource */ + value?: PrivateLinkResource[]; + /** + * The URL the client should use to fetch the next page (per server side paging). + * It's null for now, added for future use. + */ + nextLink?: string; +} + +/** Describes a resource type that has been onboarded to private link service */ +export interface ShareablePrivateLinkResourceType { + /** The name of the resource type that has been onboarded to private link service */ + name?: string; + /** Describes the properties of a resource type that has been onboarded to private link service */ + properties?: ShareablePrivateLinkResourceProperties; +} + +/** Describes the properties of a resource type that has been onboarded to private link service */ +export interface ShareablePrivateLinkResourceProperties { + /** The description of the resource type that has been onboarded to private link service */ + description?: string; + /** The resource provider group id for the resource that has been onboarded to private link service */ + groupId?: string; + /** The resource provider type for the resource that has been onboarded to private link service */ + type?: string; +} + +/** Parameters describes the request to regenerate access keys */ +export interface RegenerateKeyParameters { + /** The type of access key. */ + keyType?: KeyType; +} + +/** A list of shared private link resources */ +export interface SharedPrivateLinkResourceList { + /** The list of the shared private link resources */ + value?: SharedPrivateLinkResource[]; + /** Request URL that can be used to query next page of private endpoint connections. Returned when the total number of requested private endpoint connections exceed maximum page size. */ + nextLink?: string; +} + +/** The list skus operation response */ +export interface SkuList { + /** + * The list of skus available for the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: Sku[]; + /** + * The URL the client should use to fetch the next page (per server side paging). + * It's null for now, added for future use. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextLink?: string; +} + +/** Describes an available sku." */ +export interface Sku { + /** + * The resource type that this object applies to + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resourceType?: string; + /** + * The billing information of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly sku?: ResourceSku; + /** + * Describes scaling information of a sku. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly capacity?: SkuCapacity; +} + +/** Describes scaling information of a sku. */ +export interface SkuCapacity { + /** + * The lowest permitted capacity for this resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly minimum?: number; + /** + * The highest permitted capacity for this resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly maximum?: number; + /** + * The default capacity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly default?: number; + /** + * Allows capacity value list. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly allowedValues?: number[]; + /** + * The scale type applicable to the sku. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly scaleType?: ScaleType; +} + +/** The resource model definition for a ARM proxy resource. It will have everything other than required location and tags */ +export type ProxyResource = Resource & {}; + +/** The resource model definition for a ARM tracked top level resource. */ +export type TrackedResource = Resource & { + /** The GEO location of the resource. e.g. West US | East US | North Central US | South Central US. */ location?: string; - /** - * Tags of the service which is a list of key value pairs that describe the resource. - */ + /** Tags of the service which is a list of key value pairs that describe the resource. */ tags?: { [propertyName: string]: string }; -} +}; -/** - * A class represent a resource. - */ -export interface SignalRResource extends TrackedResource { +/** ACL for a private endpoint */ +export type PrivateEndpointACL = NetworkACL & { + /** Name of the private endpoint connection */ + name: string; +}; + +/** A private endpoint connection to an azure resource */ +export type PrivateEndpointConnection = ProxyResource & { /** - * The billing information of the resource.(e.g. Free, Standard) + * Metadata pertaining to creation and last modification of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - sku?: ResourceSku; + readonly systemData?: SystemData; /** - * Provisioning state of the resource. Possible values include: 'Unknown', 'Succeeded', 'Failed', - * 'Canceled', 'Running', 'Creating', 'Updating', 'Deleting', 'Moving' - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * Provisioning state of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** Private endpoint */ + privateEndpoint?: PrivateEndpoint; + /** + * Group IDs + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly groupIds?: string[]; + /** Connection state of the private endpoint connection */ + privateLinkServiceConnectionState?: PrivateLinkServiceConnectionState; +}; + +/** Describes a Shared Private Link Resource */ +export type SharedPrivateLinkResource = ProxyResource & { + /** + * Metadata pertaining to creation and last modification of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; + /** The group id from the provider of resource the shared private link resource is for */ + groupId?: string; + /** The resource id of the resource the shared private link resource is for */ + privateLinkResourceId?: string; + /** + * Provisioning state of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: ProvisioningState; + /** The request message for requesting approval of the shared private link resource */ + requestMessage?: string; + /** + * Status of the shared private link resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly status?: SharedPrivateLinkResourceStatus; +}; + +/** Private link resource */ +export type PrivateLinkResource = ProxyResource & { + /** Group Id of the private link resource */ + groupId?: string; + /** Required members of the private link resource */ + requiredMembers?: string[]; + /** Required private DNS zone names */ + requiredZoneNames?: string[]; + /** The list of resources that are onboarded to private link service */ + shareablePrivateLinkResourceTypes?: ShareablePrivateLinkResourceType[]; +}; + +/** A class represent a resource. */ +export type SignalRResource = TrackedResource & { + /** The billing information of the resource. */ + sku?: ResourceSku; + /** The kind of the service, it can be SignalR or RawWebSockets */ + kind?: ServiceKind; + /** A class represent managed identities used for request and response */ + identity?: ManagedIdentity; + /** + * Metadata pertaining to creation and last modification of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly systemData?: SystemData; + /** + * Provisioning state of the resource. + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly provisioningState?: ProvisioningState; /** * The publicly accessible IP of the resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly externalIP?: string; /** * FQDN of the service instance. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly hostName?: string; /** * The publicly accessible port of the resource which is designed for browser/client side usage. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly publicPort?: number; /** * The publicly accessible port of the resource which is designed for customer server side usage. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly serverPort?: number; /** * Version of the resource. Probably you need the same or higher version of client SDKs. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly version?: string; /** * Private endpoint connections to the resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly privateEndpointConnections?: PrivateEndpointConnection[]; /** * The list of shared private link resources. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly sharedPrivateLinkResources?: SharedPrivateLinkResource[]; - /** - * TLS settings. - */ + /** TLS settings for the resource */ tls?: SignalRTlsSettings; + /** + * Deprecated. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly hostNamePrefix?: string; /** * List of the featureFlags. * - * FeatureFlags that are not included in the parameters for the update operation will not be - * modified. + * FeatureFlags that are not included in the parameters for the update operation will not be modified. * And the response will only include featureFlags that are explicitly set. * When a featureFlag is not explicitly set, its globally default value will be used - * But keep in mind, the default value doesn't mean "false". It varies in terms of different - * FeatureFlags. + * But keep in mind, the default value doesn't mean "false". It varies in terms of different FeatureFlags. */ features?: SignalRFeature[]; - /** - * Cross-Origin Resource Sharing (CORS) settings. - */ + /** Resource log configuration of a Microsoft.SignalRService resource. */ + resourceLogConfiguration?: ResourceLogConfiguration; + /** Cross-Origin Resource Sharing (CORS) settings. */ cors?: SignalRCorsSettings; - /** - * Upstream settings when the service is in server-less mode. - */ + /** The settings for the Upstream when the service is in server-less mode. */ upstream?: ServerlessUpstreamSettings; - /** - * Network ACLs - */ + /** Network ACLs for the resource */ networkACLs?: SignalRNetworkACLs; /** - * The kind of the service - e.g. "SignalR" for "Microsoft.SignalRService/SignalR". Possible - * values include: 'SignalR', 'RawWebSockets' + * Enable or disable public network access. Default to "Enabled". + * When it's Enabled, network ACLs still apply. + * When it's Disabled, public network access is always disabled no matter what you set in network ACLs. */ - kind?: ServiceKind; + publicNetworkAccess?: string; /** - * The managed identity response + * DisableLocalAuth + * Enable or disable local auth with AccessKey + * When set as true, connection with AccessKey=xxx won't work. */ - identity?: ManagedIdentity; + disableLocalAuth?: boolean; /** - * Metadata pertaining to creation and last modification of the resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * DisableLocalAuth + * Enable or disable aad auth + * When set as true, connection with AuthType=aad won't work. */ - readonly systemData?: SystemData; + disableAadAuth?: boolean; +}; + +/** Known values of {@link SignalRSkuTier} that the service accepts. */ +export enum KnownSignalRSkuTier { + Free = "Free", + Basic = "Basic", + Standard = "Standard", + Premium = "Premium" } /** - * Localizable String object containing the name and a localized value. + * Defines values for SignalRSkuTier. \ + * {@link KnownSignalRSkuTier} can be used interchangeably with SignalRSkuTier, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Free** \ + * **Basic** \ + * **Standard** \ + * **Premium** */ -export interface SignalRUsageName { - /** - * The identifier of the usage. - */ - value?: string; - /** - * Localized name of the usage. - */ - localizedValue?: string; +export type SignalRSkuTier = string; + +/** Known values of {@link ProvisioningState} that the service accepts. */ +export enum KnownProvisioningState { + Unknown = "Unknown", + Succeeded = "Succeeded", + Failed = "Failed", + Canceled = "Canceled", + Running = "Running", + Creating = "Creating", + Updating = "Updating", + Deleting = "Deleting", + Moving = "Moving" } /** - * Object that describes a specific usage of the resources. + * Defines values for ProvisioningState. \ + * {@link KnownProvisioningState} can be used interchangeably with ProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Unknown** \ + * **Succeeded** \ + * **Failed** \ + * **Canceled** \ + * **Running** \ + * **Creating** \ + * **Updating** \ + * **Deleting** \ + * **Moving** */ -export interface SignalRUsage { - /** - * Fully qualified ARM resource id - */ - id?: string; - /** - * Current value for the usage quota. - */ - currentValue?: number; - /** - * The maximum permitted value for the usage quota. If there is no limit, this value will be -1. - */ - limit?: number; - /** - * Localizable String object containing the name and a localized value. - */ - name?: SignalRUsageName; - /** - * Representing the units of the usage quota. Possible values are: Count, Bytes, Seconds, - * Percent, CountPerSecond, BytesPerSecond. - */ - unit?: string; +export type ProvisioningState = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + User = "User", + Application = "Application", + ManagedIdentity = "ManagedIdentity", + Key = "Key" } /** - * The resource management error additional info. + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** */ -export interface ErrorAdditionalInfo { - /** - * The additional info type. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * The additional info. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly info?: any; +export type CreatedByType = string; + +/** Known values of {@link PrivateLinkServiceConnectionStatus} that the service accepts. */ +export enum KnownPrivateLinkServiceConnectionStatus { + Pending = "Pending", + Approved = "Approved", + Rejected = "Rejected", + Disconnected = "Disconnected" } /** - * The error detail. + * Defines values for PrivateLinkServiceConnectionStatus. \ + * {@link KnownPrivateLinkServiceConnectionStatus} can be used interchangeably with PrivateLinkServiceConnectionStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Pending** \ + * **Approved** \ + * **Rejected** \ + * **Disconnected** */ -export interface ErrorDetail { - /** - * The error code. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly code?: string; - /** - * The error message. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly message?: string; - /** - * The error target. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly target?: string; - /** - * The error details. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly details?: ErrorDetail[]; - /** - * The error additional info. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly additionalInfo?: ErrorAdditionalInfo[]; +export type PrivateLinkServiceConnectionStatus = string; + +/** Known values of {@link SharedPrivateLinkResourceStatus} that the service accepts. */ +export enum KnownSharedPrivateLinkResourceStatus { + Pending = "Pending", + Approved = "Approved", + Rejected = "Rejected", + Disconnected = "Disconnected", + Timeout = "Timeout" } /** - * Common error response for all Azure Resource Manager APIs to return error details for failed - * operations. (This also follows the OData error response format.). - * @summary Error response + * Defines values for SharedPrivateLinkResourceStatus. \ + * {@link KnownSharedPrivateLinkResourceStatus} can be used interchangeably with SharedPrivateLinkResourceStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Pending** \ + * **Approved** \ + * **Rejected** \ + * **Disconnected** \ + * **Timeout** */ -export interface ErrorResponse { - /** - * The error object. - */ - error?: ErrorDetail; +export type SharedPrivateLinkResourceStatus = string; + +/** Known values of {@link FeatureFlags} that the service accepts. */ +export enum KnownFeatureFlags { + ServiceMode = "ServiceMode", + EnableConnectivityLogs = "EnableConnectivityLogs", + EnableMessagingLogs = "EnableMessagingLogs", + EnableLiveTrace = "EnableLiveTrace" } /** - * An interface representing SignalRManagementClientOptions. + * Defines values for FeatureFlags. \ + * {@link KnownFeatureFlags} can be used interchangeably with FeatureFlags, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ServiceMode** \ + * **EnableConnectivityLogs** \ + * **EnableMessagingLogs** \ + * **EnableLiveTrace** */ -export interface SignalRManagementClientOptions extends AzureServiceClientOptions { - baseUri?: string; +export type FeatureFlags = string; + +/** Known values of {@link UpstreamAuthType} that the service accepts. */ +export enum KnownUpstreamAuthType { + None = "None", + ManagedIdentity = "ManagedIdentity" } /** - * @interface - * Result of the request to list REST API operations. It contains a list of operations. - * @extends Array + * Defines values for UpstreamAuthType. \ + * {@link KnownUpstreamAuthType} can be used interchangeably with UpstreamAuthType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **ManagedIdentity** */ -export interface OperationList extends Array { - /** - * The URL the client should use to fetch the next page (per server side paging). - * It's null for now, added for future use. - */ - nextLink?: string; +export type UpstreamAuthType = string; + +/** Known values of {@link ACLAction} that the service accepts. */ +export enum KnownACLAction { + Allow = "Allow", + Deny = "Deny" } /** - * @interface - * Object that includes an array of resources and a possible link for next set. - * @extends Array + * Defines values for ACLAction. \ + * {@link KnownACLAction} can be used interchangeably with ACLAction, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Allow** \ + * **Deny** */ -export interface SignalRResourceList extends Array { - /** - * The URL the client should use to fetch the next page (per server side paging). - * It's null for now, added for future use. - */ - nextLink?: string; +export type ACLAction = string; + +/** Known values of {@link SignalRRequestType} that the service accepts. */ +export enum KnownSignalRRequestType { + ClientConnection = "ClientConnection", + ServerConnection = "ServerConnection", + Restapi = "RESTAPI", + Trace = "Trace" } /** - * @interface - * Object that includes an array of the resource usages and a possible link for next set. - * @extends Array + * Defines values for SignalRRequestType. \ + * {@link KnownSignalRRequestType} can be used interchangeably with SignalRRequestType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ClientConnection** \ + * **ServerConnection** \ + * **RESTAPI** \ + * **Trace** */ -export interface SignalRUsageList extends Array { - /** - * The URL the client should use to fetch the next page (per server side paging). - * It's null for now, added for future use. - */ - nextLink?: string; +export type SignalRRequestType = string; + +/** Known values of {@link ServiceKind} that the service accepts. */ +export enum KnownServiceKind { + SignalR = "SignalR", + RawWebSockets = "RawWebSockets" } /** - * @interface - * A list of private endpoint connections - * @extends Array + * Defines values for ServiceKind. \ + * {@link KnownServiceKind} can be used interchangeably with ServiceKind, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **SignalR** \ + * **RawWebSockets** */ -export interface PrivateEndpointConnectionList extends Array { - /** - * Request URL that can be used to query next page of private endpoint connections. Returned when - * the total number of requested private endpoint connections exceed maximum page size. - */ - nextLink?: string; +export type ServiceKind = string; + +/** Known values of {@link ManagedIdentityType} that the service accepts. */ +export enum KnownManagedIdentityType { + None = "None", + SystemAssigned = "SystemAssigned", + UserAssigned = "UserAssigned" } /** - * @interface - * Contains a list of PrivateLinkResource and a possible link to query more results - * @extends Array + * Defines values for ManagedIdentityType. \ + * {@link KnownManagedIdentityType} can be used interchangeably with ManagedIdentityType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **SystemAssigned** \ + * **UserAssigned** */ -export interface PrivateLinkResourceList extends Array { - /** - * The URL the client should use to fetch the next page (per server side paging). - * It's null for now, added for future use. - */ - nextLink?: string; +export type ManagedIdentityType = string; + +/** Known values of {@link KeyType} that the service accepts. */ +export enum KnownKeyType { + Primary = "Primary", + Secondary = "Secondary", + Salt = "Salt" } /** - * @interface - * A list of shared private link resources - * @extends Array + * Defines values for KeyType. \ + * {@link KnownKeyType} can be used interchangeably with KeyType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Primary** \ + * **Secondary** \ + * **Salt** */ -export interface SharedPrivateLinkResourceList extends Array { - /** - * Request URL that can be used to query next page of private endpoint connections. Returned when - * the total number of requested private endpoint connections exceed maximum page size. - */ - nextLink?: string; +export type KeyType = string; + +/** Known values of {@link ScaleType} that the service accepts. */ +export enum KnownScaleType { + None = "None", + Manual = "Manual", + Automatic = "Automatic" } /** - * Defines values for ACLAction. - * Possible values include: 'Allow', 'Deny' - * @readonly - * @enum {string} + * Defines values for ScaleType. \ + * {@link KnownScaleType} can be used interchangeably with ScaleType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **None** \ + * **Manual** \ + * **Automatic** */ -export type ACLAction = "Allow" | "Deny"; - -/** - * Defines values for FeatureFlags. - * Possible values include: 'ServiceMode', 'EnableConnectivityLogs', 'EnableMessagingLogs', - * 'EnableLiveTrace' - * @readonly - * @enum {string} - */ -export type FeatureFlags = - | "ServiceMode" - | "EnableConnectivityLogs" - | "EnableMessagingLogs" - | "EnableLiveTrace"; - -/** - * Defines values for KeyType. - * Possible values include: 'Primary', 'Secondary' - * @readonly - * @enum {string} - */ -export type KeyType = "Primary" | "Secondary"; - -/** - * Defines values for ManagedIdentityType. - * Possible values include: 'None', 'SystemAssigned', 'UserAssigned' - * @readonly - * @enum {string} - */ -export type ManagedIdentityType = "None" | "SystemAssigned" | "UserAssigned"; - -/** - * Defines values for SignalRRequestType. - * Possible values include: 'ClientConnection', 'ServerConnection', 'RESTAPI', 'Trace' - * @readonly - * @enum {string} - */ -export type SignalRRequestType = "ClientConnection" | "ServerConnection" | "RESTAPI" | "Trace"; - -/** - * Defines values for CreatedByType. - * Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' - * @readonly - * @enum {string} - */ -export type CreatedByType = "User" | "Application" | "ManagedIdentity" | "Key"; - -/** - * Defines values for ProvisioningState. - * Possible values include: 'Unknown', 'Succeeded', 'Failed', 'Canceled', 'Running', 'Creating', - * 'Updating', 'Deleting', 'Moving' - * @readonly - * @enum {string} - */ -export type ProvisioningState = - | "Unknown" - | "Succeeded" - | "Failed" - | "Canceled" - | "Running" - | "Creating" - | "Updating" - | "Deleting" - | "Moving"; - -/** - * Defines values for PrivateLinkServiceConnectionStatus. - * Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected' - * @readonly - * @enum {string} - */ -export type PrivateLinkServiceConnectionStatus = - | "Pending" - | "Approved" - | "Rejected" - | "Disconnected"; - -/** - * Defines values for SignalRSkuTier. - * Possible values include: 'Free', 'Basic', 'Standard', 'Premium' - * @readonly - * @enum {string} - */ -export type SignalRSkuTier = "Free" | "Basic" | "Standard" | "Premium"; - -/** - * Defines values for UpstreamAuthType. - * Possible values include: 'None', 'ManagedIdentity' - * @readonly - * @enum {string} - */ -export type UpstreamAuthType = "None" | "ManagedIdentity"; - -/** - * Defines values for ServiceKind. - * Possible values include: 'SignalR', 'RawWebSockets' - * @readonly - * @enum {string} - */ -export type ServiceKind = "SignalR" | "RawWebSockets"; - -/** - * Defines values for SharedPrivateLinkResourceStatus. - * Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected', 'Timeout' - * @readonly - * @enum {string} - */ -export type SharedPrivateLinkResourceStatus = - | "Pending" - | "Approved" - | "Rejected" - | "Disconnected" - | "Timeout"; - -/** - * Contains response data for the list operation. - */ -export type OperationsListResponse = OperationList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationList; - }; -}; - -/** - * Contains response data for the listNext operation. - */ -export type OperationsListNextResponse = OperationList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationList; - }; -}; - -/** - * Contains response data for the checkNameAvailability operation. - */ -export type SignalRCheckNameAvailabilityResponse = NameAvailability & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: NameAvailability; - }; -}; - -/** - * Contains response data for the listBySubscription operation. - */ -export type SignalRListBySubscriptionResponse = SignalRResourceList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SignalRResourceList; - }; -}; - -/** - * Contains response data for the listByResourceGroup operation. - */ -export type SignalRListByResourceGroupResponse = SignalRResourceList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SignalRResourceList; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type SignalRGetResponse = SignalRResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SignalRResource; - }; -}; - -/** - * Contains response data for the createOrUpdate operation. - */ -export type SignalRCreateOrUpdateResponse = SignalRResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SignalRResource; - }; -}; - -/** - * Contains response data for the update operation. - */ -export type SignalRUpdateResponse = SignalRResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SignalRResource; - }; -}; - -/** - * Contains response data for the listKeys operation. - */ -export type SignalRListKeysResponse = SignalRKeys & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SignalRKeys; - }; -}; - -/** - * Contains response data for the regenerateKey operation. - */ -export type SignalRRegenerateKeyResponse = SignalRKeys & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SignalRKeys; - }; -}; - -/** - * Contains response data for the beginCreateOrUpdate operation. - */ -export type SignalRBeginCreateOrUpdateResponse = SignalRResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SignalRResource; - }; -}; - -/** - * Contains response data for the beginUpdate operation. - */ -export type SignalRBeginUpdateResponse = SignalRResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SignalRResource; - }; -}; - -/** - * Contains response data for the beginRegenerateKey operation. - */ -export type SignalRBeginRegenerateKeyResponse = SignalRKeys & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SignalRKeys; - }; -}; - -/** - * Contains response data for the listBySubscriptionNext operation. - */ -export type SignalRListBySubscriptionNextResponse = SignalRResourceList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SignalRResourceList; - }; -}; - -/** - * Contains response data for the listByResourceGroupNext operation. - */ -export type SignalRListByResourceGroupNextResponse = SignalRResourceList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SignalRResourceList; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type UsagesListResponse = SignalRUsageList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SignalRUsageList; - }; -}; - -/** - * Contains response data for the listNext operation. - */ -export type UsagesListNextResponse = SignalRUsageList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SignalRUsageList; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type SignalRPrivateEndpointConnectionsListResponse = PrivateEndpointConnectionList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PrivateEndpointConnectionList; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type SignalRPrivateEndpointConnectionsGetResponse = PrivateEndpointConnection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PrivateEndpointConnection; - }; -}; - -/** - * Contains response data for the update operation. - */ -export type SignalRPrivateEndpointConnectionsUpdateResponse = PrivateEndpointConnection & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PrivateEndpointConnection; - }; -}; - -/** - * Contains response data for the listNext operation. - */ -export type SignalRPrivateEndpointConnectionsListNextResponse = PrivateEndpointConnectionList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PrivateEndpointConnectionList; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type SignalRPrivateLinkResourcesListResponse = PrivateLinkResourceList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PrivateLinkResourceList; - }; -}; - -/** - * Contains response data for the listNext operation. - */ -export type SignalRPrivateLinkResourcesListNextResponse = PrivateLinkResourceList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PrivateLinkResourceList; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type SignalRSharedPrivateLinkResourcesListResponse = SharedPrivateLinkResourceList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SharedPrivateLinkResourceList; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type SignalRSharedPrivateLinkResourcesGetResponse = SharedPrivateLinkResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SharedPrivateLinkResource; - }; -}; - -/** - * Contains response data for the createOrUpdate operation. - */ -export type SignalRSharedPrivateLinkResourcesCreateOrUpdateResponse = SharedPrivateLinkResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SharedPrivateLinkResource; - }; -}; - -/** - * Contains response data for the beginCreateOrUpdate operation. - */ -export type SignalRSharedPrivateLinkResourcesBeginCreateOrUpdateResponse = SharedPrivateLinkResource & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SharedPrivateLinkResource; - }; -}; - -/** - * Contains response data for the listNext operation. - */ -export type SignalRSharedPrivateLinkResourcesListNextResponse = SharedPrivateLinkResourceList & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SharedPrivateLinkResourceList; - }; -}; +export type ScaleType = string; + +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OperationsListResponse = OperationList; + +/** Optional parameters. */ +export interface OperationsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OperationsListNextResponse = OperationList; + +/** Optional parameters. */ +export interface SignalRCheckNameAvailabilityOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the checkNameAvailability operation. */ +export type SignalRCheckNameAvailabilityResponse = NameAvailability; + +/** Optional parameters. */ +export interface SignalRListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscription operation. */ +export type SignalRListBySubscriptionResponse = SignalRResourceList; + +/** Optional parameters. */ +export interface SignalRListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type SignalRListByResourceGroupResponse = SignalRResourceList; + +/** Optional parameters. */ +export interface SignalRGetOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type SignalRGetResponse = SignalRResource; + +/** Optional parameters. */ +export interface SignalRCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type SignalRCreateOrUpdateResponse = SignalRResource; + +/** Optional parameters. */ +export interface SignalRDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface SignalRUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the update operation. */ +export type SignalRUpdateResponse = SignalRResource; + +/** Optional parameters. */ +export interface SignalRListKeysOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listKeys operation. */ +export type SignalRListKeysResponse = SignalRKeys; + +/** Optional parameters. */ +export interface SignalRRegenerateKeyOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the regenerateKey operation. */ +export type SignalRRegenerateKeyResponse = SignalRKeys; + +/** Optional parameters. */ +export interface SignalRRestartOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface SignalRListSkusOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listSkus operation. */ +export type SignalRListSkusResponse = SkuList; + +/** Optional parameters. */ +export interface SignalRListBySubscriptionNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscriptionNext operation. */ +export type SignalRListBySubscriptionNextResponse = SignalRResourceList; + +/** Optional parameters. */ +export interface SignalRListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type SignalRListByResourceGroupNextResponse = SignalRResourceList; + +/** Optional parameters. */ +export interface UsagesListOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type UsagesListResponse = SignalRUsageList; + +/** Optional parameters. */ +export interface UsagesListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type UsagesListNextResponse = SignalRUsageList; + +/** Optional parameters. */ +export interface SignalRPrivateEndpointConnectionsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type SignalRPrivateEndpointConnectionsListResponse = PrivateEndpointConnectionList; + +/** Optional parameters. */ +export interface SignalRPrivateEndpointConnectionsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type SignalRPrivateEndpointConnectionsGetResponse = PrivateEndpointConnection; + +/** Optional parameters. */ +export interface SignalRPrivateEndpointConnectionsUpdateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the update operation. */ +export type SignalRPrivateEndpointConnectionsUpdateResponse = PrivateEndpointConnection; + +/** Optional parameters. */ +export interface SignalRPrivateEndpointConnectionsDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface SignalRPrivateEndpointConnectionsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type SignalRPrivateEndpointConnectionsListNextResponse = PrivateEndpointConnectionList; + +/** Optional parameters. */ +export interface SignalRPrivateLinkResourcesListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type SignalRPrivateLinkResourcesListResponse = PrivateLinkResourceList; + +/** Optional parameters. */ +export interface SignalRPrivateLinkResourcesListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type SignalRPrivateLinkResourcesListNextResponse = PrivateLinkResourceList; + +/** Optional parameters. */ +export interface SignalRSharedPrivateLinkResourcesListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type SignalRSharedPrivateLinkResourcesListResponse = SharedPrivateLinkResourceList; + +/** Optional parameters. */ +export interface SignalRSharedPrivateLinkResourcesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type SignalRSharedPrivateLinkResourcesGetResponse = SharedPrivateLinkResource; + +/** Optional parameters. */ +export interface SignalRSharedPrivateLinkResourcesCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type SignalRSharedPrivateLinkResourcesCreateOrUpdateResponse = SharedPrivateLinkResource; + +/** Optional parameters. */ +export interface SignalRSharedPrivateLinkResourcesDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface SignalRSharedPrivateLinkResourcesListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type SignalRSharedPrivateLinkResourcesListNextResponse = SharedPrivateLinkResourceList; + +/** Optional parameters. */ +export interface SignalRManagementClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/signalr/arm-signalr/src/models/mappers.ts b/sdk/signalr/arm-signalr/src/models/mappers.ts index 83f2e14af57..c3f4b85c2ed 100644 --- a/sdk/signalr/arm-signalr/src/models/mappers.ts +++ b/sdk/signalr/arm-signalr/src/models/mappers.ts @@ -6,126 +6,27 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export const CloudError = CloudErrorMapper; -export const BaseResource = BaseResourceMapper; - -export const Dimension: msRest.CompositeMapper = { - serializedName: "Dimension", +export const OperationList: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Dimension", + className: "OperationList", modelProperties: { - name: { - serializedName: "name", + value: { + serializedName: "value", type: { - name: "String" - } - }, - displayName: { - serializedName: "displayName", - type: { - name: "String" - } - }, - internalName: { - serializedName: "internalName", - type: { - name: "String" - } - }, - toBeExportedForShoebox: { - serializedName: "toBeExportedForShoebox", - type: { - name: "Boolean" - } - } - } - } -}; - -export const LogSpecification: msRest.CompositeMapper = { - serializedName: "LogSpecification", - type: { - name: "Composite", - className: "LogSpecification", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String" - } - }, - displayName: { - serializedName: "displayName", - type: { - name: "String" - } - } - } - } -}; - -export const UserAssignedIdentityProperty: msRest.CompositeMapper = { - serializedName: "UserAssignedIdentityProperty", - type: { - name: "Composite", - className: "UserAssignedIdentityProperty", - modelProperties: { - principalId: { - readOnly: true, - serializedName: "principalId", - type: { - name: "String" - } - }, - clientId: { - readOnly: true, - serializedName: "clientId", - type: { - name: "String" - } - } - } - } -}; - -export const ManagedIdentity: msRest.CompositeMapper = { - serializedName: "ManagedIdentity", - type: { - name: "Composite", - className: "ManagedIdentity", - modelProperties: { - type: { - serializedName: "type", - type: { - name: "String" - } - }, - userAssignedIdentities: { - serializedName: "userAssignedIdentities", - type: { - name: "Dictionary", - value: { + name: "Sequence", + element: { type: { name: "Composite", - className: "UserAssignedIdentityProperty" + className: "Operation" } } } }, - principalId: { - readOnly: true, - serializedName: "principalId", - type: { - name: "String" - } - }, - tenantId: { - readOnly: true, - serializedName: "tenantId", + nextLink: { + serializedName: "nextLink", type: { name: "String" } @@ -134,24 +35,130 @@ export const ManagedIdentity: msRest.CompositeMapper = { } }; -export const ManagedIdentitySettings: msRest.CompositeMapper = { - serializedName: "ManagedIdentitySettings", +export const Operation: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ManagedIdentitySettings", + className: "Operation", modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + isDataAction: { + serializedName: "isDataAction", + type: { + name: "Boolean" + } + }, + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplay" + } + }, + origin: { + serializedName: "origin", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "OperationProperties" + } + } + } + } +}; + +export const OperationDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplay", + modelProperties: { + provider: { + serializedName: "provider", + type: { + name: "String" + } + }, resource: { serializedName: "resource", type: { name: "String" } + }, + operation: { + serializedName: "operation", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } } } } }; -export const MetricSpecification: msRest.CompositeMapper = { - serializedName: "MetricSpecification", +export const OperationProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationProperties", + modelProperties: { + serviceSpecification: { + serializedName: "serviceSpecification", + type: { + name: "Composite", + className: "ServiceSpecification" + } + } + } + } +}; + +export const ServiceSpecification: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ServiceSpecification", + modelProperties: { + metricSpecifications: { + serializedName: "metricSpecifications", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetricSpecification" + } + } + } + }, + logSpecifications: { + serializedName: "logSpecifications", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "LogSpecification" + } + } + } + } + } + } +}; + +export const MetricSpecification: coreClient.CompositeMapper = { type: { name: "Composite", className: "MetricSpecification", @@ -214,8 +221,180 @@ export const MetricSpecification: msRest.CompositeMapper = { } }; -export const NameAvailability: msRest.CompositeMapper = { - serializedName: "NameAvailability", +export const Dimension: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Dimension", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + internalName: { + serializedName: "internalName", + type: { + name: "String" + } + }, + toBeExportedForShoebox: { + serializedName: "toBeExportedForShoebox", + type: { + name: "Boolean" + } + } + } + } +}; + +export const LogSpecification: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LogSpecification", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + } + } + } +}; + +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + } +}; + +export const ErrorDetail: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorDetail", + modelProperties: { + code: { + serializedName: "code", + readOnly: true, + type: { + name: "String" + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + }, + target: { + serializedName: "target", + readOnly: true, + type: { + name: "String" + } + }, + details: { + serializedName: "details", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorDetail" + } + } + } + }, + additionalInfo: { + serializedName: "additionalInfo", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ErrorAdditionalInfo" + } + } + } + } + } + } +}; + +export const ErrorAdditionalInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorAdditionalInfo", + modelProperties: { + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + info: { + serializedName: "info", + readOnly: true, + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const NameAvailabilityParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "NameAvailabilityParameters", + modelProperties: { + type: { + serializedName: "type", + required: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const NameAvailability: coreClient.CompositeMapper = { type: { name: "Composite", className: "NameAvailability", @@ -242,215 +421,65 @@ export const NameAvailability: msRest.CompositeMapper = { } }; -export const NameAvailabilityParameters: msRest.CompositeMapper = { - serializedName: "NameAvailabilityParameters", +export const SignalRUsageList: coreClient.CompositeMapper = { type: { name: "Composite", - className: "NameAvailabilityParameters", + className: "SignalRUsageList", modelProperties: { - type: { - required: true, - serializedName: "type", - type: { - name: "String" - } - }, - name: { - required: true, - serializedName: "name", - type: { - name: "String" - } - } - } - } -}; - -export const NetworkACL: msRest.CompositeMapper = { - serializedName: "NetworkACL", - type: { - name: "Composite", - className: "NetworkACL", - modelProperties: { - allow: { - serializedName: "allow", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - deny: { - serializedName: "deny", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - } - } - } -}; - -export const OperationDisplay: msRest.CompositeMapper = { - serializedName: "OperationDisplay", - type: { - name: "Composite", - className: "OperationDisplay", - modelProperties: { - provider: { - serializedName: "provider", - type: { - name: "String" - } - }, - resource: { - serializedName: "resource", - type: { - name: "String" - } - }, - operation: { - serializedName: "operation", - type: { - name: "String" - } - }, - description: { - serializedName: "description", - type: { - name: "String" - } - } - } - } -}; - -export const ServiceSpecification: msRest.CompositeMapper = { - serializedName: "ServiceSpecification", - type: { - name: "Composite", - className: "ServiceSpecification", - modelProperties: { - metricSpecifications: { - serializedName: "metricSpecifications", + value: { + serializedName: "value", type: { name: "Sequence", element: { type: { name: "Composite", - className: "MetricSpecification" + className: "SignalRUsage" } } } }, - logSpecifications: { - serializedName: "logSpecifications", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "LogSpecification" - } - } - } - } - } - } -}; - -export const OperationProperties: msRest.CompositeMapper = { - serializedName: "OperationProperties", - type: { - name: "Composite", - className: "OperationProperties", - modelProperties: { - serviceSpecification: { - serializedName: "serviceSpecification", - type: { - name: "Composite", - className: "ServiceSpecification" - } - } - } - } -}; - -export const Operation: msRest.CompositeMapper = { - serializedName: "Operation", - type: { - name: "Composite", - className: "Operation", - modelProperties: { - name: { - serializedName: "name", + nextLink: { + serializedName: "nextLink", type: { name: "String" } - }, - isDataAction: { - serializedName: "isDataAction", - type: { - name: "Boolean" - } - }, - display: { - serializedName: "display", - type: { - name: "Composite", - className: "OperationDisplay" - } - }, - origin: { - serializedName: "origin", - type: { - name: "String" - } - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "OperationProperties" - } } } } }; -export const PrivateEndpoint: msRest.CompositeMapper = { - serializedName: "PrivateEndpoint", +export const SignalRUsage: coreClient.CompositeMapper = { type: { name: "Composite", - className: "PrivateEndpoint", + className: "SignalRUsage", modelProperties: { id: { serializedName: "id", type: { name: "String" } - } - } - } -}; - -export const PrivateEndpointACL: msRest.CompositeMapper = { - serializedName: "PrivateEndpointACL", - type: { - name: "Composite", - className: "PrivateEndpointACL", - modelProperties: { - ...NetworkACL.type.modelProperties, + }, + currentValue: { + serializedName: "currentValue", + type: { + name: "Number" + } + }, + limit: { + serializedName: "limit", + type: { + name: "Number" + } + }, name: { - required: true, serializedName: "name", + type: { + name: "Composite", + className: "SignalRUsageName" + } + }, + unit: { + serializedName: "unit", type: { name: "String" } @@ -459,8 +488,97 @@ export const PrivateEndpointACL: msRest.CompositeMapper = { } }; -export const SystemData: msRest.CompositeMapper = { - serializedName: "systemData", +export const SignalRUsageName: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SignalRUsageName", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "String" + } + }, + localizedValue: { + serializedName: "localizedValue", + type: { + name: "String" + } + } + } + } +}; + +export const SignalRResourceList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SignalRResourceList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SignalRResource" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const ResourceSku: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceSku", + modelProperties: { + name: { + serializedName: "name", + required: true, + type: { + name: "String" + } + }, + tier: { + serializedName: "tier", + type: { + name: "String" + } + }, + size: { + serializedName: "size", + readOnly: true, + type: { + name: "String" + } + }, + family: { + serializedName: "family", + readOnly: true, + type: { + name: "String" + } + }, + capacity: { + serializedName: "capacity", + type: { + name: "Number" + } + } + } + } +}; + +export const SystemData: coreClient.CompositeMapper = { type: { name: "Composite", className: "SystemData", @@ -505,8 +623,22 @@ export const SystemData: msRest.CompositeMapper = { } }; -export const PrivateLinkServiceConnectionState: msRest.CompositeMapper = { - serializedName: "PrivateLinkServiceConnectionState", +export const PrivateEndpoint: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateEndpoint", + modelProperties: { + id: { + serializedName: "id", + type: { + name: "String" + } + } + } + } +}; + +export const PrivateLinkServiceConnectionState: coreClient.CompositeMapper = { type: { name: "Composite", className: "PrivateLinkServiceConnectionState", @@ -533,90 +665,486 @@ export const PrivateLinkServiceConnectionState: msRest.CompositeMapper = { } }; -export const Resource: msRest.CompositeMapper = { - serializedName: "Resource", +export const Resource: coreClient.CompositeMapper = { type: { name: "Composite", className: "Resource", modelProperties: { id: { - readOnly: true, serializedName: "id", + readOnly: true, type: { name: "String" } }, name: { - readOnly: true, serializedName: "name", + readOnly: true, type: { name: "String" } }, type: { + serializedName: "type", readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const SignalRTlsSettings: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SignalRTlsSettings", + modelProperties: { + clientCertEnabled: { + defaultValue: true, + serializedName: "clientCertEnabled", + type: { + name: "Boolean" + } + } + } + } +}; + +export const SignalRFeature: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SignalRFeature", + modelProperties: { + flag: { + serializedName: "flag", + required: true, + type: { + name: "String" + } + }, + value: { + constraints: { + MaxLength: 128, + MinLength: 1 + }, + serializedName: "value", + required: true, + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + } +}; + +export const ResourceLogConfiguration: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceLogConfiguration", + modelProperties: { + categories: { + serializedName: "categories", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceLogCategory" + } + } + } + } + } + } +}; + +export const ResourceLogCategory: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceLogCategory", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + enabled: { + serializedName: "enabled", + type: { + name: "String" + } + } + } + } +}; + +export const SignalRCorsSettings: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SignalRCorsSettings", + modelProperties: { + allowedOrigins: { + serializedName: "allowedOrigins", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const ServerlessUpstreamSettings: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ServerlessUpstreamSettings", + modelProperties: { + templates: { + serializedName: "templates", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "UpstreamTemplate" + } + } + } + } + } + } +}; + +export const UpstreamTemplate: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UpstreamTemplate", + modelProperties: { + hubPattern: { + serializedName: "hubPattern", + type: { + name: "String" + } + }, + eventPattern: { + serializedName: "eventPattern", + type: { + name: "String" + } + }, + categoryPattern: { + serializedName: "categoryPattern", + type: { + name: "String" + } + }, + urlTemplate: { + serializedName: "urlTemplate", + required: true, + type: { + name: "String" + } + }, + auth: { + serializedName: "auth", + type: { + name: "Composite", + className: "UpstreamAuthSettings" + } + } + } + } +}; + +export const UpstreamAuthSettings: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UpstreamAuthSettings", + modelProperties: { + type: { serializedName: "type", type: { name: "String" } + }, + managedIdentity: { + serializedName: "managedIdentity", + type: { + name: "Composite", + className: "ManagedIdentitySettings" + } } } } }; -export const ProxyResource: msRest.CompositeMapper = { - serializedName: "ProxyResource", +export const ManagedIdentitySettings: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ProxyResource", + className: "ManagedIdentitySettings", modelProperties: { - ...Resource.type.modelProperties + resource: { + serializedName: "resource", + type: { + name: "String" + } + } } } }; -export const PrivateEndpointConnection: msRest.CompositeMapper = { - serializedName: "PrivateEndpointConnection", +export const SignalRNetworkACLs: coreClient.CompositeMapper = { type: { name: "Composite", - className: "PrivateEndpointConnection", + className: "SignalRNetworkACLs", modelProperties: { - ...ProxyResource.type.modelProperties, - systemData: { - readOnly: true, - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData" - } - }, - provisioningState: { - readOnly: true, - serializedName: "properties.provisioningState", + defaultAction: { + serializedName: "defaultAction", type: { name: "String" } }, - privateEndpoint: { - serializedName: "properties.privateEndpoint", + publicNetwork: { + serializedName: "publicNetwork", type: { name: "Composite", - className: "PrivateEndpoint" + className: "NetworkACL" } }, - privateLinkServiceConnectionState: { - serializedName: "properties.privateLinkServiceConnectionState", + privateEndpoints: { + serializedName: "privateEndpoints", type: { - name: "Composite", - className: "PrivateLinkServiceConnectionState" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PrivateEndpointACL" + } + } } } } } }; -export const ShareablePrivateLinkResourceProperties: msRest.CompositeMapper = { - serializedName: "ShareablePrivateLinkResourceProperties", +export const NetworkACL: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "NetworkACL", + modelProperties: { + allow: { + serializedName: "allow", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + deny: { + serializedName: "deny", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const ManagedIdentity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ManagedIdentity", + modelProperties: { + type: { + serializedName: "type", + type: { + name: "String" + } + }, + userAssignedIdentities: { + serializedName: "userAssignedIdentities", + type: { + name: "Dictionary", + value: { + type: { + name: "Composite", + className: "UserAssignedIdentityProperty" + } + } + } + }, + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "String" + } + }, + tenantId: { + serializedName: "tenantId", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const UserAssignedIdentityProperty: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UserAssignedIdentityProperty", + modelProperties: { + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "String" + } + }, + clientId: { + serializedName: "clientId", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const SignalRKeys: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SignalRKeys", + modelProperties: { + primaryKey: { + serializedName: "primaryKey", + type: { + name: "String" + } + }, + secondaryKey: { + serializedName: "secondaryKey", + type: { + name: "String" + } + }, + primaryConnectionString: { + serializedName: "primaryConnectionString", + type: { + name: "String" + } + }, + secondaryConnectionString: { + serializedName: "secondaryConnectionString", + type: { + name: "String" + } + } + } + } +}; + +export const PrivateEndpointConnectionList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateEndpointConnectionList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PrivateEndpointConnection" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const PrivateLinkResourceList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateLinkResourceList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PrivateLinkResource" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const ShareablePrivateLinkResourceType: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ShareablePrivateLinkResourceType", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "ShareablePrivateLinkResourceProperties" + } + } + } + } +}; + +export const ShareablePrivateLinkResourceProperties: coreClient.CompositeMapper = { type: { name: "Composite", className: "ShareablePrivateLinkResourceProperties", @@ -643,31 +1171,306 @@ export const ShareablePrivateLinkResourceProperties: msRest.CompositeMapper = { } }; -export const ShareablePrivateLinkResourceType: msRest.CompositeMapper = { - serializedName: "ShareablePrivateLinkResourceType", +export const RegenerateKeyParameters: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ShareablePrivateLinkResourceType", + className: "RegenerateKeyParameters", modelProperties: { - name: { - serializedName: "name", + keyType: { + serializedName: "keyType", type: { name: "String" } - }, - properties: { - serializedName: "properties", - type: { - name: "Composite", - className: "ShareablePrivateLinkResourceProperties" - } } } } }; -export const PrivateLinkResource: msRest.CompositeMapper = { - serializedName: "PrivateLinkResource", +export const SharedPrivateLinkResourceList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SharedPrivateLinkResourceList", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SharedPrivateLinkResource" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + } + } + } +}; + +export const SkuList: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SkuList", + modelProperties: { + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Sku" + } + } + } + }, + nextLink: { + serializedName: "nextLink", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const Sku: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Sku", + modelProperties: { + resourceType: { + serializedName: "resourceType", + readOnly: true, + type: { + name: "String" + } + }, + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "ResourceSku" + } + }, + capacity: { + serializedName: "capacity", + type: { + name: "Composite", + className: "SkuCapacity" + } + } + } + } +}; + +export const SkuCapacity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SkuCapacity", + modelProperties: { + minimum: { + serializedName: "minimum", + readOnly: true, + type: { + name: "Number" + } + }, + maximum: { + serializedName: "maximum", + readOnly: true, + type: { + name: "Number" + } + }, + default: { + serializedName: "default", + readOnly: true, + type: { + name: "Number" + } + }, + allowedValues: { + serializedName: "allowedValues", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Number" + } + } + } + }, + scaleType: { + serializedName: "scaleType", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ProxyResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ProxyResource", + modelProperties: { + ...Resource.type.modelProperties + } + } +}; + +export const TrackedResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TrackedResource", + modelProperties: { + ...Resource.type.modelProperties, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + } + } + } +}; + +export const PrivateEndpointACL: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateEndpointACL", + modelProperties: { + ...NetworkACL.type.modelProperties, + name: { + serializedName: "name", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const PrivateEndpointConnection: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateEndpointConnection", + modelProperties: { + ...ProxyResource.type.modelProperties, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + privateEndpoint: { + serializedName: "properties.privateEndpoint", + type: { + name: "Composite", + className: "PrivateEndpoint" + } + }, + groupIds: { + serializedName: "properties.groupIds", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + privateLinkServiceConnectionState: { + serializedName: "properties.privateLinkServiceConnectionState", + type: { + name: "Composite", + className: "PrivateLinkServiceConnectionState" + } + } + } + } +}; + +export const SharedPrivateLinkResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SharedPrivateLinkResource", + modelProperties: { + ...ProxyResource.type.modelProperties, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + groupId: { + serializedName: "properties.groupId", + type: { + name: "String" + } + }, + privateLinkResourceId: { + serializedName: "properties.privateLinkResourceId", + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + requestMessage: { + serializedName: "properties.requestMessage", + type: { + name: "String" + } + }, + status: { + serializedName: "properties.status", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const PrivateLinkResource: coreClient.CompositeMapper = { type: { name: "Composite", className: "PrivateLinkResource", @@ -717,380 +1520,7 @@ export const PrivateLinkResource: msRest.CompositeMapper = { } }; -export const RegenerateKeyParameters: msRest.CompositeMapper = { - serializedName: "RegenerateKeyParameters", - type: { - name: "Composite", - className: "RegenerateKeyParameters", - modelProperties: { - keyType: { - serializedName: "keyType", - type: { - name: "String" - } - } - } - } -}; - -export const ResourceSku: msRest.CompositeMapper = { - serializedName: "ResourceSku", - type: { - name: "Composite", - className: "ResourceSku", - modelProperties: { - name: { - required: true, - serializedName: "name", - type: { - name: "String" - } - }, - tier: { - serializedName: "tier", - type: { - name: "String" - } - }, - size: { - readOnly: true, - serializedName: "size", - type: { - name: "String" - } - }, - family: { - readOnly: true, - serializedName: "family", - type: { - name: "String" - } - }, - capacity: { - serializedName: "capacity", - type: { - name: "Number" - } - } - } - } -}; - -export const UpstreamAuthSettings: msRest.CompositeMapper = { - serializedName: "UpstreamAuthSettings", - type: { - name: "Composite", - className: "UpstreamAuthSettings", - modelProperties: { - type: { - serializedName: "type", - type: { - name: "String" - } - }, - managedIdentity: { - serializedName: "managedIdentity", - type: { - name: "Composite", - className: "ManagedIdentitySettings" - } - } - } - } -}; - -export const UpstreamTemplate: msRest.CompositeMapper = { - serializedName: "UpstreamTemplate", - type: { - name: "Composite", - className: "UpstreamTemplate", - modelProperties: { - hubPattern: { - serializedName: "hubPattern", - type: { - name: "String" - } - }, - eventPattern: { - serializedName: "eventPattern", - type: { - name: "String" - } - }, - categoryPattern: { - serializedName: "categoryPattern", - type: { - name: "String" - } - }, - urlTemplate: { - required: true, - serializedName: "urlTemplate", - type: { - name: "String" - } - }, - auth: { - serializedName: "auth", - type: { - name: "Composite", - className: "UpstreamAuthSettings" - } - } - } - } -}; - -export const ServerlessUpstreamSettings: msRest.CompositeMapper = { - serializedName: "ServerlessUpstreamSettings", - type: { - name: "Composite", - className: "ServerlessUpstreamSettings", - modelProperties: { - templates: { - serializedName: "templates", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "UpstreamTemplate" - } - } - } - } - } - } -}; - -export const SharedPrivateLinkResource: msRest.CompositeMapper = { - serializedName: "SharedPrivateLinkResource", - type: { - name: "Composite", - className: "SharedPrivateLinkResource", - modelProperties: { - ...ProxyResource.type.modelProperties, - systemData: { - readOnly: true, - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData" - } - }, - groupId: { - required: true, - serializedName: "properties.groupId", - type: { - name: "String" - } - }, - privateLinkResourceId: { - required: true, - serializedName: "properties.privateLinkResourceId", - type: { - name: "String" - } - }, - provisioningState: { - readOnly: true, - serializedName: "properties.provisioningState", - type: { - name: "String" - } - }, - requestMessage: { - serializedName: "properties.requestMessage", - type: { - name: "String" - } - }, - status: { - readOnly: true, - serializedName: "properties.status", - type: { - name: "String" - } - } - } - } -}; - -export const SignalRCorsSettings: msRest.CompositeMapper = { - serializedName: "SignalRCorsSettings", - type: { - name: "Composite", - className: "SignalRCorsSettings", - modelProperties: { - allowedOrigins: { - serializedName: "allowedOrigins", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - } - } - } -}; - -export const SignalRFeature: msRest.CompositeMapper = { - serializedName: "SignalRFeature", - type: { - name: "Composite", - className: "SignalRFeature", - modelProperties: { - flag: { - required: true, - serializedName: "flag", - type: { - name: "String" - } - }, - value: { - required: true, - serializedName: "value", - constraints: { - MaxLength: 128, - MinLength: 1 - }, - type: { - name: "String" - } - }, - properties: { - serializedName: "properties", - type: { - name: "Dictionary", - value: { - type: { - name: "String" - } - } - } - } - } - } -}; - -export const SignalRKeys: msRest.CompositeMapper = { - serializedName: "SignalRKeys", - type: { - name: "Composite", - className: "SignalRKeys", - modelProperties: { - primaryKey: { - serializedName: "primaryKey", - type: { - name: "String" - } - }, - secondaryKey: { - serializedName: "secondaryKey", - type: { - name: "String" - } - }, - primaryConnectionString: { - serializedName: "primaryConnectionString", - type: { - name: "String" - } - }, - secondaryConnectionString: { - serializedName: "secondaryConnectionString", - type: { - name: "String" - } - } - } - } -}; - -export const SignalRNetworkACLs: msRest.CompositeMapper = { - serializedName: "SignalRNetworkACLs", - type: { - name: "Composite", - className: "SignalRNetworkACLs", - modelProperties: { - defaultAction: { - serializedName: "defaultAction", - type: { - name: "String" - } - }, - publicNetwork: { - serializedName: "publicNetwork", - type: { - name: "Composite", - className: "NetworkACL" - } - }, - privateEndpoints: { - serializedName: "privateEndpoints", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "PrivateEndpointACL" - } - } - } - } - } - } -}; - -export const SignalRTlsSettings: msRest.CompositeMapper = { - serializedName: "SignalRTlsSettings", - type: { - name: "Composite", - className: "SignalRTlsSettings", - modelProperties: { - clientCertEnabled: { - serializedName: "clientCertEnabled", - type: { - name: "Boolean" - } - } - } - } -}; - -export const TrackedResource: msRest.CompositeMapper = { - serializedName: "TrackedResource", - type: { - name: "Composite", - className: "TrackedResource", - modelProperties: { - ...Resource.type.modelProperties, - location: { - serializedName: "location", - type: { - name: "String" - } - }, - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { - type: { - name: "String" - } - } - } - } - } - } -}; - -export const SignalRResource: msRest.CompositeMapper = { - serializedName: "SignalRResource", +export const SignalRResource: coreClient.CompositeMapper = { type: { name: "Composite", className: "SignalRResource", @@ -1103,51 +1533,71 @@ export const SignalRResource: msRest.CompositeMapper = { className: "ResourceSku" } }, + kind: { + serializedName: "kind", + type: { + name: "String" + } + }, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "ManagedIdentity" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, provisioningState: { - readOnly: true, serializedName: "properties.provisioningState", + readOnly: true, type: { name: "String" } }, externalIP: { - readOnly: true, serializedName: "properties.externalIP", + readOnly: true, type: { name: "String" } }, hostName: { - readOnly: true, serializedName: "properties.hostName", + readOnly: true, type: { name: "String" } }, publicPort: { - readOnly: true, serializedName: "properties.publicPort", + readOnly: true, type: { name: "Number" } }, serverPort: { - readOnly: true, serializedName: "properties.serverPort", + readOnly: true, type: { name: "Number" } }, version: { - readOnly: true, serializedName: "properties.version", + readOnly: true, type: { name: "String" } }, privateEndpointConnections: { - readOnly: true, serializedName: "properties.privateEndpointConnections", + readOnly: true, type: { name: "Sequence", element: { @@ -1159,8 +1609,8 @@ export const SignalRResource: msRest.CompositeMapper = { } }, sharedPrivateLinkResources: { - readOnly: true, serializedName: "properties.sharedPrivateLinkResources", + readOnly: true, type: { name: "Sequence", element: { @@ -1178,6 +1628,13 @@ export const SignalRResource: msRest.CompositeMapper = { className: "SignalRTlsSettings" } }, + hostNamePrefix: { + serializedName: "properties.hostNamePrefix", + readOnly: true, + type: { + name: "String" + } + }, features: { serializedName: "properties.features", type: { @@ -1190,6 +1647,13 @@ export const SignalRResource: msRest.CompositeMapper = { } } }, + resourceLogConfiguration: { + serializedName: "properties.resourceLogConfiguration", + type: { + name: "Composite", + className: "ResourceLogConfiguration" + } + }, cors: { serializedName: "properties.cors", type: { @@ -1211,354 +1675,25 @@ export const SignalRResource: msRest.CompositeMapper = { className: "SignalRNetworkACLs" } }, - kind: { - serializedName: "kind", + publicNetworkAccess: { + defaultValue: "Enabled", + serializedName: "properties.publicNetworkAccess", type: { name: "String" } }, - identity: { - serializedName: "identity", + disableLocalAuth: { + defaultValue: false, + serializedName: "properties.disableLocalAuth", type: { - name: "Composite", - className: "ManagedIdentity" + name: "Boolean" } }, - systemData: { - readOnly: true, - serializedName: "systemData", + disableAadAuth: { + defaultValue: false, + serializedName: "properties.disableAadAuth", type: { - name: "Composite", - className: "SystemData" - } - } - } - } -}; - -export const SignalRUsageName: msRest.CompositeMapper = { - serializedName: "SignalRUsageName", - type: { - name: "Composite", - className: "SignalRUsageName", - modelProperties: { - value: { - serializedName: "value", - type: { - name: "String" - } - }, - localizedValue: { - serializedName: "localizedValue", - type: { - name: "String" - } - } - } - } -}; - -export const SignalRUsage: msRest.CompositeMapper = { - serializedName: "SignalRUsage", - type: { - name: "Composite", - className: "SignalRUsage", - modelProperties: { - id: { - serializedName: "id", - type: { - name: "String" - } - }, - currentValue: { - serializedName: "currentValue", - type: { - name: "Number" - } - }, - limit: { - serializedName: "limit", - type: { - name: "Number" - } - }, - name: { - serializedName: "name", - type: { - name: "Composite", - className: "SignalRUsageName" - } - }, - unit: { - serializedName: "unit", - type: { - name: "String" - } - } - } - } -}; - -export const ErrorAdditionalInfo: msRest.CompositeMapper = { - serializedName: "ErrorAdditionalInfo", - type: { - name: "Composite", - className: "ErrorAdditionalInfo", - modelProperties: { - type: { - readOnly: true, - serializedName: "type", - type: { - name: "String" - } - }, - info: { - readOnly: true, - serializedName: "info", - type: { - name: "Object" - } - } - } - } -}; - -export const ErrorDetail: msRest.CompositeMapper = { - serializedName: "ErrorDetail", - type: { - name: "Composite", - className: "ErrorDetail", - modelProperties: { - code: { - readOnly: true, - serializedName: "code", - type: { - name: "String" - } - }, - message: { - readOnly: true, - serializedName: "message", - type: { - name: "String" - } - }, - target: { - readOnly: true, - serializedName: "target", - type: { - name: "String" - } - }, - details: { - readOnly: true, - serializedName: "details", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorDetail" - } - } - } - }, - additionalInfo: { - readOnly: true, - serializedName: "additionalInfo", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ErrorAdditionalInfo" - } - } - } - } - } - } -}; - -export const ErrorResponse: msRest.CompositeMapper = { - serializedName: "ErrorResponse", - type: { - name: "Composite", - className: "ErrorResponse", - modelProperties: { - error: { - serializedName: "error", - type: { - name: "Composite", - className: "ErrorDetail" - } - } - } - } -}; - -export const OperationList: msRest.CompositeMapper = { - serializedName: "OperationList", - type: { - name: "Composite", - className: "OperationList", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Operation" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const SignalRResourceList: msRest.CompositeMapper = { - serializedName: "SignalRResourceList", - type: { - name: "Composite", - className: "SignalRResourceList", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "SignalRResource" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const SignalRUsageList: msRest.CompositeMapper = { - serializedName: "SignalRUsageList", - type: { - name: "Composite", - className: "SignalRUsageList", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "SignalRUsage" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const PrivateEndpointConnectionList: msRest.CompositeMapper = { - serializedName: "PrivateEndpointConnectionList", - type: { - name: "Composite", - className: "PrivateEndpointConnectionList", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "PrivateEndpointConnection" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const PrivateLinkResourceList: msRest.CompositeMapper = { - serializedName: "PrivateLinkResourceList", - type: { - name: "Composite", - className: "PrivateLinkResourceList", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "PrivateLinkResource" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - } - } - } -}; - -export const SharedPrivateLinkResourceList: msRest.CompositeMapper = { - serializedName: "SharedPrivateLinkResourceList", - type: { - name: "Composite", - className: "SharedPrivateLinkResourceList", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "SharedPrivateLinkResource" - } - } - } - }, - nextLink: { - serializedName: "nextLink", - type: { - name: "String" + name: "Boolean" } } } diff --git a/sdk/signalr/arm-signalr/src/models/operationsMappers.ts b/sdk/signalr/arm-signalr/src/models/operationsMappers.ts deleted file mode 100644 index f63b68699e1..00000000000 --- a/sdk/signalr/arm-signalr/src/models/operationsMappers.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - Dimension, - ErrorAdditionalInfo, - ErrorDetail, - ErrorResponse, - LogSpecification, - MetricSpecification, - Operation, - OperationDisplay, - OperationList, - OperationProperties, - ServiceSpecification -} from "../models/mappers"; diff --git a/sdk/signalr/arm-signalr/src/models/parameters.ts b/sdk/signalr/arm-signalr/src/models/parameters.ts index b0b05cf9b7a..6d3061530c6 100644 --- a/sdk/signalr/arm-signalr/src/models/parameters.ts +++ b/sdk/signalr/arm-signalr/src/models/parameters.ts @@ -3,100 +3,169 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + NameAvailabilityParameters as NameAvailabilityParametersMapper, + SignalRResource as SignalRResourceMapper, + RegenerateKeyParameters as RegenerateKeyParametersMapper, + PrivateEndpointConnection as PrivateEndpointConnectionMapper, + SharedPrivateLinkResource as SharedPrivateLinkResourceMapper +} from "../models/mappers"; -export const acceptLanguage: msRest.OperationParameter = { - parameterPath: "acceptLanguage", +export const accept: OperationParameter = { + parameterPath: "accept", mapper: { - serializedName: "accept-language", - defaultValue: "en-US", + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", type: { name: "String" } } }; -export const apiVersion: msRest.OperationQueryParameter = { - parameterPath: "apiVersion", + +export const $host: OperationURLParameter = { + parameterPath: "$host", mapper: { + serializedName: "$host", required: true, - serializedName: "api-version", - type: { - name: "String" - } - } -}; -export const location: msRest.OperationURLParameter = { - parameterPath: "location", - mapper: { - required: true, - serializedName: "location", - type: { - name: "String" - } - } -}; -export const nextPageLink: msRest.OperationURLParameter = { - parameterPath: "nextPageLink", - mapper: { - required: true, - serializedName: "nextLink", type: { name: "String" } }, skipEncoding: true }; -export const privateEndpointConnectionName: msRest.OperationURLParameter = { - parameterPath: "privateEndpointConnectionName", + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", mapper: { - required: true, - serializedName: "privateEndpointConnectionName", + defaultValue: "2021-10-01", + isConstant: true, + serializedName: "api-version", type: { name: "String" } } }; -export const resourceGroupName: msRest.OperationURLParameter = { - parameterPath: "resourceGroupName", + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", mapper: { + serializedName: "nextLink", required: true, - serializedName: "resourceGroupName", + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", type: { name: "String" } } }; -export const resourceName: msRest.OperationURLParameter = { - parameterPath: "resourceName", + +export const parameters: OperationParameter = { + parameterPath: "parameters", + mapper: NameAvailabilityParametersMapper +}; + +export const location: OperationURLParameter = { + parameterPath: "location", mapper: { + serializedName: "location", required: true, - serializedName: "resourceName", type: { name: "String" } } }; -export const sharedPrivateLinkResourceName: msRest.OperationURLParameter = { - parameterPath: "sharedPrivateLinkResourceName", - mapper: { - required: true, - serializedName: "sharedPrivateLinkResourceName", - type: { - name: "String" - } - } -}; -export const subscriptionId: msRest.OperationURLParameter = { + +export const subscriptionId: OperationURLParameter = { parameterPath: "subscriptionId", mapper: { - required: true, serializedName: "subscriptionId", + required: true, type: { name: "String" } } }; + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + serializedName: "resourceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceName: OperationURLParameter = { + parameterPath: "resourceName", + mapper: { + serializedName: "resourceName", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters1: OperationParameter = { + parameterPath: "parameters", + mapper: SignalRResourceMapper +}; + +export const parameters2: OperationParameter = { + parameterPath: "parameters", + mapper: RegenerateKeyParametersMapper +}; + +export const privateEndpointConnectionName: OperationURLParameter = { + parameterPath: "privateEndpointConnectionName", + mapper: { + serializedName: "privateEndpointConnectionName", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters3: OperationParameter = { + parameterPath: "parameters", + mapper: PrivateEndpointConnectionMapper +}; + +export const sharedPrivateLinkResourceName: OperationURLParameter = { + parameterPath: "sharedPrivateLinkResourceName", + mapper: { + serializedName: "sharedPrivateLinkResourceName", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters4: OperationParameter = { + parameterPath: "parameters", + mapper: SharedPrivateLinkResourceMapper +}; diff --git a/sdk/signalr/arm-signalr/src/models/signalRMappers.ts b/sdk/signalr/arm-signalr/src/models/signalRMappers.ts deleted file mode 100644 index 7e65f46d8d6..00000000000 --- a/sdk/signalr/arm-signalr/src/models/signalRMappers.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - BaseResource, - ErrorAdditionalInfo, - ErrorDetail, - ErrorResponse, - ManagedIdentity, - ManagedIdentitySettings, - NameAvailability, - NameAvailabilityParameters, - NetworkACL, - PrivateEndpoint, - PrivateEndpointACL, - PrivateEndpointConnection, - PrivateLinkResource, - PrivateLinkServiceConnectionState, - ProxyResource, - RegenerateKeyParameters, - Resource, - ResourceSku, - ServerlessUpstreamSettings, - ShareablePrivateLinkResourceProperties, - ShareablePrivateLinkResourceType, - SharedPrivateLinkResource, - SignalRCorsSettings, - SignalRFeature, - SignalRKeys, - SignalRNetworkACLs, - SignalRResource, - SignalRResourceList, - SignalRTlsSettings, - SystemData, - TrackedResource, - UpstreamAuthSettings, - UpstreamTemplate, - UserAssignedIdentityProperty -} from "../models/mappers"; diff --git a/sdk/signalr/arm-signalr/src/models/signalRPrivateEndpointConnectionsMappers.ts b/sdk/signalr/arm-signalr/src/models/signalRPrivateEndpointConnectionsMappers.ts deleted file mode 100644 index 1e5d3f1d968..00000000000 --- a/sdk/signalr/arm-signalr/src/models/signalRPrivateEndpointConnectionsMappers.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - BaseResource, - ErrorAdditionalInfo, - ErrorDetail, - ErrorResponse, - ManagedIdentity, - ManagedIdentitySettings, - NetworkACL, - PrivateEndpoint, - PrivateEndpointACL, - PrivateEndpointConnection, - PrivateEndpointConnectionList, - PrivateLinkResource, - PrivateLinkServiceConnectionState, - ProxyResource, - Resource, - ResourceSku, - ServerlessUpstreamSettings, - ShareablePrivateLinkResourceProperties, - ShareablePrivateLinkResourceType, - SharedPrivateLinkResource, - SignalRCorsSettings, - SignalRFeature, - SignalRNetworkACLs, - SignalRResource, - SignalRTlsSettings, - SystemData, - TrackedResource, - UpstreamAuthSettings, - UpstreamTemplate, - UserAssignedIdentityProperty -} from "../models/mappers"; diff --git a/sdk/signalr/arm-signalr/src/models/signalRPrivateLinkResourcesMappers.ts b/sdk/signalr/arm-signalr/src/models/signalRPrivateLinkResourcesMappers.ts deleted file mode 100644 index b8d807dabdd..00000000000 --- a/sdk/signalr/arm-signalr/src/models/signalRPrivateLinkResourcesMappers.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - BaseResource, - ErrorAdditionalInfo, - ErrorDetail, - ErrorResponse, - ManagedIdentity, - ManagedIdentitySettings, - NetworkACL, - PrivateEndpoint, - PrivateEndpointACL, - PrivateEndpointConnection, - PrivateLinkResource, - PrivateLinkResourceList, - PrivateLinkServiceConnectionState, - ProxyResource, - Resource, - ResourceSku, - ServerlessUpstreamSettings, - ShareablePrivateLinkResourceProperties, - ShareablePrivateLinkResourceType, - SharedPrivateLinkResource, - SignalRCorsSettings, - SignalRFeature, - SignalRNetworkACLs, - SignalRResource, - SignalRTlsSettings, - SystemData, - TrackedResource, - UpstreamAuthSettings, - UpstreamTemplate, - UserAssignedIdentityProperty -} from "../models/mappers"; diff --git a/sdk/signalr/arm-signalr/src/models/signalRSharedPrivateLinkResourcesMappers.ts b/sdk/signalr/arm-signalr/src/models/signalRSharedPrivateLinkResourcesMappers.ts deleted file mode 100644 index ee95de56fb0..00000000000 --- a/sdk/signalr/arm-signalr/src/models/signalRSharedPrivateLinkResourcesMappers.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - BaseResource, - ErrorAdditionalInfo, - ErrorDetail, - ErrorResponse, - ManagedIdentity, - ManagedIdentitySettings, - NetworkACL, - PrivateEndpoint, - PrivateEndpointACL, - PrivateEndpointConnection, - PrivateLinkResource, - PrivateLinkServiceConnectionState, - ProxyResource, - Resource, - ResourceSku, - ServerlessUpstreamSettings, - ShareablePrivateLinkResourceProperties, - ShareablePrivateLinkResourceType, - SharedPrivateLinkResource, - SharedPrivateLinkResourceList, - SignalRCorsSettings, - SignalRFeature, - SignalRNetworkACLs, - SignalRResource, - SignalRTlsSettings, - SystemData, - TrackedResource, - UpstreamAuthSettings, - UpstreamTemplate, - UserAssignedIdentityProperty -} from "../models/mappers"; diff --git a/sdk/signalr/arm-signalr/src/operations/index.ts b/sdk/signalr/arm-signalr/src/operations/index.ts index 198aaea7e27..1a3c5a69526 100644 --- a/sdk/signalr/arm-signalr/src/operations/index.ts +++ b/sdk/signalr/arm-signalr/src/operations/index.ts @@ -3,8 +3,7 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ export * from "./operations"; diff --git a/sdk/signalr/arm-signalr/src/operations/operations.ts b/sdk/signalr/arm-signalr/src/operations/operations.ts index 272f271b864..d63ccd83fb1 100644 --- a/sdk/signalr/arm-signalr/src/operations/operations.ts +++ b/sdk/signalr/arm-signalr/src/operations/operations.ts @@ -3,125 +3,109 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/operationsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { SignalRManagementClientContext } from "../signalRManagementClientContext"; +import { SignalRManagementClient } from "../signalRManagementClient"; +import { + Operation, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; -/** Class representing a Operations. */ -export class Operations { - private readonly client: SignalRManagementClientContext; +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: SignalRManagementClient; /** - * Create a Operations. - * @param {SignalRManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client */ - constructor(client: SignalRManagementClientContext) { + constructor(client: SignalRManagementClient) { this.client = client; } /** * Lists all of the available REST API operations of the Microsoft.SignalRService provider. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list( - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - list( - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { - return this.client.sendOperationRequest( - { - options + public list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); }, - listOperationSpec, - callback - ) as Promise; + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } } /** * Lists all of the available REST API operations of the Microsoft.SignalRService provider. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listNext( - nextPageLink: string, - options?: msRest.RequestOptionsBase - ): Promise; + private _list( + options?: OperationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listNext( - nextPageLink: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - listNext( - nextPageLink: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + private _listNext( + nextLink: string, + options?: OperationsListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback - ) as Promise; + { nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.SignalRService/operations", - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], - responses: { - 200: { - bodyMapper: Mappers.OperationList - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); -const listNextOperationSpec: msRest.OperationSpec = { +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.SignalRService/operations", httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [Parameters.nextPageLink], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], responses: { 200: { bodyMapper: Mappers.OperationList @@ -130,5 +114,24 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/signalr/arm-signalr/src/operations/signalR.ts b/sdk/signalr/arm-signalr/src/operations/signalR.ts index eca4f66c7fc..60791936b72 100644 --- a/sdk/signalr/arm-signalr/src/operations/signalR.ts +++ b/sdk/signalr/arm-signalr/src/operations/signalR.ts @@ -3,610 +3,737 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/signalRMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SignalR } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { SignalRManagementClientContext } from "../signalRManagementClientContext"; +import { SignalRManagementClient } from "../signalRManagementClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + SignalRResource, + SignalRListBySubscriptionNextOptionalParams, + SignalRListBySubscriptionOptionalParams, + SignalRListByResourceGroupNextOptionalParams, + SignalRListByResourceGroupOptionalParams, + NameAvailabilityParameters, + SignalRCheckNameAvailabilityOptionalParams, + SignalRCheckNameAvailabilityResponse, + SignalRListBySubscriptionResponse, + SignalRListByResourceGroupResponse, + SignalRGetOptionalParams, + SignalRGetResponse, + SignalRCreateOrUpdateOptionalParams, + SignalRCreateOrUpdateResponse, + SignalRDeleteOptionalParams, + SignalRUpdateOptionalParams, + SignalRUpdateResponse, + SignalRListKeysOptionalParams, + SignalRListKeysResponse, + RegenerateKeyParameters, + SignalRRegenerateKeyOptionalParams, + SignalRRegenerateKeyResponse, + SignalRRestartOptionalParams, + SignalRListSkusOptionalParams, + SignalRListSkusResponse, + SignalRListBySubscriptionNextResponse, + SignalRListByResourceGroupNextResponse +} from "../models"; -/** Class representing a SignalR. */ -export class SignalR { - private readonly client: SignalRManagementClientContext; +/// +/** Class containing SignalR operations. */ +export class SignalRImpl implements SignalR { + private readonly client: SignalRManagementClient; /** - * Create a SignalR. - * @param {SignalRManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class SignalR class. + * @param client Reference to the service client */ - constructor(client: SignalRManagementClientContext) { + constructor(client: SignalRManagementClient) { this.client = client; } + /** + * Handles requests to list all resources in a subscription. + * @param options The options parameters. + */ + public listBySubscription( + options?: SignalRListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listBySubscriptionPagingPage(options); + } + }; + } + + private async *listBySubscriptionPagingPage( + options?: SignalRListBySubscriptionOptionalParams + ): AsyncIterableIterator { + let result = await this._listBySubscription(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listBySubscriptionNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listBySubscriptionPagingAll( + options?: SignalRListBySubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + + /** + * Handles requests to list all resources in a resource group. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param options The options parameters. + */ + public listByResourceGroup( + resourceGroupName: string, + options?: SignalRListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByResourceGroupPagingPage(resourceGroupName, options); + } + }; + } + + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: SignalRListByResourceGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listByResourceGroup(resourceGroupName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByResourceGroupNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: SignalRListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + /** * Checks that the resource name is valid and is not already in use. * @param location the region * @param parameters Parameters supplied to the operation. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ checkNameAvailability( location: string, - parameters: Models.NameAvailabilityParameters, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param location the region - * @param parameters Parameters supplied to the operation. - * @param callback The callback - */ - checkNameAvailability( - location: string, - parameters: Models.NameAvailabilityParameters, - callback: msRest.ServiceCallback - ): void; - /** - * @param location the region - * @param parameters Parameters supplied to the operation. - * @param options The optional parameters - * @param callback The callback - */ - checkNameAvailability( - location: string, - parameters: Models.NameAvailabilityParameters, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - checkNameAvailability( - location: string, - parameters: Models.NameAvailabilityParameters, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + parameters: NameAvailabilityParameters, + options?: SignalRCheckNameAvailabilityOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - location, - parameters, - options - }, - checkNameAvailabilityOperationSpec, - callback - ) as Promise; + { location, parameters, options }, + checkNameAvailabilityOperationSpec + ); } /** * Handles requests to list all resources in a subscription. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listBySubscription( - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param callback The callback - */ - listBySubscription(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - listBySubscription( - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - listBySubscription( - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + private _listBySubscription( + options?: SignalRListBySubscriptionOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - options - }, - listBySubscriptionOperationSpec, - callback - ) as Promise; + { options }, + listBySubscriptionOperationSpec + ); } /** * Handles requests to list all resources in a resource group. - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param [options] The optional parameters - * @returns Promise + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param options The options parameters. */ - listByResourceGroup( + private _listByResourceGroup( resourceGroupName: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param callback The callback - */ - listByResourceGroup( - resourceGroupName: string, - callback: msRest.ServiceCallback - ): void; - /** - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param options The optional parameters - * @param callback The callback - */ - listByResourceGroup( - resourceGroupName: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - listByResourceGroup( - resourceGroupName: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + options?: SignalRListByResourceGroupOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - options - }, - listByResourceGroupOperationSpec, - callback - ) as Promise; + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); } /** * Get the resource and its properties. - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ get( resourceGroupName: string, resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param callback The callback - */ - get( - resourceGroupName: string, - resourceName: string, - callback: msRest.ServiceCallback - ): void; - /** - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param options The optional parameters - * @param callback The callback - */ - get( - resourceGroupName: string, - resourceName: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - get( - resourceGroupName: string, - resourceName: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + options?: SignalRGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - resourceName, - options - }, - getOperationSpec, - callback - ) as Promise; - } - - /** - * Create or update a resource. - * @param parameters Parameters for the create or update operation - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise - */ - createOrUpdate( - parameters: Models.SignalRResource, - resourceGroupName: string, - resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise { - return this.beginCreateOrUpdate( - parameters, - resourceGroupName, - resourceName, - options - ).then((lroPoller) => lroPoller.pollUntilFinished()) as Promise< - Models.SignalRCreateOrUpdateResponse - >; - } - - /** - * Operation to delete a resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise - */ - deleteMethod( - resourceGroupName: string, - resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise { - return this.beginDeleteMethod(resourceGroupName, resourceName, options).then((lroPoller) => - lroPoller.pollUntilFinished() + { resourceGroupName, resourceName, options }, + getOperationSpec ); } /** - * Operation to update an exiting resource. - * @param parameters Parameters for the update operation - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. + * Create or update a resource. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise + * @param parameters Parameters for the create or update operation + * @param options The options parameters. */ - update( - parameters: Models.SignalRResource, + async beginCreateOrUpdate( resourceGroupName: string, resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise { - return this.beginUpdate( + parameters: SignalRResource, + options?: SignalRCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + SignalRCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, resourceName, parameters, options }, + createOrUpdateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Create or update a resource. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param parameters Parameters for the create or update operation + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + resourceName: string, + parameters: SignalRResource, + options?: SignalRCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + resourceName, parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Operation to delete a resource. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + resourceName: string, + options?: SignalRDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, resourceName, options }, + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Operation to delete a resource. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + resourceName: string, + options?: SignalRDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( resourceGroupName, resourceName, options - ).then((lroPoller) => lroPoller.pollUntilFinished()) as Promise; + ); + return poller.pollUntilDone(); + } + + /** + * Operation to update an exiting resource. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param parameters Parameters for the update operation + * @param options The options parameters. + */ + async beginUpdate( + resourceGroupName: string, + resourceName: string, + parameters: SignalRResource, + options?: SignalRUpdateOptionalParams + ): Promise< + PollerLike, SignalRUpdateResponse> + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, resourceName, parameters, options }, + updateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Operation to update an exiting resource. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param parameters Parameters for the update operation + * @param options The options parameters. + */ + async beginUpdateAndWait( + resourceGroupName: string, + resourceName: string, + parameters: SignalRResource, + options?: SignalRUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate( + resourceGroupName, + resourceName, + parameters, + options + ); + return poller.pollUntilDone(); } /** * Get the access keys of the resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ listKeys( resourceGroupName: string, resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param callback The callback - */ - listKeys( - resourceGroupName: string, - resourceName: string, - callback: msRest.ServiceCallback - ): void; - /** - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param options The optional parameters - * @param callback The callback - */ - listKeys( - resourceGroupName: string, - resourceName: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - listKeys( - resourceGroupName: string, - resourceName: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + options?: SignalRListKeysOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - resourceName, - options - }, - listKeysOperationSpec, - callback - ) as Promise; + { resourceGroupName, resourceName, options }, + listKeysOperationSpec + ); } /** - * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at - * the same time. - * @param parameters Parameter that describes the Regenerate Key Operation. - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. + * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the + * same time. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise + * @param parameters Parameter that describes the Regenerate Key Operation. + * @param options The options parameters. */ - regenerateKey( - parameters: Models.RegenerateKeyParameters, + async beginRegenerateKey( resourceGroupName: string, resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise { - return this.beginRegenerateKey( + parameters: RegenerateKeyParameters, + options?: SignalRRegenerateKeyOptionalParams + ): Promise< + PollerLike< + PollOperationState, + SignalRRegenerateKeyResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, resourceName, parameters, options }, + regenerateKeyOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the + * same time. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param parameters Parameter that describes the Regenerate Key Operation. + * @param options The options parameters. + */ + async beginRegenerateKeyAndWait( + resourceGroupName: string, + resourceName: string, + parameters: RegenerateKeyParameters, + options?: SignalRRegenerateKeyOptionalParams + ): Promise { + const poller = await this.beginRegenerateKey( + resourceGroupName, + resourceName, parameters, + options + ); + return poller.pollUntilDone(); + } + + /** + * Operation to restart a resource. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + async beginRestart( + resourceGroupName: string, + resourceName: string, + options?: SignalRRestartOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, resourceName, options }, + restartOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Operation to restart a resource. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + async beginRestartAndWait( + resourceGroupName: string, + resourceName: string, + options?: SignalRRestartOptionalParams + ): Promise { + const poller = await this.beginRestart( resourceGroupName, resourceName, options - ).then((lroPoller) => lroPoller.pollUntilFinished()) as Promise< - Models.SignalRRegenerateKeyResponse - >; + ); + return poller.pollUntilDone(); } /** - * Operation to restart a resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. + * List all available skus of the resource. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - restart( + listSkus( resourceGroupName: string, resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise { - return this.beginRestart(resourceGroupName, resourceName, options).then((lroPoller) => - lroPoller.pollUntilFinished() - ); - } - - /** - * Create or update a resource. - * @param parameters Parameters for the create or update operation - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise - */ - beginCreateOrUpdate( - parameters: Models.SignalRResource, - resourceGroupName: string, - resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise { - return this.client.sendLRORequest( - { - parameters, - resourceGroupName, - resourceName, - options - }, - beginCreateOrUpdateOperationSpec, - options - ); - } - - /** - * Operation to delete a resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise - */ - beginDeleteMethod( - resourceGroupName: string, - resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - resourceName, - options - }, - beginDeleteMethodOperationSpec, - options - ); - } - - /** - * Operation to update an exiting resource. - * @param parameters Parameters for the update operation - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise - */ - beginUpdate( - parameters: Models.SignalRResource, - resourceGroupName: string, - resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise { - return this.client.sendLRORequest( - { - parameters, - resourceGroupName, - resourceName, - options - }, - beginUpdateOperationSpec, - options - ); - } - - /** - * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at - * the same time. - * @param parameters Parameter that describes the Regenerate Key Operation. - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise - */ - beginRegenerateKey( - parameters: Models.RegenerateKeyParameters, - resourceGroupName: string, - resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise { - return this.client.sendLRORequest( - { - parameters, - resourceGroupName, - resourceName, - options - }, - beginRegenerateKeyOperationSpec, - options - ); - } - - /** - * Operation to restart a resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise - */ - beginRestart( - resourceGroupName: string, - resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - resourceName, - options - }, - beginRestartOperationSpec, - options - ); - } - - /** - * Handles requests to list all resources in a subscription. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listBySubscriptionNext( - nextPageLink: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listBySubscriptionNext( - nextPageLink: string, - callback: msRest.ServiceCallback - ): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listBySubscriptionNext( - nextPageLink: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - listBySubscriptionNext( - nextPageLink: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + options?: SignalRListSkusOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listBySubscriptionNextOperationSpec, - callback - ) as Promise; + { resourceGroupName, resourceName, options }, + listSkusOperationSpec + ); } /** - * Handles requests to list all resources in a resource group. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * ListBySubscriptionNext + * @param nextLink The nextLink from the previous successful call to the ListBySubscription method. + * @param options The options parameters. */ - listByResourceGroupNext( - nextPageLink: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listByResourceGroupNext( - nextPageLink: string, - callback: msRest.ServiceCallback - ): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listByResourceGroupNext( - nextPageLink: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - listByResourceGroupNext( - nextPageLink: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + private _listBySubscriptionNext( + nextLink: string, + options?: SignalRListBySubscriptionNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listByResourceGroupNextOperationSpec, - callback - ) as Promise; + { nextLink, options }, + listBySubscriptionNextOperationSpec + ); + } + + /** + * ListByResourceGroupNext + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. + * @param options The options parameters. + */ + private _listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: SignalRListByResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const checkNameAvailabilityOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const checkNameAvailabilityOperationSpec: coreClient.OperationSpec = { path: - "subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability", - urlParameters: [Parameters.location, Parameters.subscriptionId], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.NameAvailabilityParameters, - required: true - } - }, + "/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability", + httpMethod: "POST", responses: { 200: { bodyMapper: Mappers.NameAvailability @@ -615,15 +742,21 @@ const checkNameAvailabilityOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.location, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", serializer }; - -const listBySubscriptionOperationSpec: msRest.OperationSpec = { +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/signalR", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/signalR", - urlParameters: [Parameters.subscriptionId], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], responses: { 200: { bodyMapper: Mappers.SignalRResourceList @@ -632,16 +765,15 @@ const listBySubscriptionOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], serializer }; - -const listByResourceGroupOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.SignalRResourceList @@ -650,16 +782,19 @@ const listByResourceGroupOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], serializer }; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", +const getOperationSpec: coreClient.OperationSpec = { path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceName], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.SignalRResource @@ -668,41 +803,20 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const listKeysOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/listKeys", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceName], queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], - responses: { - 200: { - bodyMapper: Mappers.SignalRKeys - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], serializer }; - -const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}", httpMethod: "PUT", - path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceName], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.SignalRResource, - required: true - } - }, responses: { 200: { bodyMapper: Mappers.SignalRResource @@ -710,107 +824,187 @@ const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { 201: { bodyMapper: Mappers.SignalRResource }, - 202: {}, + 202: { + bodyMapper: Mappers.SignalRResource + }, + 204: { + bodyMapper: Mappers.SignalRResource + }, default: { bodyMapper: Mappers.ErrorResponse } }, + requestBody: Parameters.parameters1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", serializer }; - -const beginDeleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", +const deleteOperationSpec: coreClient.OperationSpec = { path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceName], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}", + httpMethod: "DELETE", responses: { 200: {}, + 201: {}, 202: {}, 204: {}, default: { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], serializer }; - -const beginUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PATCH", +const updateOperationSpec: coreClient.OperationSpec = { path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceName], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.SignalRResource, - required: true - } - }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}", + httpMethod: "PATCH", responses: { 200: { bodyMapper: Mappers.SignalRResource }, - 202: {}, + 201: { + bodyMapper: Mappers.SignalRResource + }, + 202: { + bodyMapper: Mappers.SignalRResource + }, + 204: { + bodyMapper: Mappers.SignalRResource + }, default: { bodyMapper: Mappers.ErrorResponse } }, + requestBody: Parameters.parameters1, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", serializer }; - -const beginRegenerateKeyOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", +const listKeysOperationSpec: coreClient.OperationSpec = { path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/regenerateKey", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceName], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.RegenerateKeyParameters, - required: true - } - }, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/listKeys", + httpMethod: "POST", responses: { - 202: { + 200: { bodyMapper: Mappers.SignalRKeys }, default: { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], serializer }; - -const beginRestartOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", +const regenerateKeyOperationSpec: coreClient.OperationSpec = { path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/restart", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceName], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/regenerateKey", + httpMethod: "POST", responses: { + 200: { + bodyMapper: Mappers.SignalRKeys + }, + 201: { + bodyMapper: Mappers.SignalRKeys + }, + 202: { + bodyMapper: Mappers.SignalRKeys + }, + 204: { + bodyMapper: Mappers.SignalRKeys + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + requestBody: Parameters.parameters2, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const restartOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/restart", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, 202: {}, 204: {}, default: { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], serializer }; - -const listBySubscriptionNextOperationSpec: msRest.OperationSpec = { +const listSkusOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/skus", httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [Parameters.nextPageLink], + responses: { + 200: { + bodyMapper: Mappers.SkuList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySubscriptionNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.SignalRResourceList @@ -819,16 +1013,18 @@ const listBySubscriptionNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], serializer }; - -const listByResourceGroupNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [Parameters.nextPageLink], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.SignalRResourceList @@ -837,5 +1033,13 @@ const listByResourceGroupNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/signalr/arm-signalr/src/operations/signalRPrivateEndpointConnections.ts b/sdk/signalr/arm-signalr/src/operations/signalRPrivateEndpointConnections.ts index e8c26ec6804..112cf80a82f 100644 --- a/sdk/signalr/arm-signalr/src/operations/signalRPrivateEndpointConnections.ts +++ b/sdk/signalr/arm-signalr/src/operations/signalRPrivateEndpointConnections.ts @@ -3,135 +3,136 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/signalRPrivateEndpointConnectionsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SignalRPrivateEndpointConnections } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { SignalRManagementClientContext } from "../signalRManagementClientContext"; +import { SignalRManagementClient } from "../signalRManagementClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + PrivateEndpointConnection, + SignalRPrivateEndpointConnectionsListNextOptionalParams, + SignalRPrivateEndpointConnectionsListOptionalParams, + SignalRPrivateEndpointConnectionsListResponse, + SignalRPrivateEndpointConnectionsGetOptionalParams, + SignalRPrivateEndpointConnectionsGetResponse, + SignalRPrivateEndpointConnectionsUpdateOptionalParams, + SignalRPrivateEndpointConnectionsUpdateResponse, + SignalRPrivateEndpointConnectionsDeleteOptionalParams, + SignalRPrivateEndpointConnectionsListNextResponse +} from "../models"; -/** Class representing a SignalRPrivateEndpointConnections. */ -export class SignalRPrivateEndpointConnections { - private readonly client: SignalRManagementClientContext; +/// +/** Class containing SignalRPrivateEndpointConnections operations. */ +export class SignalRPrivateEndpointConnectionsImpl + implements SignalRPrivateEndpointConnections { + private readonly client: SignalRManagementClient; /** - * Create a SignalRPrivateEndpointConnections. - * @param {SignalRManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class SignalRPrivateEndpointConnections class. + * @param client Reference to the service client */ - constructor(client: SignalRManagementClientContext) { + constructor(client: SignalRManagementClient) { this.client = client; } /** * List private endpoint connections - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list( + public list( resourceGroupName: string, resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param callback The callback - */ - list( + options?: SignalRPrivateEndpointConnectionsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, resourceName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(resourceGroupName, resourceName, options); + } + }; + } + + private async *listPagingPage( resourceGroupName: string, resourceName: string, - callback: msRest.ServiceCallback - ): void; - /** - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param options The optional parameters - * @param callback The callback - */ - list( - resourceGroupName: string, - resourceName: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - list( - resourceGroupName: string, - resourceName: string, - options?: - | msRest.RequestOptionsBase - | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { - return this.client.sendOperationRequest( - { + options?: SignalRPrivateEndpointConnectionsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(resourceGroupName, resourceName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext( resourceGroupName, resourceName, + continuationToken, options - }, - listOperationSpec, - callback - ) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + resourceGroupName: string, + resourceName: string, + options?: SignalRPrivateEndpointConnectionsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + resourceName, + options + )) { + yield* page; + } + } + + /** + * List private endpoint connections + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + resourceName: string, + options?: SignalRPrivateEndpointConnectionsListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, options }, + listOperationSpec + ); } /** * Get the specified private endpoint connection * @param privateEndpointConnectionName The name of the private endpoint connection - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ get( privateEndpointConnectionName: string, resourceGroupName: string, resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param privateEndpointConnectionName The name of the private endpoint connection - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param callback The callback - */ - get( - privateEndpointConnectionName: string, - resourceGroupName: string, - resourceName: string, - callback: msRest.ServiceCallback - ): void; - /** - * @param privateEndpointConnectionName The name of the private endpoint connection - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param options The optional parameters - * @param callback The callback - */ - get( - privateEndpointConnectionName: string, - resourceGroupName: string, - resourceName: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - get( - privateEndpointConnectionName: string, - resourceGroupName: string, - resourceName: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + options?: SignalRPrivateEndpointConnectionsGetOptionalParams + ): Promise { return this.client.sendOperationRequest( { privateEndpointConnectionName, @@ -139,186 +140,157 @@ export class SignalRPrivateEndpointConnections { resourceName, options }, - getOperationSpec, - callback - ) as Promise; + getOperationSpec + ); } /** * Update the state of specified private endpoint connection * @param privateEndpointConnectionName The name of the private endpoint connection - * @param parameters The resource of private endpoint and its properties - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise + * @param parameters The resource of private endpoint and its properties + * @param options The options parameters. */ update( privateEndpointConnectionName: string, - parameters: Models.PrivateEndpointConnection, resourceGroupName: string, resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param privateEndpointConnectionName The name of the private endpoint connection - * @param parameters The resource of private endpoint and its properties - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param callback The callback - */ - update( - privateEndpointConnectionName: string, - parameters: Models.PrivateEndpointConnection, - resourceGroupName: string, - resourceName: string, - callback: msRest.ServiceCallback - ): void; - /** - * @param privateEndpointConnectionName The name of the private endpoint connection - * @param parameters The resource of private endpoint and its properties - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param options The optional parameters - * @param callback The callback - */ - update( - privateEndpointConnectionName: string, - parameters: Models.PrivateEndpointConnection, - resourceGroupName: string, - resourceName: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - update( - privateEndpointConnectionName: string, - parameters: Models.PrivateEndpointConnection, - resourceGroupName: string, - resourceName: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + parameters: PrivateEndpointConnection, + options?: SignalRPrivateEndpointConnectionsUpdateOptionalParams + ): Promise { return this.client.sendOperationRequest( { privateEndpointConnectionName, + resourceGroupName, + resourceName, parameters, - resourceGroupName, - resourceName, options }, - updateOperationSpec, - callback - ) as Promise; - } - - /** - * Delete the specified private endpoint connection - * @param privateEndpointConnectionName The name of the private endpoint connection - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise - */ - deleteMethod( - privateEndpointConnectionName: string, - resourceGroupName: string, - resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise { - return this.beginDeleteMethod( - privateEndpointConnectionName, - resourceGroupName, - resourceName, - options - ).then((lroPoller) => lroPoller.pollUntilFinished()); - } - - /** - * Delete the specified private endpoint connection - * @param privateEndpointConnectionName The name of the private endpoint connection - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise - */ - beginDeleteMethod( - privateEndpointConnectionName: string, - resourceGroupName: string, - resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise { - return this.client.sendLRORequest( - { - privateEndpointConnectionName, - resourceGroupName, - resourceName, - options - }, - beginDeleteMethodOperationSpec, - options + updateOperationSpec ); } /** - * List private endpoint connections - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * Delete the specified private endpoint connection + * @param privateEndpointConnectionName The name of the private endpoint connection + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. */ - listNext( - nextPageLink: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext( - nextPageLink: string, - callback: msRest.ServiceCallback - ): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listNext( - nextPageLink: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - listNext( - nextPageLink: string, - options?: - | msRest.RequestOptionsBase - | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { - return this.client.sendOperationRequest( + async beginDelete( + privateEndpointConnectionName: string, + resourceGroupName: string, + resourceName: string, + options?: SignalRPrivateEndpointConnectionsDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, { - nextPageLink, + privateEndpointConnectionName, + resourceGroupName, + resourceName, options }, - listNextOperationSpec, - callback - ) as Promise; + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Delete the specified private endpoint connection + * @param privateEndpointConnectionName The name of the private endpoint connection + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + async beginDeleteAndWait( + privateEndpointConnectionName: string, + resourceGroupName: string, + resourceName: string, + options?: SignalRPrivateEndpointConnectionsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + privateEndpointConnectionName, + resourceGroupName, + resourceName, + options + ); + return poller.pollUntilDone(); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + resourceName: string, + nextLink: string, + options?: SignalRPrivateEndpointConnectionsListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceName], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.PrivateEndpointConnectionList @@ -327,21 +299,20 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], serializer }; - -const getOperationSpec: msRest.OperationSpec = { +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", httpMethod: "GET", - path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", - urlParameters: [ - Parameters.privateEndpointConnectionName, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName - ], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], responses: { 200: { bodyMapper: Mappers.PrivateEndpointConnection @@ -350,28 +321,21 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName, + Parameters.privateEndpointConnectionName + ], + headerParameters: [Parameters.accept], serializer }; - -const updateOperationSpec: msRest.OperationSpec = { +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", httpMethod: "PUT", - path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", - urlParameters: [ - Parameters.privateEndpointConnectionName, - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.resourceName - ], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.PrivateEndpointConnection, - required: true - } - }, responses: { 200: { bodyMapper: Mappers.PrivateEndpointConnection @@ -380,39 +344,46 @@ const updateOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const beginDeleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + requestBody: Parameters.parameters3, + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.privateEndpointConnectionName, + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.resourceName + Parameters.resourceName, + Parameters.privateEndpointConnectionName ], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", + httpMethod: "DELETE", responses: { 200: {}, + 201: {}, 202: {}, 204: {}, default: { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName, + Parameters.privateEndpointConnectionName + ], + headerParameters: [Parameters.accept], serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [Parameters.nextPageLink], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.PrivateEndpointConnectionList @@ -421,5 +392,14 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/signalr/arm-signalr/src/operations/signalRPrivateLinkResources.ts b/sdk/signalr/arm-signalr/src/operations/signalRPrivateLinkResources.ts index 4a2b0e86aed..08bfbcadd4c 100644 --- a/sdk/signalr/arm-signalr/src/operations/signalRPrivateLinkResources.ts +++ b/sdk/signalr/arm-signalr/src/operations/signalRPrivateLinkResources.ts @@ -3,153 +3,142 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/signalRPrivateLinkResourcesMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SignalRPrivateLinkResources } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { SignalRManagementClientContext } from "../signalRManagementClientContext"; +import { SignalRManagementClient } from "../signalRManagementClient"; +import { + PrivateLinkResource, + SignalRPrivateLinkResourcesListNextOptionalParams, + SignalRPrivateLinkResourcesListOptionalParams, + SignalRPrivateLinkResourcesListResponse, + SignalRPrivateLinkResourcesListNextResponse +} from "../models"; -/** Class representing a SignalRPrivateLinkResources. */ -export class SignalRPrivateLinkResources { - private readonly client: SignalRManagementClientContext; +/// +/** Class containing SignalRPrivateLinkResources operations. */ +export class SignalRPrivateLinkResourcesImpl + implements SignalRPrivateLinkResources { + private readonly client: SignalRManagementClient; /** - * Create a SignalRPrivateLinkResources. - * @param {SignalRManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class SignalRPrivateLinkResources class. + * @param client Reference to the service client */ - constructor(client: SignalRManagementClientContext) { + constructor(client: SignalRManagementClient) { this.client = client; } /** * Get the private link resources that need to be created for a resource. - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list( + public list( resourceGroupName: string, resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param callback The callback - */ - list( + options?: SignalRPrivateLinkResourcesListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, resourceName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(resourceGroupName, resourceName, options); + } + }; + } + + private async *listPagingPage( resourceGroupName: string, resourceName: string, - callback: msRest.ServiceCallback - ): void; - /** - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param options The optional parameters - * @param callback The callback - */ - list( - resourceGroupName: string, - resourceName: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - list( - resourceGroupName: string, - resourceName: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { - return this.client.sendOperationRequest( - { + options?: SignalRPrivateLinkResourcesListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(resourceGroupName, resourceName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext( resourceGroupName, resourceName, + continuationToken, options - }, - listOperationSpec, - callback - ) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + resourceGroupName: string, + resourceName: string, + options?: SignalRPrivateLinkResourcesListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + resourceName, + options + )) { + yield* page; + } } /** * Get the private link resources that need to be created for a resource. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. */ - listNext( - nextPageLink: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext( - nextPageLink: string, - callback: msRest.ServiceCallback - ): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listNext( - nextPageLink: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - listNext( - nextPageLink: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + private _list( + resourceGroupName: string, + resourceName: string, + options?: SignalRPrivateLinkResourcesListOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback - ) as Promise; + { resourceGroupName, resourceName, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + resourceGroupName: string, + resourceName: string, + nextLink: string, + options?: SignalRPrivateLinkResourcesListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateLinkResources", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceName], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], - responses: { - 200: { - bodyMapper: Mappers.PrivateLinkResourceList - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); -const listNextOperationSpec: msRest.OperationSpec = { +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateLinkResources", httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [Parameters.nextPageLink], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], responses: { 200: { bodyMapper: Mappers.PrivateLinkResourceList @@ -158,5 +147,35 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PrivateLinkResourceList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/signalr/arm-signalr/src/operations/signalRSharedPrivateLinkResources.ts b/sdk/signalr/arm-signalr/src/operations/signalRSharedPrivateLinkResources.ts index 8f55d84f534..cd015c1b42d 100644 --- a/sdk/signalr/arm-signalr/src/operations/signalRSharedPrivateLinkResources.ts +++ b/sdk/signalr/arm-signalr/src/operations/signalRSharedPrivateLinkResources.ts @@ -3,135 +3,136 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/signalRSharedPrivateLinkResourcesMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SignalRSharedPrivateLinkResources } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { SignalRManagementClientContext } from "../signalRManagementClientContext"; +import { SignalRManagementClient } from "../signalRManagementClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + SharedPrivateLinkResource, + SignalRSharedPrivateLinkResourcesListNextOptionalParams, + SignalRSharedPrivateLinkResourcesListOptionalParams, + SignalRSharedPrivateLinkResourcesListResponse, + SignalRSharedPrivateLinkResourcesGetOptionalParams, + SignalRSharedPrivateLinkResourcesGetResponse, + SignalRSharedPrivateLinkResourcesCreateOrUpdateOptionalParams, + SignalRSharedPrivateLinkResourcesCreateOrUpdateResponse, + SignalRSharedPrivateLinkResourcesDeleteOptionalParams, + SignalRSharedPrivateLinkResourcesListNextResponse +} from "../models"; -/** Class representing a SignalRSharedPrivateLinkResources. */ -export class SignalRSharedPrivateLinkResources { - private readonly client: SignalRManagementClientContext; +/// +/** Class containing SignalRSharedPrivateLinkResources operations. */ +export class SignalRSharedPrivateLinkResourcesImpl + implements SignalRSharedPrivateLinkResources { + private readonly client: SignalRManagementClient; /** - * Create a SignalRSharedPrivateLinkResources. - * @param {SignalRManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class SignalRSharedPrivateLinkResources class. + * @param client Reference to the service client */ - constructor(client: SignalRManagementClientContext) { + constructor(client: SignalRManagementClient) { this.client = client; } /** * List shared private link resources - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list( + public list( resourceGroupName: string, resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param callback The callback - */ - list( + options?: SignalRSharedPrivateLinkResourcesListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(resourceGroupName, resourceName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(resourceGroupName, resourceName, options); + } + }; + } + + private async *listPagingPage( resourceGroupName: string, resourceName: string, - callback: msRest.ServiceCallback - ): void; - /** - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param options The optional parameters - * @param callback The callback - */ - list( - resourceGroupName: string, - resourceName: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - list( - resourceGroupName: string, - resourceName: string, - options?: - | msRest.RequestOptionsBase - | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { - return this.client.sendOperationRequest( - { + options?: SignalRSharedPrivateLinkResourcesListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(resourceGroupName, resourceName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext( resourceGroupName, resourceName, + continuationToken, options - }, - listOperationSpec, - callback - ) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + resourceGroupName: string, + resourceName: string, + options?: SignalRSharedPrivateLinkResourcesListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage( + resourceGroupName, + resourceName, + options + )) { + yield* page; + } + } + + /** + * List shared private link resources + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + private _list( + resourceGroupName: string, + resourceName: string, + options?: SignalRSharedPrivateLinkResourcesListOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, resourceName, options }, + listOperationSpec + ); } /** * Get the specified shared private link resource * @param sharedPrivateLinkResourceName The name of the shared private link resource - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ get( sharedPrivateLinkResourceName: string, resourceGroupName: string, resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param sharedPrivateLinkResourceName The name of the shared private link resource - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param callback The callback - */ - get( - sharedPrivateLinkResourceName: string, - resourceGroupName: string, - resourceName: string, - callback: msRest.ServiceCallback - ): void; - /** - * @param sharedPrivateLinkResourceName The name of the shared private link resource - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param options The optional parameters - * @param callback The callback - */ - get( - sharedPrivateLinkResourceName: string, - resourceGroupName: string, - resourceName: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - get( - sharedPrivateLinkResourceName: string, - resourceGroupName: string, - resourceName: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + options?: SignalRSharedPrivateLinkResourcesGetOptionalParams + ): Promise { return this.client.sendOperationRequest( { sharedPrivateLinkResourceName, @@ -139,174 +140,234 @@ export class SignalRSharedPrivateLinkResources { resourceName, options }, - getOperationSpec, - callback - ) as Promise; + getOperationSpec + ); } /** * Create or update a shared private link resource * @param sharedPrivateLinkResourceName The name of the shared private link resource + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. * @param parameters The shared private link resource - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - createOrUpdate( + async beginCreateOrUpdate( sharedPrivateLinkResourceName: string, - parameters: Models.SharedPrivateLinkResource, resourceGroupName: string, resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise { - return this.beginCreateOrUpdate( - sharedPrivateLinkResourceName, - parameters, - resourceGroupName, - resourceName, - options - ).then((lroPoller) => lroPoller.pollUntilFinished()) as Promise< - Models.SignalRSharedPrivateLinkResourcesCreateOrUpdateResponse - >; - } + parameters: SharedPrivateLinkResource, + options?: SignalRSharedPrivateLinkResourcesCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState< + SignalRSharedPrivateLinkResourcesCreateOrUpdateResponse + >, + SignalRSharedPrivateLinkResourcesCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; - /** - * Delete the specified shared private link resource - * @param sharedPrivateLinkResourceName The name of the shared private link resource - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise - */ - deleteMethod( - sharedPrivateLinkResourceName: string, - resourceGroupName: string, - resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise { - return this.beginDeleteMethod( - sharedPrivateLinkResourceName, - resourceGroupName, - resourceName, - options - ).then((lroPoller) => lroPoller.pollUntilFinished()); - } - - /** - * Create or update a shared private link resource - * @param sharedPrivateLinkResourceName The name of the shared private link resource - * @param parameters The shared private link resource - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. - * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise - */ - beginCreateOrUpdate( - sharedPrivateLinkResourceName: string, - parameters: Models.SharedPrivateLinkResource, - resourceGroupName: string, - resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise { - return this.client.sendLRORequest( + const lro = new LroImpl( + sendOperation, { sharedPrivateLinkResourceName, + resourceGroupName, + resourceName, parameters, - resourceGroupName, - resourceName, options }, - beginCreateOrUpdateOperationSpec, + createOrUpdateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Create or update a shared private link resource + * @param sharedPrivateLinkResourceName The name of the shared private link resource + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param parameters The shared private link resource + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + sharedPrivateLinkResourceName: string, + resourceGroupName: string, + resourceName: string, + parameters: SharedPrivateLinkResource, + options?: SignalRSharedPrivateLinkResourcesCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + sharedPrivateLinkResourceName, + resourceGroupName, + resourceName, + parameters, options ); + return poller.pollUntilDone(); } /** * Delete the specified shared private link resource * @param sharedPrivateLinkResourceName The name of the shared private link resource - * @param resourceGroupName The name of the resource group that contains the resource. You can - * obtain this value from the Azure Resource Manager API or the portal. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. * @param resourceName The name of the resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginDeleteMethod( + async beginDelete( sharedPrivateLinkResourceName: string, resourceGroupName: string, resourceName: string, - options?: msRest.RequestOptionsBase - ): Promise { - return this.client.sendLRORequest( + options?: SignalRSharedPrivateLinkResourcesDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, { sharedPrivateLinkResourceName, resourceGroupName, resourceName, options }, - beginDeleteMethodOperationSpec, - options + deleteOperationSpec ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** - * List shared private link resources - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * Delete the specified shared private link resource + * @param sharedPrivateLinkResourceName The name of the shared private link resource + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. */ - listNext( - nextPageLink: string, - options?: msRest.RequestOptionsBase - ): Promise; + async beginDeleteAndWait( + sharedPrivateLinkResourceName: string, + resourceGroupName: string, + resourceName: string, + options?: SignalRSharedPrivateLinkResourcesDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + sharedPrivateLinkResourceName, + resourceGroupName, + resourceName, + options + ); + return poller.pollUntilDone(); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * ListNext + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext( - nextPageLink: string, - callback: msRest.ServiceCallback - ): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listNext( - nextPageLink: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - listNext( - nextPageLink: string, - options?: - | msRest.RequestOptionsBase - | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + private _listNext( + resourceGroupName: string, + resourceName: string, + nextLink: string, + options?: SignalRSharedPrivateLinkResourcesListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback - ) as Promise; + { resourceGroupName, resourceName, nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources", - urlParameters: [Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceName], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.SharedPrivateLinkResourceList @@ -315,21 +376,20 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.sharedPrivateLinkResourceName, + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.resourceName ], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.SharedPrivateLinkResource @@ -338,28 +398,21 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.sharedPrivateLinkResourceName, + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.resourceName + Parameters.resourceName, + Parameters.sharedPrivateLinkResourceName ], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.SharedPrivateLinkResource, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", + httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.SharedPrivateLinkResource @@ -367,43 +420,56 @@ const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { 201: { bodyMapper: Mappers.SharedPrivateLinkResource }, + 202: { + bodyMapper: Mappers.SharedPrivateLinkResource + }, + 204: { + bodyMapper: Mappers.SharedPrivateLinkResource + }, default: { bodyMapper: Mappers.ErrorResponse } }, - serializer -}; - -const beginDeleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: - "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", + requestBody: Parameters.parameters4, + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.sharedPrivateLinkResourceName, + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.resourceName + Parameters.resourceName, + Parameters.sharedPrivateLinkResourceName ], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", + httpMethod: "DELETE", responses: { 200: {}, + 201: {}, 202: {}, 204: {}, default: { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName, + Parameters.sharedPrivateLinkResourceName + ], + headerParameters: [Parameters.accept], serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [Parameters.nextPageLink], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.SharedPrivateLinkResourceList @@ -412,5 +478,14 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.resourceName + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/signalr/arm-signalr/src/operations/usages.ts b/sdk/signalr/arm-signalr/src/operations/usages.ts index f3fddd23464..6cc94603fb5 100644 --- a/sdk/signalr/arm-signalr/src/operations/usages.ts +++ b/sdk/signalr/arm-signalr/src/operations/usages.ts @@ -3,133 +3,121 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/usagesMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Usages } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { SignalRManagementClientContext } from "../signalRManagementClientContext"; +import { SignalRManagementClient } from "../signalRManagementClient"; +import { + SignalRUsage, + UsagesListNextOptionalParams, + UsagesListOptionalParams, + UsagesListResponse, + UsagesListNextResponse +} from "../models"; -/** Class representing a Usages. */ -export class Usages { - private readonly client: SignalRManagementClientContext; +/// +/** Class containing Usages operations. */ +export class UsagesImpl implements Usages { + private readonly client: SignalRManagementClient; /** - * Create a Usages. - * @param {SignalRManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class Usages class. + * @param client Reference to the service client */ - constructor(client: SignalRManagementClientContext) { + constructor(client: SignalRManagementClient) { this.client = client; } /** * List resource usage quotas by location. * @param location the location like "eastus" - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(location: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param location the location like "eastus" - * @param callback The callback - */ - list(location: string, callback: msRest.ServiceCallback): void; - /** - * @param location the location like "eastus" - * @param options The optional parameters - * @param callback The callback - */ - list( + public list( location: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - list( - location: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { - return this.client.sendOperationRequest( - { - location, - options + options?: UsagesListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(location, options); + return { + next() { + return iter.next(); }, - listOperationSpec, - callback - ) as Promise; + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(location, options); + } + }; + } + + private async *listPagingPage( + location: string, + options?: UsagesListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(location, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(location, continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + location: string, + options?: UsagesListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(location, options)) { + yield* page; + } } /** * List resource usage quotas by location. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * @param location the location like "eastus" + * @param options The options parameters. */ - listNext( - nextPageLink: string, - options?: msRest.RequestOptionsBase - ): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listNext( - nextPageLink: string, - options: msRest.RequestOptionsBase, - callback: msRest.ServiceCallback - ): void; - listNext( - nextPageLink: string, - options?: msRest.RequestOptionsBase | msRest.ServiceCallback, - callback?: msRest.ServiceCallback - ): Promise { + private _list( + location: string, + options?: UsagesListOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback - ) as Promise; + { location, options }, + listOperationSpec + ); + } + + /** + * ListNext + * @param location the location like "eastus" + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. + */ + private _listNext( + location: string, + nextLink: string, + options?: UsagesListNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { location, nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: - "subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/usages", - urlParameters: [Parameters.location, Parameters.subscriptionId], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], - responses: { - 200: { - bodyMapper: Mappers.SignalRUsageList - }, - default: { - bodyMapper: Mappers.ErrorResponse - } - }, - serializer -}; +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); -const listNextOperationSpec: msRest.OperationSpec = { +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/usages", httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [Parameters.nextPageLink], - queryParameters: [Parameters.apiVersion], - headerParameters: [Parameters.acceptLanguage], responses: { 200: { bodyMapper: Mappers.SignalRUsageList @@ -138,5 +126,33 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.ErrorResponse } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.location, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.SignalRUsageList + }, + default: { + bodyMapper: Mappers.ErrorResponse + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.location, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/signalr/arm-signalr/src/operationsInterfaces/index.ts b/sdk/signalr/arm-signalr/src/operationsInterfaces/index.ts new file mode 100644 index 00000000000..1a3c5a69526 --- /dev/null +++ b/sdk/signalr/arm-signalr/src/operationsInterfaces/index.ts @@ -0,0 +1,14 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./operations"; +export * from "./signalR"; +export * from "./usages"; +export * from "./signalRPrivateEndpointConnections"; +export * from "./signalRPrivateLinkResources"; +export * from "./signalRSharedPrivateLinkResources"; diff --git a/sdk/signalr/arm-signalr/src/operationsInterfaces/operations.ts b/sdk/signalr/arm-signalr/src/operationsInterfaces/operations.ts new file mode 100644 index 00000000000..df52586abc3 --- /dev/null +++ b/sdk/signalr/arm-signalr/src/operationsInterfaces/operations.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operation, OperationsListOptionalParams } from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * Lists all of the available REST API operations of the Microsoft.SignalRService provider. + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/signalr/arm-signalr/src/operationsInterfaces/signalR.ts b/sdk/signalr/arm-signalr/src/operationsInterfaces/signalR.ts new file mode 100644 index 00000000000..ef2f03693cf --- /dev/null +++ b/sdk/signalr/arm-signalr/src/operationsInterfaces/signalR.ts @@ -0,0 +1,248 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + SignalRResource, + SignalRListBySubscriptionOptionalParams, + SignalRListByResourceGroupOptionalParams, + NameAvailabilityParameters, + SignalRCheckNameAvailabilityOptionalParams, + SignalRCheckNameAvailabilityResponse, + SignalRGetOptionalParams, + SignalRGetResponse, + SignalRCreateOrUpdateOptionalParams, + SignalRCreateOrUpdateResponse, + SignalRDeleteOptionalParams, + SignalRUpdateOptionalParams, + SignalRUpdateResponse, + SignalRListKeysOptionalParams, + SignalRListKeysResponse, + RegenerateKeyParameters, + SignalRRegenerateKeyOptionalParams, + SignalRRegenerateKeyResponse, + SignalRRestartOptionalParams, + SignalRListSkusOptionalParams, + SignalRListSkusResponse +} from "../models"; + +/// +/** Interface representing a SignalR. */ +export interface SignalR { + /** + * Handles requests to list all resources in a subscription. + * @param options The options parameters. + */ + listBySubscription( + options?: SignalRListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * Handles requests to list all resources in a resource group. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: SignalRListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Checks that the resource name is valid and is not already in use. + * @param location the region + * @param parameters Parameters supplied to the operation. + * @param options The options parameters. + */ + checkNameAvailability( + location: string, + parameters: NameAvailabilityParameters, + options?: SignalRCheckNameAvailabilityOptionalParams + ): Promise; + /** + * Get the resource and its properties. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + resourceName: string, + options?: SignalRGetOptionalParams + ): Promise; + /** + * Create or update a resource. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param parameters Parameters for the create or update operation + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + resourceName: string, + parameters: SignalRResource, + options?: SignalRCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + SignalRCreateOrUpdateResponse + > + >; + /** + * Create or update a resource. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param parameters Parameters for the create or update operation + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + resourceName: string, + parameters: SignalRResource, + options?: SignalRCreateOrUpdateOptionalParams + ): Promise; + /** + * Operation to delete a resource. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + resourceName: string, + options?: SignalRDeleteOptionalParams + ): Promise, void>>; + /** + * Operation to delete a resource. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + resourceName: string, + options?: SignalRDeleteOptionalParams + ): Promise; + /** + * Operation to update an exiting resource. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param parameters Parameters for the update operation + * @param options The options parameters. + */ + beginUpdate( + resourceGroupName: string, + resourceName: string, + parameters: SignalRResource, + options?: SignalRUpdateOptionalParams + ): Promise< + PollerLike, SignalRUpdateResponse> + >; + /** + * Operation to update an exiting resource. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param parameters Parameters for the update operation + * @param options The options parameters. + */ + beginUpdateAndWait( + resourceGroupName: string, + resourceName: string, + parameters: SignalRResource, + options?: SignalRUpdateOptionalParams + ): Promise; + /** + * Get the access keys of the resource. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + listKeys( + resourceGroupName: string, + resourceName: string, + options?: SignalRListKeysOptionalParams + ): Promise; + /** + * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the + * same time. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param parameters Parameter that describes the Regenerate Key Operation. + * @param options The options parameters. + */ + beginRegenerateKey( + resourceGroupName: string, + resourceName: string, + parameters: RegenerateKeyParameters, + options?: SignalRRegenerateKeyOptionalParams + ): Promise< + PollerLike< + PollOperationState, + SignalRRegenerateKeyResponse + > + >; + /** + * Regenerate the access key for the resource. PrimaryKey and SecondaryKey cannot be regenerated at the + * same time. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param parameters Parameter that describes the Regenerate Key Operation. + * @param options The options parameters. + */ + beginRegenerateKeyAndWait( + resourceGroupName: string, + resourceName: string, + parameters: RegenerateKeyParameters, + options?: SignalRRegenerateKeyOptionalParams + ): Promise; + /** + * Operation to restart a resource. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + beginRestart( + resourceGroupName: string, + resourceName: string, + options?: SignalRRestartOptionalParams + ): Promise, void>>; + /** + * Operation to restart a resource. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + beginRestartAndWait( + resourceGroupName: string, + resourceName: string, + options?: SignalRRestartOptionalParams + ): Promise; + /** + * List all available skus of the resource. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + listSkus( + resourceGroupName: string, + resourceName: string, + options?: SignalRListSkusOptionalParams + ): Promise; +} diff --git a/sdk/signalr/arm-signalr/src/operationsInterfaces/signalRPrivateEndpointConnections.ts b/sdk/signalr/arm-signalr/src/operationsInterfaces/signalRPrivateEndpointConnections.ts new file mode 100644 index 00000000000..4abfc430113 --- /dev/null +++ b/sdk/signalr/arm-signalr/src/operationsInterfaces/signalRPrivateEndpointConnections.ts @@ -0,0 +1,94 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + PrivateEndpointConnection, + SignalRPrivateEndpointConnectionsListOptionalParams, + SignalRPrivateEndpointConnectionsGetOptionalParams, + SignalRPrivateEndpointConnectionsGetResponse, + SignalRPrivateEndpointConnectionsUpdateOptionalParams, + SignalRPrivateEndpointConnectionsUpdateResponse, + SignalRPrivateEndpointConnectionsDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a SignalRPrivateEndpointConnections. */ +export interface SignalRPrivateEndpointConnections { + /** + * List private endpoint connections + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + resourceName: string, + options?: SignalRPrivateEndpointConnectionsListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get the specified private endpoint connection + * @param privateEndpointConnectionName The name of the private endpoint connection + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + get( + privateEndpointConnectionName: string, + resourceGroupName: string, + resourceName: string, + options?: SignalRPrivateEndpointConnectionsGetOptionalParams + ): Promise; + /** + * Update the state of specified private endpoint connection + * @param privateEndpointConnectionName The name of the private endpoint connection + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param parameters The resource of private endpoint and its properties + * @param options The options parameters. + */ + update( + privateEndpointConnectionName: string, + resourceGroupName: string, + resourceName: string, + parameters: PrivateEndpointConnection, + options?: SignalRPrivateEndpointConnectionsUpdateOptionalParams + ): Promise; + /** + * Delete the specified private endpoint connection + * @param privateEndpointConnectionName The name of the private endpoint connection + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + beginDelete( + privateEndpointConnectionName: string, + resourceGroupName: string, + resourceName: string, + options?: SignalRPrivateEndpointConnectionsDeleteOptionalParams + ): Promise, void>>; + /** + * Delete the specified private endpoint connection + * @param privateEndpointConnectionName The name of the private endpoint connection + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + beginDeleteAndWait( + privateEndpointConnectionName: string, + resourceGroupName: string, + resourceName: string, + options?: SignalRPrivateEndpointConnectionsDeleteOptionalParams + ): Promise; +} diff --git a/sdk/signalr/arm-signalr/src/operationsInterfaces/signalRPrivateLinkResources.ts b/sdk/signalr/arm-signalr/src/operationsInterfaces/signalRPrivateLinkResources.ts new file mode 100644 index 00000000000..fc877b50253 --- /dev/null +++ b/sdk/signalr/arm-signalr/src/operationsInterfaces/signalRPrivateLinkResources.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + PrivateLinkResource, + SignalRPrivateLinkResourcesListOptionalParams +} from "../models"; + +/// +/** Interface representing a SignalRPrivateLinkResources. */ +export interface SignalRPrivateLinkResources { + /** + * Get the private link resources that need to be created for a resource. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + resourceName: string, + options?: SignalRPrivateLinkResourcesListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/signalr/arm-signalr/src/operationsInterfaces/signalRSharedPrivateLinkResources.ts b/sdk/signalr/arm-signalr/src/operationsInterfaces/signalRSharedPrivateLinkResources.ts new file mode 100644 index 00000000000..9f8bef4cdd7 --- /dev/null +++ b/sdk/signalr/arm-signalr/src/operationsInterfaces/signalRSharedPrivateLinkResources.ts @@ -0,0 +1,117 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + SharedPrivateLinkResource, + SignalRSharedPrivateLinkResourcesListOptionalParams, + SignalRSharedPrivateLinkResourcesGetOptionalParams, + SignalRSharedPrivateLinkResourcesGetResponse, + SignalRSharedPrivateLinkResourcesCreateOrUpdateOptionalParams, + SignalRSharedPrivateLinkResourcesCreateOrUpdateResponse, + SignalRSharedPrivateLinkResourcesDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a SignalRSharedPrivateLinkResources. */ +export interface SignalRSharedPrivateLinkResources { + /** + * List shared private link resources + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + list( + resourceGroupName: string, + resourceName: string, + options?: SignalRSharedPrivateLinkResourcesListOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get the specified shared private link resource + * @param sharedPrivateLinkResourceName The name of the shared private link resource + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + get( + sharedPrivateLinkResourceName: string, + resourceGroupName: string, + resourceName: string, + options?: SignalRSharedPrivateLinkResourcesGetOptionalParams + ): Promise; + /** + * Create or update a shared private link resource + * @param sharedPrivateLinkResourceName The name of the shared private link resource + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param parameters The shared private link resource + * @param options The options parameters. + */ + beginCreateOrUpdate( + sharedPrivateLinkResourceName: string, + resourceGroupName: string, + resourceName: string, + parameters: SharedPrivateLinkResource, + options?: SignalRSharedPrivateLinkResourcesCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState< + SignalRSharedPrivateLinkResourcesCreateOrUpdateResponse + >, + SignalRSharedPrivateLinkResourcesCreateOrUpdateResponse + > + >; + /** + * Create or update a shared private link resource + * @param sharedPrivateLinkResourceName The name of the shared private link resource + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param parameters The shared private link resource + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + sharedPrivateLinkResourceName: string, + resourceGroupName: string, + resourceName: string, + parameters: SharedPrivateLinkResource, + options?: SignalRSharedPrivateLinkResourcesCreateOrUpdateOptionalParams + ): Promise; + /** + * Delete the specified shared private link resource + * @param sharedPrivateLinkResourceName The name of the shared private link resource + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + beginDelete( + sharedPrivateLinkResourceName: string, + resourceGroupName: string, + resourceName: string, + options?: SignalRSharedPrivateLinkResourcesDeleteOptionalParams + ): Promise, void>>; + /** + * Delete the specified shared private link resource + * @param sharedPrivateLinkResourceName The name of the shared private link resource + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain + * this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the resource. + * @param options The options parameters. + */ + beginDeleteAndWait( + sharedPrivateLinkResourceName: string, + resourceGroupName: string, + resourceName: string, + options?: SignalRSharedPrivateLinkResourcesDeleteOptionalParams + ): Promise; +} diff --git a/sdk/signalr/arm-signalr/src/operationsInterfaces/usages.ts b/sdk/signalr/arm-signalr/src/operationsInterfaces/usages.ts new file mode 100644 index 00000000000..975bf04dd5e --- /dev/null +++ b/sdk/signalr/arm-signalr/src/operationsInterfaces/usages.ts @@ -0,0 +1,24 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SignalRUsage, UsagesListOptionalParams } from "../models"; + +/// +/** Interface representing a Usages. */ +export interface Usages { + /** + * List resource usage quotas by location. + * @param location the location like "eastus" + * @param options The options parameters. + */ + list( + location: string, + options?: UsagesListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/signalr/arm-signalr/src/signalRManagementClient.ts b/sdk/signalr/arm-signalr/src/signalRManagementClient.ts index f89ba058583..6ff0ea7b5b0 100644 --- a/sdk/signalr/arm-signalr/src/signalRManagementClient.ts +++ b/sdk/signalr/arm-signalr/src/signalRManagementClient.ts @@ -3,53 +3,104 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "./models"; -import * as Mappers from "./models/mappers"; -import * as operations from "./operations"; -import { SignalRManagementClientContext } from "./signalRManagementClientContext"; +import * as coreClient from "@azure/core-client"; +import * as coreAuth from "@azure/core-auth"; +import { + OperationsImpl, + SignalRImpl, + UsagesImpl, + SignalRPrivateEndpointConnectionsImpl, + SignalRPrivateLinkResourcesImpl, + SignalRSharedPrivateLinkResourcesImpl +} from "./operations"; +import { + Operations, + SignalR, + Usages, + SignalRPrivateEndpointConnections, + SignalRPrivateLinkResources, + SignalRSharedPrivateLinkResources +} from "./operationsInterfaces"; +import { SignalRManagementClientOptionalParams } from "./models"; -class SignalRManagementClient extends SignalRManagementClientContext { - // Operation groups - operations: operations.Operations; - signalR: operations.SignalR; - usages: operations.Usages; - signalRPrivateEndpointConnections: operations.SignalRPrivateEndpointConnections; - signalRPrivateLinkResources: operations.SignalRPrivateLinkResources; - signalRSharedPrivateLinkResources: operations.SignalRSharedPrivateLinkResources; +export class SignalRManagementClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; /** * Initializes a new instance of the SignalRManagementClient class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param subscriptionId Gets subscription Id which uniquely identify the Microsoft Azure - * subscription. The subscription ID forms part of the URI for every service call. - * @param [options] The parameter options + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId Gets subscription Id which uniquely identify the Microsoft Azure subscription. + * The subscription ID forms part of the URI for every service call. + * @param options The parameter options */ constructor( - credentials: msRest.ServiceClientCredentials, + credentials: coreAuth.TokenCredential, subscriptionId: string, - options?: Models.SignalRManagementClientOptions + options?: SignalRManagementClientOptionalParams ) { - super(credentials, subscriptionId, options); - this.operations = new operations.Operations(this); - this.signalR = new operations.SignalR(this); - this.usages = new operations.Usages(this); - this.signalRPrivateEndpointConnections = new operations.SignalRPrivateEndpointConnections(this); - this.signalRPrivateLinkResources = new operations.SignalRPrivateLinkResources(this); - this.signalRSharedPrivateLinkResources = new operations.SignalRSharedPrivateLinkResources(this); + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (subscriptionId === undefined) { + throw new Error("'subscriptionId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: SignalRManagementClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-signalr/5.0.0`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + if (!options.credentialScopes) { + options.credentialScopes = ["https://management.azure.com/.default"]; + } + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: options.endpoint || "https://management.azure.com" + }; + super(optionsWithDefaults); + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2021-10-01"; + this.operations = new OperationsImpl(this); + this.signalR = new SignalRImpl(this); + this.usages = new UsagesImpl(this); + this.signalRPrivateEndpointConnections = new SignalRPrivateEndpointConnectionsImpl( + this + ); + this.signalRPrivateLinkResources = new SignalRPrivateLinkResourcesImpl( + this + ); + this.signalRSharedPrivateLinkResources = new SignalRSharedPrivateLinkResourcesImpl( + this + ); } + + operations: Operations; + signalR: SignalR; + usages: Usages; + signalRPrivateEndpointConnections: SignalRPrivateEndpointConnections; + signalRPrivateLinkResources: SignalRPrivateLinkResources; + signalRSharedPrivateLinkResources: SignalRSharedPrivateLinkResources; } - -// Operation Specifications - -export { - SignalRManagementClient, - SignalRManagementClientContext, - Models as SignalRManagementModels, - Mappers as SignalRManagementMappers -}; -export * from "./operations"; diff --git a/sdk/signalr/arm-signalr/src/signalRManagementClientContext.ts b/sdk/signalr/arm-signalr/src/signalRManagementClientContext.ts deleted file mode 100644 index 066c749b799..00000000000 --- a/sdk/signalr/arm-signalr/src/signalRManagementClientContext.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import * as Models from "./models"; -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; - -const packageName = "@azure/arm-signalr"; -const packageVersion = "4.0.0"; - -export class SignalRManagementClientContext extends msRestAzure.AzureServiceClient { - credentials: msRest.ServiceClientCredentials; - apiVersion?: string; - subscriptionId: string; - - /** - * Initializes a new instance of the SignalRManagementClient class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param subscriptionId Gets subscription Id which uniquely identify the Microsoft Azure - * subscription. The subscription ID forms part of the URI for every service call. - * @param [options] The parameter options - */ - constructor( - credentials: msRest.ServiceClientCredentials, - subscriptionId: string, - options?: Models.SignalRManagementClientOptions - ) { - if (credentials == undefined) { - throw new Error("'credentials' cannot be null."); - } - if (subscriptionId == undefined) { - throw new Error("'subscriptionId' cannot be null."); - } - - if (!options) { - options = {}; - } - if (!options.userAgent) { - const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); - options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; - } - - super(credentials, options); - - this.apiVersion = "2021-04-01-preview"; - this.acceptLanguage = "en-US"; - this.longRunningOperationRetryTimeout = 30; - this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; - this.requestContentType = "application/json; charset=utf-8"; - this.credentials = credentials; - this.subscriptionId = subscriptionId; - - if (options.acceptLanguage !== null && options.acceptLanguage !== undefined) { - this.acceptLanguage = options.acceptLanguage; - } - if ( - options.longRunningOperationRetryTimeout !== null && - options.longRunningOperationRetryTimeout !== undefined - ) { - this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; - } - } -} diff --git a/sdk/signalr/arm-signalr/test/sampleTest.ts b/sdk/signalr/arm-signalr/test/sampleTest.ts new file mode 100644 index 00000000000..7ed89b043e1 --- /dev/null +++ b/sdk/signalr/arm-signalr/test/sampleTest.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + env, + record, + RecorderEnvironmentSetup, + Recorder +} from "@azure-tools/test-recorder"; +import * as assert from "assert"; + +const recorderEnvSetup: RecorderEnvironmentSetup = { + replaceableVariables: { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" + }, + customizationsOnRecordings: [ + (recording: any): any => + recording.replace( + /"access_token":"[^"]*"/g, + `"access_token":"access_token"` + ) + ], + queryParametersToSkip: [] +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function() { + recorder = record(this, recorderEnvSetup); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/signalr/arm-signalr/tsconfig.json b/sdk/signalr/arm-signalr/tsconfig.json index 422b584abd5..aa271c28f3b 100644 --- a/sdk/signalr/arm-signalr/tsconfig.json +++ b/sdk/signalr/arm-signalr/tsconfig.json @@ -3,7 +3,7 @@ "module": "es6", "moduleResolution": "node", "strict": true, - "target": "es5", + "target": "es6", "sourceMap": true, "declarationMap": true, "esModuleInterop": true, @@ -11,9 +11,10 @@ "forceConsistentCasingInFileNames": true, "lib": ["es6", "dom"], "declaration": true, - "outDir": "./esm", - "importHelpers": true + "outDir": "./dist-esm", + "importHelpers": true, + "paths": { "@azure/arm-signalr": ["./src/index"] } }, - "include": ["./src/**/*.ts"], + "include": ["./src/**/*.ts", "./test/**/*.ts", "samples-dev/**/*.ts"], "exclude": ["node_modules"] } diff --git a/sdk/signalr/ci.yml b/sdk/signalr/ci.yml new file mode 100644 index 00000000000..d0deeca3c2c --- /dev/null +++ b/sdk/signalr/ci.yml @@ -0,0 +1,30 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/signalr/ + +pr: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/signalr/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: signalr + Artifacts: + - name: azure-arm-signalr + safeName: azurearmsignalr + \ No newline at end of file diff --git a/sdk/storagecache/arm-storagecache/CHANGELOG.md b/sdk/storagecache/arm-storagecache/CHANGELOG.md new file mode 100644 index 00000000000..108ab27582d --- /dev/null +++ b/sdk/storagecache/arm-storagecache/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 5.0.0 (2022-01-21) + +The package of @azure/arm-storagecache is using our next generation design principles since version 5.0.0, which contains breaking changes. + +To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog). + +To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/storagecache/arm-storagecache/LICENSE b/sdk/storagecache/arm-storagecache/LICENSE new file mode 100644 index 00000000000..5d1d36e0af8 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/storagecache/arm-storagecache/README.md b/sdk/storagecache/arm-storagecache/README.md index 067211e82e7..32ecbf5800f 100644 --- a/sdk/storagecache/arm-storagecache/README.md +++ b/sdk/storagecache/arm-storagecache/README.md @@ -1,98 +1,98 @@ -## Azure StorageCacheManagementClient SDK for JavaScript +# Azure StorageCacheManagement client library for JavaScript -This package contains an isomorphic SDK for StorageCacheManagementClient. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure StorageCacheManagement client. + +A Storage Cache provides scalable caching service for NAS clients, serving data from either NFSv3 or Blob at-rest storage (referred to as "Storage Targets"). These operations allow you to manage Caches. + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storagecache/arm-storagecache) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-storagecache) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-storagecache) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started ### Currently supported environments - [LTS versions of Node.js](https://nodejs.org/about/releases/) -- Latest versions of Safari, Chrome, Edge, and Firefox. +- Latest versions of Safari, Chrome, Edge and Firefox. -### How to Install +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-storagecache` package + +Install the Azure StorageCacheManagement client library for JavaScript with `npm`: ```bash npm install @azure/arm-storagecache ``` -### How to use +### Create and authenticate a `StorageCacheManagementClient` -#### nodejs - client creation and list operations as an example written in TypeScript. +To create a client object to access the Azure StorageCacheManagement API, you will need the `endpoint` of your Azure StorageCacheManagement resource and a `credential`. The Azure StorageCacheManagement client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure StorageCacheManagement resource in the [Azure Portal][azure_portal]. -##### Install @azure/ms-rest-nodeauth +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: -- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`. ```bash -npm install @azure/ms-rest-nodeauth@"^3.0.0" +npm install @azure/identity ``` -##### Sample code +You will also need to **register a new AAD application and grant access to Azure StorageCacheManagement** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. -While the below sample uses the interactive login, other authentication options can be found in the [README.md file of @azure/ms-rest-nodeauth](https://www.npmjs.com/package/@azure/ms-rest-nodeauth) package -```typescript -const msRestNodeAuth = require("@azure/ms-rest-nodeauth"); +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). + +```javascript const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; - -msRestNodeAuth.interactiveLogin().then((creds) => { - const client = new StorageCacheManagementClient(creds, subscriptionId); - client.operations.list().then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.error(err); -}); +const { DefaultAzureCredential } = require("@azure/identity"); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new StorageCacheManagementClient(new DefaultAzureCredential(), subscriptionId); ``` -#### browser - Authentication, client creation and list operations as an example written in JavaScript. -##### Install @azure/ms-rest-browserauth +### 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). -```bash -npm install @azure/ms-rest-browserauth +## Key concepts + +### StorageCacheManagementClient + +`StorageCacheManagementClient` is the primary interface for developers using the Azure StorageCacheManagement client library. Explore the methods on this client object to understand the different features of the Azure StorageCacheManagement 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"); ``` -##### Sample code +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). -See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. +## Next steps -- index.html -```html - - - - @azure/arm-storagecache sample - - - - - - - - -``` +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. ## Related projects -- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/storagecache/arm-storagecache/README.png) +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fstoragecache%2Farm-storagecache%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/storagecache/arm-storagecache/_meta.json b/sdk/storagecache/arm-storagecache/_meta.json new file mode 100644 index 00000000000..79f66149256 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/_meta.json @@ -0,0 +1,7 @@ +{ + "commit": "f9a6cb686bcc0f1b23761db19f2491c5c4df95cb", + "readme": "specification/storagecache/resource-manager/readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/storagecache/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20220114.1 --generate-sample=true", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "use": "@autorest/typescript@6.0.0-alpha.16.20220114.1" +} \ No newline at end of file diff --git a/sdk/storagecache/arm-storagecache/api-extractor.json b/sdk/storagecache/arm-storagecache/api-extractor.json new file mode 100644 index 00000000000..a11923871dd --- /dev/null +++ b/sdk/storagecache/arm-storagecache/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-storagecache.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/storagecache/arm-storagecache/package.json b/sdk/storagecache/arm-storagecache/package.json index be9abbe053c..8d71d22ea86 100644 --- a/sdk/storagecache/arm-storagecache/package.json +++ b/sdk/storagecache/arm-storagecache/package.json @@ -1,58 +1,106 @@ { "name": "@azure/arm-storagecache", + "sdk-type": "mgmt", "author": "Microsoft Corporation", - "description": "StorageCacheManagementClient Library with typescript type definitions for node.js and browser.", - "version": "4.0.0", + "description": "A generated SDK for StorageCacheManagementClient.", + "version": "5.0.0", + "engines": { "node": ">=12.0.0" }, "dependencies": { - "@azure/ms-rest-azure-js": "^2.0.1", - "@azure/ms-rest-js": "^2.0.4", - "tslib": "^1.10.0" + "@azure/core-lro": "^2.2.0", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.1.0", + "tslib": "^2.2.0" }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], + "keywords": ["node", "azure", "typescript", "browser", "isomorphic"], "license": "MIT", - "main": "./dist/arm-storagecache.js", - "module": "./esm/storageCacheManagementClient.js", - "types": "./esm/storageCacheManagementClient.d.ts", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-storagecache.d.ts", "devDependencies": { - "typescript": "^3.5.3", - "rollup": "^1.18.0", - "rollup-plugin-node-resolve": "^5.2.0", + "@microsoft/api-extractor": "^7.18.11", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "mkdirp": "^1.0.4", + "rollup": "^1.16.3", "rollup-plugin-sourcemaps": "^0.4.2", - "uglify-js": "^3.6.0" + "typescript": "~4.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^1.0.0", + "mocha": "^7.1.1", + "cross-env": "^7.0.2" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storagecache/arm-storagecache", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" }, - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, + "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, "files": [ "dist/**/*.js", "dist/**/*.js.map", "dist/**/*.d.ts", "dist/**/*.d.ts.map", - "esm/**/*.js", - "esm/**/*.js.map", - "esm/**/*.d.ts", - "esm/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", "src/**/*.ts", "README.md", + "LICENSE", "rollup.config.js", - "tsconfig.json" + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" ], "scripts": { - "build": "tsc && rollup -c rollup.config.js && npm run minify", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-storagecache.js.map'\" -o ./dist/arm-storagecache.min.js ./dist/arm-storagecache.js", - "prepack": "npm install && npm run build" + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" }, "sideEffects": false, - "autoPublish": true + "//metadata": { + "constantPaths": [ + { + "path": "src/StorageCacheManagementClient.ts", + "prefix": "packageDetails" + } + ] + }, + "autoPublish": true, + "//sampleConfiguration": { + "productName": "", + "productSlugs": ["azure"], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-storagecache?view=azure-node-preview" + } } diff --git a/sdk/storagecache/arm-storagecache/recordings/node/my_test/recording_sample_test.js b/sdk/storagecache/arm-storagecache/recordings/node/my_test/recording_sample_test.js new file mode 100644 index 00000000000..0f6ecb857ac --- /dev/null +++ b/sdk/storagecache/arm-storagecache/recordings/node/my_test/recording_sample_test.js @@ -0,0 +1,5 @@ +let nock = require('nock'); + +module.exports.hash = "7a6be38bb8cb644d64b4094802301751"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} diff --git a/sdk/storagecache/arm-storagecache/review/arm-storagecache.api.md b/sdk/storagecache/arm-storagecache/review/arm-storagecache.api.md new file mode 100644 index 00000000000..9a67a858364 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/review/arm-storagecache.api.md @@ -0,0 +1,883 @@ +## API Report File for "@azure/arm-storagecache" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { PollOperationState } from '@azure/core-lro'; + +// @public +export interface ApiOperation { + display?: ApiOperationDisplay; + isDataAction?: boolean; + name?: string; + origin?: string; + serviceSpecification?: ApiOperationPropertiesServiceSpecification; +} + +// @public +export interface ApiOperationDisplay { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public +export interface ApiOperationListResult { + nextLink?: string; + value?: ApiOperation[]; +} + +// @public +export interface ApiOperationPropertiesServiceSpecification { + metricSpecifications?: MetricSpecification[]; +} + +// @public +export interface AscOperation { + endTime?: string; + error?: ErrorResponse; + id?: string; + name?: string; + output?: { + [propertyName: string]: Record; + }; + startTime?: string; + status?: string; +} + +// @public +export interface AscOperations { + get(location: string, operationId: string, options?: AscOperationsGetOptionalParams): Promise; +} + +// @public +export interface AscOperationsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type AscOperationsGetResponse = AscOperation; + +// @public +export interface BlobNfsTarget { + target?: string; + usageModel?: string; +} + +// @public +interface Cache_2 { + cacheSizeGB?: number; + directoryServicesSettings?: CacheDirectorySettings; + encryptionSettings?: CacheEncryptionSettings; + readonly health?: CacheHealth; + readonly id?: string; + identity?: CacheIdentity; + location?: string; + readonly mountAddresses?: string[]; + readonly name?: string; + networkSettings?: CacheNetworkSettings; + readonly provisioningState?: ProvisioningStateType; + securitySettings?: CacheSecuritySettings; + sku?: CacheSku; + subnet?: string; + readonly systemData?: SystemData; + tags?: { + [propertyName: string]: string; + }; + readonly type?: string; + readonly upgradeStatus?: CacheUpgradeStatus; +} +export { Cache_2 as Cache } + +// @public +export interface CacheActiveDirectorySettings { + cacheNetBiosName: string; + credentials?: CacheActiveDirectorySettingsCredentials; + readonly domainJoined?: DomainJoinedType; + domainName: string; + domainNetBiosName: string; + primaryDnsIpAddress: string; + secondaryDnsIpAddress?: string; +} + +// @public +export interface CacheActiveDirectorySettingsCredentials { + password: string; + username: string; +} + +// @public +export interface CacheDirectorySettings { + activeDirectory?: CacheActiveDirectorySettings; + usernameDownload?: CacheUsernameDownloadSettings; +} + +// @public +export interface CacheEncryptionSettings { + keyEncryptionKey?: KeyVaultKeyReference; + rotationToLatestKeyVersionEnabled?: boolean; +} + +// @public +export interface CacheHealth { + readonly conditions?: Condition[]; + state?: HealthStateType; + statusDescription?: string; +} + +// @public +export interface CacheIdentity { + readonly principalId?: string; + readonly tenantId?: string; + type?: CacheIdentityType; + userAssignedIdentities?: { + [propertyName: string]: UserAssignedIdentitiesValue; + }; +} + +// @public +export type CacheIdentityType = "SystemAssigned" | "UserAssigned" | "SystemAssigned, UserAssigned" | "None"; + +// @public +export interface CacheNetworkSettings { + dnsSearchDomain?: string; + dnsServers?: string[]; + mtu?: number; + ntpServer?: string; + readonly utilityAddresses?: string[]; +} + +// @public +export interface Caches { + beginCreateOrUpdate(resourceGroupName: string, cacheName: string, options?: CachesCreateOrUpdateOptionalParams): Promise, CachesCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, cacheName: string, options?: CachesCreateOrUpdateOptionalParams): Promise; + beginDebugInfo(resourceGroupName: string, cacheName: string, options?: CachesDebugInfoOptionalParams): Promise, void>>; + beginDebugInfoAndWait(resourceGroupName: string, cacheName: string, options?: CachesDebugInfoOptionalParams): Promise; + beginDelete(resourceGroupName: string, cacheName: string, options?: CachesDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, cacheName: string, options?: CachesDeleteOptionalParams): Promise; + beginFlush(resourceGroupName: string, cacheName: string, options?: CachesFlushOptionalParams): Promise, void>>; + beginFlushAndWait(resourceGroupName: string, cacheName: string, options?: CachesFlushOptionalParams): Promise; + beginStart(resourceGroupName: string, cacheName: string, options?: CachesStartOptionalParams): Promise, void>>; + beginStartAndWait(resourceGroupName: string, cacheName: string, options?: CachesStartOptionalParams): Promise; + beginStop(resourceGroupName: string, cacheName: string, options?: CachesStopOptionalParams): Promise, void>>; + beginStopAndWait(resourceGroupName: string, cacheName: string, options?: CachesStopOptionalParams): Promise; + beginUpgradeFirmware(resourceGroupName: string, cacheName: string, options?: CachesUpgradeFirmwareOptionalParams): Promise, void>>; + beginUpgradeFirmwareAndWait(resourceGroupName: string, cacheName: string, options?: CachesUpgradeFirmwareOptionalParams): Promise; + get(resourceGroupName: string, cacheName: string, options?: CachesGetOptionalParams): Promise; + list(options?: CachesListOptionalParams): PagedAsyncIterableIterator; + listByResourceGroup(resourceGroupName: string, options?: CachesListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + update(resourceGroupName: string, cacheName: string, options?: CachesUpdateOptionalParams): Promise; +} + +// @public +export interface CachesCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + cache?: Cache_2; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type CachesCreateOrUpdateResponse = Cache_2; + +// @public +export interface CachesDebugInfoOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface CachesDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface CacheSecuritySettings { + accessPolicies?: NfsAccessPolicy[]; +} + +// @public +export interface CachesFlushOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface CachesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CachesGetResponse = Cache_2; + +// @public +export interface CacheSku { + name?: string; +} + +// @public +export interface CachesListByResourceGroupNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CachesListByResourceGroupNextResponse = CachesListResult; + +// @public +export interface CachesListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CachesListByResourceGroupResponse = CachesListResult; + +// @public +export interface CachesListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CachesListNextResponse = CachesListResult; + +// @public +export interface CachesListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CachesListResponse = CachesListResult; + +// @public +export interface CachesListResult { + nextLink?: string; + value?: Cache_2[]; +} + +// @public +export interface CachesStartOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface CachesStopOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface CachesUpdateOptionalParams extends coreClient.OperationOptions { + cache?: Cache_2; +} + +// @public +export type CachesUpdateResponse = Cache_2; + +// @public +export interface CachesUpgradeFirmwareOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface CacheUpgradeStatus { + readonly currentFirmwareVersion?: string; + readonly firmwareUpdateDeadline?: Date; + readonly firmwareUpdateStatus?: FirmwareStatusType; + readonly lastFirmwareUpdate?: Date; + readonly pendingFirmwareVersion?: string; +} + +// @public +export interface CacheUsernameDownloadSettings { + autoDownloadCertificate?: boolean; + caCertificateURI?: string; + credentials?: CacheUsernameDownloadSettingsCredentials; + encryptLdapConnection?: boolean; + extendedGroups?: boolean; + groupFileURI?: string; + ldapBaseDN?: string; + ldapServer?: string; + requireValidCertificate?: boolean; + userFileURI?: string; + readonly usernameDownloaded?: UsernameDownloadedType; + usernameSource?: UsernameSource; +} + +// @public +export interface CacheUsernameDownloadSettingsCredentials { + bindDn?: string; + bindPassword?: string; +} + +// @public +export interface ClfsTarget { + target?: string; +} + +// @public +export interface CloudError { + error?: CloudErrorBody; +} + +// @public +export interface CloudErrorBody { + code?: string; + details?: CloudErrorBody[]; + message?: string; + target?: string; +} + +// @public +export interface Condition { + readonly message?: string; + readonly timestamp?: Date; +} + +// @public +export type CreatedByType = string; + +// @public +export type DomainJoinedType = string; + +// @public +export interface ErrorResponse { + code?: string; + message?: string; +} + +// @public +export type FirmwareStatusType = string; + +// @public +export type HealthStateType = string; + +// @public +export interface KeyVaultKeyReference { + keyUrl: string; + sourceVault: KeyVaultKeyReferenceSourceVault; +} + +// @public +export interface KeyVaultKeyReferenceSourceVault { + id?: string; +} + +// @public +export enum KnownCreatedByType { + // (undocumented) + Application = "Application", + // (undocumented) + Key = "Key", + // (undocumented) + ManagedIdentity = "ManagedIdentity", + // (undocumented) + User = "User" +} + +// @public +export enum KnownDomainJoinedType { + // (undocumented) + Error = "Error", + // (undocumented) + No = "No", + // (undocumented) + Yes = "Yes" +} + +// @public +export enum KnownFirmwareStatusType { + // (undocumented) + Available = "available", + // (undocumented) + Unavailable = "unavailable" +} + +// @public +export enum KnownHealthStateType { + // (undocumented) + Degraded = "Degraded", + // (undocumented) + Down = "Down", + // (undocumented) + Flushing = "Flushing", + // (undocumented) + Healthy = "Healthy", + // (undocumented) + Stopped = "Stopped", + // (undocumented) + Stopping = "Stopping", + // (undocumented) + Transitioning = "Transitioning", + // (undocumented) + Unknown = "Unknown", + // (undocumented) + Upgrading = "Upgrading" +} + +// @public +export enum KnownMetricAggregationType { + // (undocumented) + Average = "Average", + // (undocumented) + Count = "Count", + // (undocumented) + Maximum = "Maximum", + // (undocumented) + Minimum = "Minimum", + // (undocumented) + None = "None", + // (undocumented) + NotSpecified = "NotSpecified", + // (undocumented) + Total = "Total" +} + +// @public +export enum KnownNfsAccessRuleAccess { + // (undocumented) + No = "no", + // (undocumented) + Ro = "ro", + // (undocumented) + Rw = "rw" +} + +// @public +export enum KnownNfsAccessRuleScope { + // (undocumented) + Default = "default", + // (undocumented) + Host = "host", + // (undocumented) + Network = "network" +} + +// @public +export enum KnownOperationalStateType { + // (undocumented) + Busy = "Busy", + // (undocumented) + Flushing = "Flushing", + // (undocumented) + Ready = "Ready", + // (undocumented) + Suspended = "Suspended" +} + +// @public +export enum KnownProvisioningStateType { + // (undocumented) + Cancelled = "Cancelled", + // (undocumented) + Creating = "Creating", + // (undocumented) + Deleting = "Deleting", + // (undocumented) + Failed = "Failed", + // (undocumented) + Succeeded = "Succeeded", + // (undocumented) + Updating = "Updating" +} + +// @public +export enum KnownReasonCode { + // (undocumented) + NotAvailableForSubscription = "NotAvailableForSubscription", + // (undocumented) + QuotaId = "QuotaId" +} + +// @public +export enum KnownStorageTargetType { + // (undocumented) + BlobNfs = "blobNfs", + // (undocumented) + Clfs = "clfs", + // (undocumented) + Nfs3 = "nfs3", + // (undocumented) + Unknown = "unknown" +} + +// @public +export enum KnownUsernameDownloadedType { + // (undocumented) + Error = "Error", + // (undocumented) + No = "No", + // (undocumented) + Yes = "Yes" +} + +// @public +export enum KnownUsernameSource { + // (undocumented) + AD = "AD", + // (undocumented) + File = "File", + // (undocumented) + Ldap = "LDAP", + // (undocumented) + None = "None" +} + +// @public +export type MetricAggregationType = string; + +// @public +export interface MetricDimension { + displayName?: string; + internalName?: string; + name?: string; + toBeExportedForShoebox?: boolean; +} + +// @public +export interface MetricSpecification { + aggregationType?: string; + dimensions?: MetricDimension[]; + displayDescription?: string; + displayName?: string; + metricClass?: string; + name?: string; + supportedAggregationTypes?: MetricAggregationType[]; + unit?: string; +} + +// @public +export interface NamespaceJunction { + namespacePath?: string; + nfsAccessPolicy?: string; + nfsExport?: string; + targetPath?: string; +} + +// @public +export interface Nfs3Target { + target?: string; + usageModel?: string; +} + +// @public +export interface NfsAccessPolicy { + accessRules: NfsAccessRule[]; + name: string; +} + +// @public +export interface NfsAccessRule { + access: NfsAccessRuleAccess; + anonymousGID?: string; + anonymousUID?: string; + filter?: string; + rootSquash?: boolean; + scope: NfsAccessRuleScope; + submountAccess?: boolean; + suid?: boolean; +} + +// @public +export type NfsAccessRuleAccess = string; + +// @public +export type NfsAccessRuleScope = string; + +// @public +export type OperationalStateType = string; + +// @public +export interface Operations { + list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListNextResponse = ApiOperationListResult; + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = ApiOperationListResult; + +// @public +export type ProvisioningStateType = string; + +// @public +export type ReasonCode = string; + +// @public +export interface ResourceSku { + capabilities?: ResourceSkuCapabilities[]; + locationInfo?: ResourceSkuLocationInfo[]; + readonly locations?: string[]; + name?: string; + readonly resourceType?: string; + restrictions?: Restriction[]; +} + +// @public +export interface ResourceSkuCapabilities { + name?: string; + value?: string; +} + +// @public +export interface ResourceSkuLocationInfo { + location?: string; + zones?: string[]; +} + +// @public +export interface ResourceSkusResult { + nextLink?: string; + readonly value?: ResourceSku[]; +} + +// @public +export interface Restriction { + reasonCode?: ReasonCode; + readonly type?: string; + readonly values?: string[]; +} + +// @public +export interface Skus { + list(options?: SkusListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface SkusListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SkusListNextResponse = ResourceSkusResult; + +// @public +export interface SkusListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SkusListResponse = ResourceSkusResult; + +// @public (undocumented) +export class StorageCacheManagementClient extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: StorageCacheManagementClientOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + ascOperations: AscOperations; + // (undocumented) + caches: Caches; + // (undocumented) + operations: Operations; + // (undocumented) + skus: Skus; + // (undocumented) + storageTargetOperations: StorageTargetOperations; + // (undocumented) + storageTargets: StorageTargets; + // (undocumented) + subscriptionId: string; + // (undocumented) + usageModels: UsageModels; +} + +// @public +export interface StorageCacheManagementClientOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export type StorageTarget = StorageTargetResource & { + junctions?: NamespaceJunction[]; + targetType?: StorageTargetType; + readonly provisioningState?: ProvisioningStateType; + state?: OperationalStateType; + nfs3?: Nfs3Target; + clfs?: ClfsTarget; + unknown?: UnknownTarget; + blobNfs?: BlobNfsTarget; +}; + +// @public +export interface StorageTargetFlushOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface StorageTargetOperations { + beginFlush(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetFlushOptionalParams): Promise, void>>; + beginFlushAndWait(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetFlushOptionalParams): Promise; + beginResume(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetResumeOptionalParams): Promise, void>>; + beginResumeAndWait(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetResumeOptionalParams): Promise; + beginSuspend(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetSuspendOptionalParams): Promise, void>>; + beginSuspendAndWait(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetSuspendOptionalParams): Promise; +} + +// @public +export interface StorageTargetResource { + readonly id?: string; + readonly location?: string; + readonly name?: string; + readonly systemData?: SystemData; + readonly type?: string; +} + +// @public +export interface StorageTargetResumeOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface StorageTargets { + beginCreateOrUpdate(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetsCreateOrUpdateOptionalParams): Promise, StorageTargetsCreateOrUpdateResponse>>; + beginCreateOrUpdateAndWait(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetsCreateOrUpdateOptionalParams): Promise; + beginDelete(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetsDeleteOptionalParams): Promise; + beginDnsRefresh(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetsDnsRefreshOptionalParams): Promise, void>>; + beginDnsRefreshAndWait(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetsDnsRefreshOptionalParams): Promise; + get(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: StorageTargetsGetOptionalParams): Promise; + listByCache(resourceGroupName: string, cacheName: string, options?: StorageTargetsListByCacheOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface StorageTargetsCreateOrUpdateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + storagetarget?: StorageTarget; + updateIntervalInMs?: number; +} + +// @public +export type StorageTargetsCreateOrUpdateResponse = StorageTarget; + +// @public +export interface StorageTargetsDeleteOptionalParams extends coreClient.OperationOptions { + force?: string; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface StorageTargetsDnsRefreshOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface StorageTargetsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageTargetsGetResponse = StorageTarget; + +// @public +export interface StorageTargetsListByCacheNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageTargetsListByCacheNextResponse = StorageTargetsResult; + +// @public +export interface StorageTargetsListByCacheOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageTargetsListByCacheResponse = StorageTargetsResult; + +// @public +export interface StorageTargetsResult { + nextLink?: string; + value?: StorageTarget[]; +} + +// @public +export interface StorageTargetSuspendOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type StorageTargetType = string; + +// @public +export interface SystemData { + createdAt?: Date; + createdBy?: string; + createdByType?: CreatedByType; + lastModifiedAt?: Date; + lastModifiedBy?: string; + lastModifiedByType?: CreatedByType; +} + +// @public +export interface UnknownTarget { + attributes?: { + [propertyName: string]: string; + }; +} + +// @public +export interface UsageModel { + display?: UsageModelDisplay; + modelName?: string; + targetType?: string; +} + +// @public +export interface UsageModelDisplay { + description?: string; +} + +// @public +export interface UsageModels { + list(options?: UsageModelsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface UsageModelsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type UsageModelsListNextResponse = UsageModelsResult; + +// @public +export interface UsageModelsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type UsageModelsListResponse = UsageModelsResult; + +// @public +export interface UsageModelsResult { + nextLink?: string; + value?: UsageModel[]; +} + +// @public (undocumented) +export interface UserAssignedIdentitiesValue { + readonly clientId?: string; + readonly principalId?: string; +} + +// @public +export type UsernameDownloadedType = string; + +// @public +export type UsernameSource = string; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/storagecache/arm-storagecache/rollup.config.js b/sdk/storagecache/arm-storagecache/rollup.config.js index 8e109d29354..9be1955eb7f 100644 --- a/sdk/storagecache/arm-storagecache/rollup.config.js +++ b/sdk/storagecache/arm-storagecache/rollup.config.js @@ -1,37 +1,188 @@ -import rollup from "rollup"; -import nodeResolve from "rollup-plugin-node-resolve"; -import sourcemaps from "rollup-plugin-sourcemaps"; - -/** - * @type {rollup.RollupFileOptions} - */ -const config = { - input: "./esm/storageCacheManagementClient.js", - external: [ - "@azure/ms-rest-js", - "@azure/ms-rest-azure-js" - ], - output: { - file: "./dist/arm-storagecache.js", - format: "umd", - name: "Azure.ArmStoragecache", - sourcemap: true, - globals: { - "@azure/ms-rest-js": "msRest", - "@azure/ms-rest-azure-js": "msRestAzure" - }, - banner: `/* +/* * Copyright (c) Microsoft Corporation. * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */` - }, - plugins: [ - nodeResolve({ mainFields: ['module', 'main'] }), - sourcemaps() - ] + */ + +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"; + +/** + * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. + * + * NOTE: this manual configuration is only needed because OpenTelemetry uses an + * __exportStar downleveled helper function to declare its exports which confuses + * rollup's automatic discovery mechanism. + * + * @returns an object reference that can be `...`'d into your cjs() configuration. + */ +export function openTelemetryCommonJs() { + const namedExports = {}; + + for (const key of [ + "@opentelemetry/api", + "@azure/core-tracing/node_modules/@opentelemetry/api" + ]) { + namedExports[key] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "SpanStatusCode", + "getSpanContext", + "setSpanContext" + ]; + } + + const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; + + for (const version of releasedOpenTelemetryVersions) { + namedExports[ + // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. + `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` + ] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "StatusCode", + "CanonicalCode", + "getSpanContext", + "setSpanContext" + ]; + } + + return namedExports; +} + +// #region Warning Handler + +/** + * A function that can determine whether a rollupwarning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEvalWarnings(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependencyWarnings(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ + ignoreChaiCircularDependencyWarnings, + ignoreNiseSinonEvalWarnings +]; + +/** + * 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({ + namedExports: { + // Chai's strange internal architecture makes it impossible to statically + // analyze its exports. + chai: [ + "version", + "use", + "util", + "config", + "expect", + "should", + "assert" + ], + ...openTelemetryCommonJs() + } + }), + 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 default config; +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(), cjs()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/storagecache/arm-storagecache/sample.env b/sdk/storagecache/arm-storagecache/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/storagecache/arm-storagecache/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/storagecache/arm-storagecache/samples-dev/ascOperationsGet.ts b/sdk/storagecache/arm-storagecache/samples-dev/ascOperationsGet.ts new file mode 100644 index 00000000000..67ed67ec46c --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/ascOperationsGet.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets the status of an asynchronous operation for the Azure HPC Cache + * + * @summary Gets the status of an asynchronous operation for the Azure HPC Cache + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/AscOperations_Get.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function ascOperationsGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const location = "westus"; + const operationId = "testoperationid"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.ascOperations.get(location, operationId); + console.log(result); +} + +ascOperationsGet().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/cachesCreateOrUpdate.ts b/sdk/storagecache/arm-storagecache/samples-dev/cachesCreateOrUpdate.ts new file mode 100644 index 00000000000..7038c809d82 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/cachesCreateOrUpdate.ts @@ -0,0 +1,94 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update a Cache. + * + * @summary Create or update a Cache. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_CreateOrUpdate.json + */ +import { Cache, StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesCreateOrUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const cache: Cache = { + cacheSizeGB: 3072, + directoryServicesSettings: { + activeDirectory: { + cacheNetBiosName: "contosoSmb", + credentials: { password: "", username: "consotoAdmin" }, + domainName: "contosoAd.contoso.local", + domainNetBiosName: "contosoAd", + primaryDnsIpAddress: "192.0.2.10", + secondaryDnsIpAddress: "192.0.2.11" + }, + usernameDownload: { + credentials: { + bindDn: "cn=ldapadmin,dc=contosoad,dc=contoso,dc=local", + bindPassword: "" + }, + extendedGroups: true, + ldapBaseDN: "dc=contosoad,dc=contoso,dc=local", + ldapServer: "192.0.2.12", + usernameSource: "LDAP" + } + }, + encryptionSettings: { + keyEncryptionKey: { + keyUrl: "https://keyvault-cmk.vault.azure.net/keys/key2047/test", + sourceVault: { + id: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.KeyVault/vaults/keyvault-cmk" + } + } + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/00000000000000000000000000000000/resourceGroups/scgroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/identity1": {} + } + }, + location: "westus", + securitySettings: { + accessPolicies: [ + { + name: "default", + accessRules: [ + { + access: "rw", + rootSquash: false, + scope: "default", + submountAccess: true, + suid: false + } + ] + } + ] + }, + sku: { name: "Standard_2G" }, + subnet: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Network/virtualNetworks/scvnet/subnets/sub1", + tags: { dept: "Contoso" } + }; + const options = { cache: cache }; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginCreateOrUpdateAndWait( + resourceGroupName, + cacheName, + options + ); + console.log(result); +} + +cachesCreateOrUpdate().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/cachesCreateOrUpdateLdapOnly.ts b/sdk/storagecache/arm-storagecache/samples-dev/cachesCreateOrUpdateLdapOnly.ts new file mode 100644 index 00000000000..e67616bcc20 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/cachesCreateOrUpdateLdapOnly.ts @@ -0,0 +1,80 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update a Cache. + * + * @summary Create or update a Cache. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_CreateOrUpdate_ldap_only.json + */ +import { Cache, StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesCreateOrUpdateLdapOnly() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const cache: Cache = { + cacheSizeGB: 3072, + directoryServicesSettings: { + usernameDownload: { + credentials: { + bindDn: "cn=ldapadmin,dc=contosoad,dc=contoso,dc=local", + bindPassword: "" + }, + extendedGroups: true, + ldapBaseDN: "dc=contosoad,dc=contoso,dc=local", + ldapServer: "192.0.2.12", + usernameSource: "LDAP" + } + }, + encryptionSettings: { + keyEncryptionKey: { + keyUrl: "https://keyvault-cmk.vault.azure.net/keys/key2048/test", + sourceVault: { + id: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.KeyVault/vaults/keyvault-cmk" + } + } + }, + location: "westus", + securitySettings: { + accessPolicies: [ + { + name: "default", + accessRules: [ + { + access: "rw", + rootSquash: false, + scope: "default", + submountAccess: true, + suid: false + } + ] + } + ] + }, + sku: { name: "Standard_2G" }, + subnet: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Network/virtualNetworks/scvnet/subnets/sub1", + tags: { dept: "Contoso" } + }; + const options = { cache: cache }; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginCreateOrUpdateAndWait( + resourceGroupName, + cacheName, + options + ); + console.log(result); +} + +cachesCreateOrUpdateLdapOnly().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/cachesDebugInfo.ts b/sdk/storagecache/arm-storagecache/samples-dev/cachesDebugInfo.ts new file mode 100644 index 00000000000..4772aa75ba8 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/cachesDebugInfo.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Tells a Cache to write generate debug info for support to process. + * + * @summary Tells a Cache to write generate debug info for support to process. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_DebugInfo.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesDebugInfo() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginDebugInfoAndWait( + resourceGroupName, + cacheName + ); + console.log(result); +} + +cachesDebugInfo().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/cachesDelete.ts b/sdk/storagecache/arm-storagecache/samples-dev/cachesDelete.ts new file mode 100644 index 00000000000..f0d58399d84 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/cachesDelete.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Schedules a Cache for deletion. + * + * @summary Schedules a Cache for deletion. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Delete.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesDelete() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginDeleteAndWait( + resourceGroupName, + cacheName + ); + console.log(result); +} + +cachesDelete().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/cachesDnsRefresh.ts b/sdk/storagecache/arm-storagecache/samples-dev/cachesDnsRefresh.ts new file mode 100644 index 00000000000..4d85fd9e367 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/cachesDnsRefresh.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Tells a storage target to refresh its DNS information. + * + * @summary Tells a storage target to refresh its DNS information. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_DnsRefresh.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesDnsRefresh() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const storageTargetName = "st1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargets.beginDnsRefreshAndWait( + resourceGroupName, + cacheName, + storageTargetName + ); + console.log(result); +} + +cachesDnsRefresh().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/cachesFlush.ts b/sdk/storagecache/arm-storagecache/samples-dev/cachesFlush.ts new file mode 100644 index 00000000000..b36de6d09b7 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/cachesFlush.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors returned until the flush is complete. + * + * @summary Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors returned until the flush is complete. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Flush.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesFlush() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginFlushAndWait( + resourceGroupName, + cacheName + ); + console.log(result); +} + +cachesFlush().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/cachesGet.ts b/sdk/storagecache/arm-storagecache/samples-dev/cachesGet.ts new file mode 100644 index 00000000000..9d18e8753c8 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/cachesGet.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a Cache. + * + * @summary Returns a Cache. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Get.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.get(resourceGroupName, cacheName); + console.log(result); +} + +cachesGet().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/cachesList.ts b/sdk/storagecache/arm-storagecache/samples-dev/cachesList.ts new file mode 100644 index 00000000000..45f0eb156ff --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/cachesList.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns all Caches the user has access to under a subscription. + * + * @summary Returns all Caches the user has access to under a subscription. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_List.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.caches.list()) { + resArray.push(item); + } + console.log(resArray); +} + +cachesList().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/cachesListByResourceGroup.ts b/sdk/storagecache/arm-storagecache/samples-dev/cachesListByResourceGroup.ts new file mode 100644 index 00000000000..12dfd333385 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/cachesListByResourceGroup.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns all Caches the user has access to under a resource group. + * + * @summary Returns all Caches the user has access to under a resource group. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_ListByResourceGroup.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesListByResourceGroup() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.caches.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +cachesListByResourceGroup().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/cachesStart.ts b/sdk/storagecache/arm-storagecache/samples-dev/cachesStart.ts new file mode 100644 index 00000000000..a83648d8d60 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/cachesStart.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Tells a Stopped state Cache to transition to Active state. + * + * @summary Tells a Stopped state Cache to transition to Active state. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Start.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesStart() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginStartAndWait( + resourceGroupName, + cacheName + ); + console.log(result); +} + +cachesStart().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/cachesStop.ts b/sdk/storagecache/arm-storagecache/samples-dev/cachesStop.ts new file mode 100644 index 00000000000..a7b067b0b2e --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/cachesStop.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Tells an Active Cache to transition to Stopped state. + * + * @summary Tells an Active Cache to transition to Stopped state. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Stop.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesStop() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginStopAndWait( + resourceGroupName, + cacheName + ); + console.log(result); +} + +cachesStop().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/cachesUpdate.ts b/sdk/storagecache/arm-storagecache/samples-dev/cachesUpdate.ts new file mode 100644 index 00000000000..f8845dd0c3e --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/cachesUpdate.ts @@ -0,0 +1,105 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Update a Cache instance. + * + * @summary Update a Cache instance. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Update.json + */ +import { Cache, StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const cache: Cache = { + cacheSizeGB: 3072, + directoryServicesSettings: { + activeDirectory: { + cacheNetBiosName: "contosoSmb", + domainName: "contosoAd.contoso.local", + domainNetBiosName: "contosoAd", + primaryDnsIpAddress: "192.0.2.10", + secondaryDnsIpAddress: "192.0.2.11" + }, + usernameDownload: { extendedGroups: true, usernameSource: "AD" } + }, + location: "westus", + networkSettings: { + dnsSearchDomain: "contoso.com", + dnsServers: ["10.1.22.33", "10.1.12.33"], + mtu: 1500, + ntpServer: "time.contoso.com" + }, + securitySettings: { + accessPolicies: [ + { + name: "default", + accessRules: [ + { + access: "rw", + rootSquash: false, + scope: "default", + submountAccess: true, + suid: false + } + ] + }, + { + name: "restrictive", + accessRules: [ + { + access: "rw", + filter: "10.99.3.145", + rootSquash: false, + scope: "host", + submountAccess: true, + suid: true + }, + { + access: "rw", + filter: "10.99.1.0/24", + rootSquash: false, + scope: "network", + submountAccess: true, + suid: true + }, + { + access: "no", + anonymousGID: "65534", + anonymousUID: "65534", + rootSquash: true, + scope: "default", + submountAccess: true, + suid: false + } + ] + } + ] + }, + sku: { name: "Standard_2G" }, + subnet: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Network/virtualNetworks/scvnet/subnets/sub1", + tags: { dept: "Contoso" } + }; + const options = { cache: cache }; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.update( + resourceGroupName, + cacheName, + options + ); + console.log(result); +} + +cachesUpdate().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/cachesUpdateLdapOnly.ts b/sdk/storagecache/arm-storagecache/samples-dev/cachesUpdateLdapOnly.ts new file mode 100644 index 00000000000..015bd9aa1ce --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/cachesUpdateLdapOnly.ts @@ -0,0 +1,107 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Update a Cache instance. + * + * @summary Update a Cache instance. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Update_ldap_only.json + */ +import { Cache, StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesUpdateLdapOnly() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const cache: Cache = { + cacheSizeGB: 3072, + directoryServicesSettings: { + usernameDownload: { + credentials: { + bindDn: "cn=ldapadmin,dc=contosoad,dc=contoso,dc=local", + bindPassword: "" + }, + extendedGroups: true, + ldapBaseDN: "dc=contosoad,dc=contoso,dc=local", + ldapServer: "192.0.2.12", + usernameSource: "LDAP" + } + }, + location: "westus", + networkSettings: { + dnsSearchDomain: "contoso.com", + dnsServers: ["10.1.22.33", "10.1.12.33"], + mtu: 1500, + ntpServer: "time.contoso.com" + }, + securitySettings: { + accessPolicies: [ + { + name: "default", + accessRules: [ + { + access: "rw", + rootSquash: false, + scope: "default", + submountAccess: true, + suid: false + } + ] + }, + { + name: "restrictive", + accessRules: [ + { + access: "rw", + filter: "10.99.3.145", + rootSquash: false, + scope: "host", + submountAccess: true, + suid: true + }, + { + access: "rw", + filter: "10.99.1.0/24", + rootSquash: false, + scope: "network", + submountAccess: true, + suid: true + }, + { + access: "no", + anonymousGID: "65534", + anonymousUID: "65534", + rootSquash: true, + scope: "default", + submountAccess: true, + suid: false + } + ] + } + ] + }, + sku: { name: "Standard_2G" }, + subnet: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Network/virtualNetworks/scvnet/subnets/sub1", + tags: { dept: "Contoso" } + }; + const options = { cache: cache }; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.update( + resourceGroupName, + cacheName, + options + ); + console.log(result); +} + +cachesUpdateLdapOnly().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/cachesUpgradeFirmware.ts b/sdk/storagecache/arm-storagecache/samples-dev/cachesUpgradeFirmware.ts new file mode 100644 index 00000000000..b48c952c8d0 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/cachesUpgradeFirmware.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * + * @summary Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_UpgradeFirmware.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesUpgradeFirmware() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginUpgradeFirmwareAndWait( + resourceGroupName, + cacheName + ); + console.log(result); +} + +cachesUpgradeFirmware().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/skusList.ts b/sdk/storagecache/arm-storagecache/samples-dev/skusList.ts new file mode 100644 index 00000000000..5cf7fc86edb --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/skusList.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the list of StorageCache.Cache SKUs available to this subscription. + * + * @summary Get the list of StorageCache.Cache SKUs available to this subscription. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Skus_List.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function skusList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.skus.list()) { + resArray.push(item); + } + console.log(resArray); +} + +skusList().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsCreateOrUpdate.ts b/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsCreateOrUpdate.ts new file mode 100644 index 00000000000..e555265f656 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsCreateOrUpdate.ts @@ -0,0 +1,58 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @summary Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_CreateOrUpdate.json + */ +import { + StorageTarget, + StorageCacheManagementClient +} from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageTargetsCreateOrUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const storageTargetName = "st1"; + const storagetarget: StorageTarget = { + junctions: [ + { + namespacePath: "/path/on/cache", + nfsAccessPolicy: "default", + nfsExport: "exp1", + targetPath: "/path/on/exp1" + }, + { + namespacePath: "/path2/on/cache", + nfsAccessPolicy: "rootSquash", + nfsExport: "exp2", + targetPath: "/path2/on/exp2" + } + ], + nfs3: { target: "10.0.44.44", usageModel: "READ_HEAVY_INFREQ" }, + targetType: "nfs3" + }; + const options = { storagetarget: storagetarget }; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargets.beginCreateOrUpdateAndWait( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + console.log(result); +} + +storageTargetsCreateOrUpdate().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsCreateOrUpdateBlobNfs.ts b/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsCreateOrUpdateBlobNfs.ts new file mode 100644 index 00000000000..8639aa426f8 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsCreateOrUpdateBlobNfs.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @summary Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_CreateOrUpdate_BlobNfs.json + */ +import { + StorageTarget, + StorageCacheManagementClient +} from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageTargetsCreateOrUpdateBlobNfs() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const storageTargetName = "st1"; + const storagetarget: StorageTarget = { + blobNfs: { + target: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Storage/storageAccounts/blofnfs/blobServices/default/containers/blobnfs", + usageModel: "WRITE_WORKLOAD_15" + }, + junctions: [{ namespacePath: "/blobnfs" }], + targetType: "blobNfs" + }; + const options = { storagetarget: storagetarget }; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargets.beginCreateOrUpdateAndWait( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + console.log(result); +} + +storageTargetsCreateOrUpdateBlobNfs().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsCreateOrUpdateNoJunctions.ts b/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsCreateOrUpdateNoJunctions.ts new file mode 100644 index 00000000000..de23947c3ac --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsCreateOrUpdateNoJunctions.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @summary Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_CreateOrUpdate_NoJunctions.json + */ +import { + StorageTarget, + StorageCacheManagementClient +} from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageTargetsCreateOrUpdateNoJunctions() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const storageTargetName = "st1"; + const storagetarget: StorageTarget = { + nfs3: { target: "10.0.44.44", usageModel: "READ_HEAVY_INFREQ" }, + targetType: "nfs3" + }; + const options = { storagetarget: storagetarget }; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargets.beginCreateOrUpdateAndWait( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + console.log(result); +} + +storageTargetsCreateOrUpdateNoJunctions().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsDelete.ts b/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsDelete.ts new file mode 100644 index 00000000000..ff833b34265 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsDelete.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be deleted. + * + * @summary Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be deleted. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Delete.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageTargetsDelete() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const storageTargetName = "st1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargets.beginDeleteAndWait( + resourceGroupName, + cacheName, + storageTargetName + ); + console.log(result); +} + +storageTargetsDelete().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsFlush.ts b/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsFlush.ts new file mode 100644 index 00000000000..1f617c06155 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsFlush.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage target's namespace will return errors until the flush operation completes. + * + * @summary Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage target's namespace will return errors until the flush operation completes. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Flush.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageTargetsFlush() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const storageTargetName = "st1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargetOperations.beginFlushAndWait( + resourceGroupName, + cacheName, + storageTargetName + ); + console.log(result); +} + +storageTargetsFlush().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsGet.ts b/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsGet.ts new file mode 100644 index 00000000000..62c61ef9d2f --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsGet.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a Storage Target from a Cache. + * + * @summary Returns a Storage Target from a Cache. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Get.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageTargetsGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const storageTargetName = "st1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargets.get( + resourceGroupName, + cacheName, + storageTargetName + ); + console.log(result); +} + +storageTargetsGet().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsList.ts b/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsList.ts new file mode 100644 index 00000000000..3365d7b6a6b --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsList.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a list of Storage Targets for the specified Cache. + * + * @summary Returns a list of Storage Targets for the specified Cache. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_ListByCache.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageTargetsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageTargets.listByCache( + resourceGroupName, + cacheName + )) { + resArray.push(item); + } + console.log(resArray); +} + +storageTargetsList().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsResume.ts b/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsResume.ts new file mode 100644 index 00000000000..3f16364eeb4 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsResume.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Resumes client access to a previously suspended storage target. + * + * @summary Resumes client access to a previously suspended storage target. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Resume.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageTargetsResume() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const storageTargetName = "st1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargetOperations.beginResumeAndWait( + resourceGroupName, + cacheName, + storageTargetName + ); + console.log(result); +} + +storageTargetsResume().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsSuspend.ts b/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsSuspend.ts new file mode 100644 index 00000000000..c277968845b --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/storageTargetsSuspend.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Suspends client access to a storage target. + * + * @summary Suspends client access to a storage target. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Suspend.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageTargetsSuspend() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const storageTargetName = "st1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargetOperations.beginSuspendAndWait( + resourceGroupName, + cacheName, + storageTargetName + ); + console.log(result); +} + +storageTargetsSuspend().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples-dev/usageModelsList.ts b/sdk/storagecache/arm-storagecache/samples-dev/usageModelsList.ts new file mode 100644 index 00000000000..d3e1d2706d8 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples-dev/usageModelsList.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the list of Cache Usage Models available to this subscription. + * + * @summary Get the list of Cache Usage Models available to this subscription. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/UsageModels_List.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function usageModelsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.usageModels.list()) { + resArray.push(item); + } + console.log(resArray); +} + +usageModelsList().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/README.md b/sdk/storagecache/arm-storagecache/samples/v5/javascript/README.md new file mode 100644 index 00000000000..a186a4835a5 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/README.md @@ -0,0 +1,100 @@ +# client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [ascOperationsGet.js][ascoperationsget] | Gets the status of an asynchronous operation for the Azure HPC Cache x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/AscOperations_Get.json | +| [cachesCreateOrUpdate.js][cachescreateorupdate] | Create or update a Cache. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_CreateOrUpdate.json | +| [cachesCreateOrUpdateLdapOnly.js][cachescreateorupdateldaponly] | Create or update a Cache. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_CreateOrUpdate_ldap_only.json | +| [cachesDebugInfo.js][cachesdebuginfo] | Tells a Cache to write generate debug info for support to process. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_DebugInfo.json | +| [cachesDelete.js][cachesdelete] | Schedules a Cache for deletion. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Delete.json | +| [cachesDnsRefresh.js][cachesdnsrefresh] | Tells a storage target to refresh its DNS information. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_DnsRefresh.json | +| [cachesFlush.js][cachesflush] | Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors returned until the flush is complete. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Flush.json | +| [cachesGet.js][cachesget] | Returns a Cache. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Get.json | +| [cachesList.js][cacheslist] | Returns all Caches the user has access to under a subscription. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_List.json | +| [cachesListByResourceGroup.js][cacheslistbyresourcegroup] | Returns all Caches the user has access to under a resource group. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_ListByResourceGroup.json | +| [cachesStart.js][cachesstart] | Tells a Stopped state Cache to transition to Active state. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Start.json | +| [cachesStop.js][cachesstop] | Tells an Active Cache to transition to Stopped state. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Stop.json | +| [cachesUpdate.js][cachesupdate] | Update a Cache instance. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Update.json | +| [cachesUpdateLdapOnly.js][cachesupdateldaponly] | Update a Cache instance. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Update_ldap_only.json | +| [cachesUpgradeFirmware.js][cachesupgradefirmware] | Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_UpgradeFirmware.json | +| [skusList.js][skuslist] | Get the list of StorageCache.Cache SKUs available to this subscription. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Skus_List.json | +| [storageTargetsCreateOrUpdate.js][storagetargetscreateorupdate] | Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_CreateOrUpdate.json | +| [storageTargetsCreateOrUpdateBlobNfs.js][storagetargetscreateorupdateblobnfs] | Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_CreateOrUpdate_BlobNfs.json | +| [storageTargetsCreateOrUpdateNoJunctions.js][storagetargetscreateorupdatenojunctions] | Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_CreateOrUpdate_NoJunctions.json | +| [storageTargetsDelete.js][storagetargetsdelete] | Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be deleted. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Delete.json | +| [storageTargetsFlush.js][storagetargetsflush] | Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage target's namespace will return errors until the flush operation completes. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Flush.json | +| [storageTargetsGet.js][storagetargetsget] | Returns a Storage Target from a Cache. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Get.json | +| [storageTargetsList.js][storagetargetslist] | Returns a list of Storage Targets for the specified Cache. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_ListByCache.json | +| [storageTargetsResume.js][storagetargetsresume] | Resumes client access to a previously suspended storage target. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Resume.json | +| [storageTargetsSuspend.js][storagetargetssuspend] | Suspends client access to a storage target. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Suspend.json | +| [usageModelsList.js][usagemodelslist] | Get the list of Cache Usage Models available to this subscription. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/UsageModels_List.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node ascOperationsGet.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node ascOperationsGet.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[ascoperationsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/ascOperationsGet.js +[cachescreateorupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesCreateOrUpdate.js +[cachescreateorupdateldaponly]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesCreateOrUpdateLdapOnly.js +[cachesdebuginfo]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesDebugInfo.js +[cachesdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesDelete.js +[cachesdnsrefresh]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesDnsRefresh.js +[cachesflush]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesFlush.js +[cachesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesGet.js +[cacheslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesList.js +[cacheslistbyresourcegroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesListByResourceGroup.js +[cachesstart]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesStart.js +[cachesstop]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesStop.js +[cachesupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesUpdate.js +[cachesupdateldaponly]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesUpdateLdapOnly.js +[cachesupgradefirmware]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesUpgradeFirmware.js +[skuslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/skusList.js +[storagetargetscreateorupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsCreateOrUpdate.js +[storagetargetscreateorupdateblobnfs]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsCreateOrUpdateBlobNfs.js +[storagetargetscreateorupdatenojunctions]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsCreateOrUpdateNoJunctions.js +[storagetargetsdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsDelete.js +[storagetargetsflush]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsFlush.js +[storagetargetsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsGet.js +[storagetargetslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsList.js +[storagetargetsresume]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsResume.js +[storagetargetssuspend]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsSuspend.js +[usagemodelslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/javascript/usageModelsList.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-storagecache?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storagecache/arm-storagecache/README.md diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/ascOperationsGet.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/ascOperationsGet.js new file mode 100644 index 00000000000..d25a59ebf6b --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/ascOperationsGet.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets the status of an asynchronous operation for the Azure HPC Cache + * + * @summary Gets the status of an asynchronous operation for the Azure HPC Cache + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/AscOperations_Get.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function ascOperationsGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const location = "westus"; + const operationId = "testoperationid"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.ascOperations.get(location, operationId); + console.log(result); +} + +ascOperationsGet().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesCreateOrUpdate.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesCreateOrUpdate.js new file mode 100644 index 00000000000..df62a6509f5 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesCreateOrUpdate.js @@ -0,0 +1,94 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update a Cache. + * + * @summary Create or update a Cache. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_CreateOrUpdate.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cachesCreateOrUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const cache = { + cacheSizeGB: 3072, + directoryServicesSettings: { + activeDirectory: { + cacheNetBiosName: "contosoSmb", + credentials: { password: "", username: "consotoAdmin" }, + domainName: "contosoAd.contoso.local", + domainNetBiosName: "contosoAd", + primaryDnsIpAddress: "192.0.2.10", + secondaryDnsIpAddress: "192.0.2.11", + }, + usernameDownload: { + credentials: { + bindDn: "cn=ldapadmin,dc=contosoad,dc=contoso,dc=local", + bindPassword: "", + }, + extendedGroups: true, + ldapBaseDN: "dc=contosoad,dc=contoso,dc=local", + ldapServer: "192.0.2.12", + usernameSource: "LDAP", + }, + }, + encryptionSettings: { + keyEncryptionKey: { + keyUrl: "https://keyvault-cmk.vault.azure.net/keys/key2047/test", + sourceVault: { + id: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.KeyVault/vaults/keyvault-cmk", + }, + }, + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/00000000000000000000000000000000/resourceGroups/scgroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/identity1": + {}, + }, + }, + location: "westus", + securitySettings: { + accessPolicies: [ + { + name: "default", + accessRules: [ + { + access: "rw", + rootSquash: false, + scope: "default", + submountAccess: true, + suid: false, + }, + ], + }, + ], + }, + sku: { name: "Standard_2G" }, + subnet: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Network/virtualNetworks/scvnet/subnets/sub1", + tags: { dept: "Contoso" }, + }; + const options = { cache: cache }; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginCreateOrUpdateAndWait( + resourceGroupName, + cacheName, + options + ); + console.log(result); +} + +cachesCreateOrUpdate().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesCreateOrUpdateLdapOnly.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesCreateOrUpdateLdapOnly.js new file mode 100644 index 00000000000..87a1ed2ac46 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesCreateOrUpdateLdapOnly.js @@ -0,0 +1,79 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update a Cache. + * + * @summary Create or update a Cache. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_CreateOrUpdate_ldap_only.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cachesCreateOrUpdateLdapOnly() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const cache = { + cacheSizeGB: 3072, + directoryServicesSettings: { + usernameDownload: { + credentials: { + bindDn: "cn=ldapadmin,dc=contosoad,dc=contoso,dc=local", + bindPassword: "", + }, + extendedGroups: true, + ldapBaseDN: "dc=contosoad,dc=contoso,dc=local", + ldapServer: "192.0.2.12", + usernameSource: "LDAP", + }, + }, + encryptionSettings: { + keyEncryptionKey: { + keyUrl: "https://keyvault-cmk.vault.azure.net/keys/key2048/test", + sourceVault: { + id: "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.KeyVault/vaults/keyvault-cmk", + }, + }, + }, + location: "westus", + securitySettings: { + accessPolicies: [ + { + name: "default", + accessRules: [ + { + access: "rw", + rootSquash: false, + scope: "default", + submountAccess: true, + suid: false, + }, + ], + }, + ], + }, + sku: { name: "Standard_2G" }, + subnet: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Network/virtualNetworks/scvnet/subnets/sub1", + tags: { dept: "Contoso" }, + }; + const options = { cache: cache }; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginCreateOrUpdateAndWait( + resourceGroupName, + cacheName, + options + ); + console.log(result); +} + +cachesCreateOrUpdateLdapOnly().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesDebugInfo.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesDebugInfo.js new file mode 100644 index 00000000000..54f0a17bbbf --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesDebugInfo.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Tells a Cache to write generate debug info for support to process. + * + * @summary Tells a Cache to write generate debug info for support to process. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_DebugInfo.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cachesDebugInfo() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginDebugInfoAndWait(resourceGroupName, cacheName); + console.log(result); +} + +cachesDebugInfo().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesDelete.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesDelete.js new file mode 100644 index 00000000000..8aec0df2317 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesDelete.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Schedules a Cache for deletion. + * + * @summary Schedules a Cache for deletion. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Delete.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cachesDelete() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginDeleteAndWait(resourceGroupName, cacheName); + console.log(result); +} + +cachesDelete().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesDnsRefresh.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesDnsRefresh.js new file mode 100644 index 00000000000..75b32a7689d --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesDnsRefresh.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Tells a storage target to refresh its DNS information. + * + * @summary Tells a storage target to refresh its DNS information. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_DnsRefresh.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cachesDnsRefresh() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const storageTargetName = "st1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargets.beginDnsRefreshAndWait( + resourceGroupName, + cacheName, + storageTargetName + ); + console.log(result); +} + +cachesDnsRefresh().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesFlush.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesFlush.js new file mode 100644 index 00000000000..fd10355c351 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesFlush.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors returned until the flush is complete. + * + * @summary Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors returned until the flush is complete. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Flush.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cachesFlush() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginFlushAndWait(resourceGroupName, cacheName); + console.log(result); +} + +cachesFlush().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesGet.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesGet.js new file mode 100644 index 00000000000..a076f4ecea1 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesGet.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a Cache. + * + * @summary Returns a Cache. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Get.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cachesGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.get(resourceGroupName, cacheName); + console.log(result); +} + +cachesGet().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesList.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesList.js new file mode 100644 index 00000000000..e36153654b3 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesList.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns all Caches the user has access to under a subscription. + * + * @summary Returns all Caches the user has access to under a subscription. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_List.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cachesList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.caches.list()) { + resArray.push(item); + } + console.log(resArray); +} + +cachesList().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesListByResourceGroup.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesListByResourceGroup.js new file mode 100644 index 00000000000..01e2ac02d8d --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesListByResourceGroup.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns all Caches the user has access to under a resource group. + * + * @summary Returns all Caches the user has access to under a resource group. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_ListByResourceGroup.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cachesListByResourceGroup() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.caches.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +cachesListByResourceGroup().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesStart.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesStart.js new file mode 100644 index 00000000000..40deac0cebe --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesStart.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Tells a Stopped state Cache to transition to Active state. + * + * @summary Tells a Stopped state Cache to transition to Active state. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Start.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cachesStart() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginStartAndWait(resourceGroupName, cacheName); + console.log(result); +} + +cachesStart().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesStop.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesStop.js new file mode 100644 index 00000000000..bba6720c6d9 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesStop.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Tells an Active Cache to transition to Stopped state. + * + * @summary Tells an Active Cache to transition to Stopped state. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Stop.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cachesStop() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginStopAndWait(resourceGroupName, cacheName); + console.log(result); +} + +cachesStop().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesUpdate.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesUpdate.js new file mode 100644 index 00000000000..1b4be42389a --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesUpdate.js @@ -0,0 +1,101 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Update a Cache instance. + * + * @summary Update a Cache instance. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Update.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cachesUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const cache = { + cacheSizeGB: 3072, + directoryServicesSettings: { + activeDirectory: { + cacheNetBiosName: "contosoSmb", + domainName: "contosoAd.contoso.local", + domainNetBiosName: "contosoAd", + primaryDnsIpAddress: "192.0.2.10", + secondaryDnsIpAddress: "192.0.2.11", + }, + usernameDownload: { extendedGroups: true, usernameSource: "AD" }, + }, + location: "westus", + networkSettings: { + dnsSearchDomain: "contoso.com", + dnsServers: ["10.1.22.33", "10.1.12.33"], + mtu: 1500, + ntpServer: "time.contoso.com", + }, + securitySettings: { + accessPolicies: [ + { + name: "default", + accessRules: [ + { + access: "rw", + rootSquash: false, + scope: "default", + submountAccess: true, + suid: false, + }, + ], + }, + { + name: "restrictive", + accessRules: [ + { + access: "rw", + filter: "10.99.3.145", + rootSquash: false, + scope: "host", + submountAccess: true, + suid: true, + }, + { + access: "rw", + filter: "10.99.1.0/24", + rootSquash: false, + scope: "network", + submountAccess: true, + suid: true, + }, + { + access: "no", + anonymousGID: "65534", + anonymousUID: "65534", + rootSquash: true, + scope: "default", + submountAccess: true, + suid: false, + }, + ], + }, + ], + }, + sku: { name: "Standard_2G" }, + subnet: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Network/virtualNetworks/scvnet/subnets/sub1", + tags: { dept: "Contoso" }, + }; + const options = { cache: cache }; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.update(resourceGroupName, cacheName, options); + console.log(result); +} + +cachesUpdate().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesUpdateLdapOnly.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesUpdateLdapOnly.js new file mode 100644 index 00000000000..9a26844cba4 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesUpdateLdapOnly.js @@ -0,0 +1,103 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Update a Cache instance. + * + * @summary Update a Cache instance. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Update_ldap_only.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cachesUpdateLdapOnly() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const cache = { + cacheSizeGB: 3072, + directoryServicesSettings: { + usernameDownload: { + credentials: { + bindDn: "cn=ldapadmin,dc=contosoad,dc=contoso,dc=local", + bindPassword: "", + }, + extendedGroups: true, + ldapBaseDN: "dc=contosoad,dc=contoso,dc=local", + ldapServer: "192.0.2.12", + usernameSource: "LDAP", + }, + }, + location: "westus", + networkSettings: { + dnsSearchDomain: "contoso.com", + dnsServers: ["10.1.22.33", "10.1.12.33"], + mtu: 1500, + ntpServer: "time.contoso.com", + }, + securitySettings: { + accessPolicies: [ + { + name: "default", + accessRules: [ + { + access: "rw", + rootSquash: false, + scope: "default", + submountAccess: true, + suid: false, + }, + ], + }, + { + name: "restrictive", + accessRules: [ + { + access: "rw", + filter: "10.99.3.145", + rootSquash: false, + scope: "host", + submountAccess: true, + suid: true, + }, + { + access: "rw", + filter: "10.99.1.0/24", + rootSquash: false, + scope: "network", + submountAccess: true, + suid: true, + }, + { + access: "no", + anonymousGID: "65534", + anonymousUID: "65534", + rootSquash: true, + scope: "default", + submountAccess: true, + suid: false, + }, + ], + }, + ], + }, + sku: { name: "Standard_2G" }, + subnet: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Network/virtualNetworks/scvnet/subnets/sub1", + tags: { dept: "Contoso" }, + }; + const options = { cache: cache }; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.update(resourceGroupName, cacheName, options); + console.log(result); +} + +cachesUpdateLdapOnly().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesUpgradeFirmware.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesUpgradeFirmware.js new file mode 100644 index 00000000000..992e4967ef8 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/cachesUpgradeFirmware.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * + * @summary Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_UpgradeFirmware.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cachesUpgradeFirmware() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginUpgradeFirmwareAndWait(resourceGroupName, cacheName); + console.log(result); +} + +cachesUpgradeFirmware().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/package.json b/sdk/storagecache/arm-storagecache/samples/v5/javascript/package.json new file mode 100644 index 00000000000..0ab4c3cd9e2 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "azure-arm-storagecache-samples-js", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript", + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/storagecache/arm-storagecache" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storagecache/arm-storagecache", + "dependencies": { + "@azure/arm-storagecache": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/sample.env b/sdk/storagecache/arm-storagecache/samples/v5/javascript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/skusList.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/skusList.js new file mode 100644 index 00000000000..1143992327e --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/skusList.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the list of StorageCache.Cache SKUs available to this subscription. + * + * @summary Get the list of StorageCache.Cache SKUs available to this subscription. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Skus_List.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function skusList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.skus.list()) { + resArray.push(item); + } + console.log(resArray); +} + +skusList().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsCreateOrUpdate.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsCreateOrUpdate.js new file mode 100644 index 00000000000..a1ed2fe1248 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsCreateOrUpdate.js @@ -0,0 +1,55 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @summary Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_CreateOrUpdate.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageTargetsCreateOrUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const storageTargetName = "st1"; + const storagetarget = { + junctions: [ + { + namespacePath: "/path/on/cache", + nfsAccessPolicy: "default", + nfsExport: "exp1", + targetPath: "/path/on/exp1", + }, + { + namespacePath: "/path2/on/cache", + nfsAccessPolicy: "rootSquash", + nfsExport: "exp2", + targetPath: "/path2/on/exp2", + }, + ], + nfs3: { target: "10.0.44.44", usageModel: "READ_HEAVY_INFREQ" }, + targetType: "nfs3", + }; + const options = { storagetarget: storagetarget }; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargets.beginCreateOrUpdateAndWait( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + console.log(result); +} + +storageTargetsCreateOrUpdate().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsCreateOrUpdateBlobNfs.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsCreateOrUpdateBlobNfs.js new file mode 100644 index 00000000000..9b3dcc2b5e5 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsCreateOrUpdateBlobNfs.js @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @summary Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_CreateOrUpdate_BlobNfs.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageTargetsCreateOrUpdateBlobNfs() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const storageTargetName = "st1"; + const storagetarget = { + blobNfs: { + target: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Storage/storageAccounts/blofnfs/blobServices/default/containers/blobnfs", + usageModel: "WRITE_WORKLOAD_15", + }, + junctions: [{ namespacePath: "/blobnfs" }], + targetType: "blobNfs", + }; + const options = { storagetarget: storagetarget }; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargets.beginCreateOrUpdateAndWait( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + console.log(result); +} + +storageTargetsCreateOrUpdateBlobNfs().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsCreateOrUpdateNoJunctions.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsCreateOrUpdateNoJunctions.js new file mode 100644 index 00000000000..efa89329f56 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsCreateOrUpdateNoJunctions.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @summary Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_CreateOrUpdate_NoJunctions.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageTargetsCreateOrUpdateNoJunctions() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const storageTargetName = "st1"; + const storagetarget = { + nfs3: { target: "10.0.44.44", usageModel: "READ_HEAVY_INFREQ" }, + targetType: "nfs3", + }; + const options = { storagetarget: storagetarget }; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargets.beginCreateOrUpdateAndWait( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + console.log(result); +} + +storageTargetsCreateOrUpdateNoJunctions().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsDelete.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsDelete.js new file mode 100644 index 00000000000..e2a2c3c8b51 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsDelete.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be deleted. + * + * @summary Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be deleted. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Delete.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageTargetsDelete() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const storageTargetName = "st1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargets.beginDeleteAndWait( + resourceGroupName, + cacheName, + storageTargetName + ); + console.log(result); +} + +storageTargetsDelete().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsFlush.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsFlush.js new file mode 100644 index 00000000000..e22eac88bf5 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsFlush.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage target's namespace will return errors until the flush operation completes. + * + * @summary Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage target's namespace will return errors until the flush operation completes. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Flush.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageTargetsFlush() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const storageTargetName = "st1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargetOperations.beginFlushAndWait( + resourceGroupName, + cacheName, + storageTargetName + ); + console.log(result); +} + +storageTargetsFlush().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsGet.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsGet.js new file mode 100644 index 00000000000..4f7281adc94 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsGet.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a Storage Target from a Cache. + * + * @summary Returns a Storage Target from a Cache. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Get.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageTargetsGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const storageTargetName = "st1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargets.get(resourceGroupName, cacheName, storageTargetName); + console.log(result); +} + +storageTargetsGet().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsList.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsList.js new file mode 100644 index 00000000000..af48e148adc --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsList.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a list of Storage Targets for the specified Cache. + * + * @summary Returns a list of Storage Targets for the specified Cache. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_ListByCache.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageTargetsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageTargets.listByCache(resourceGroupName, cacheName)) { + resArray.push(item); + } + console.log(resArray); +} + +storageTargetsList().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsResume.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsResume.js new file mode 100644 index 00000000000..2d777167858 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsResume.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Resumes client access to a previously suspended storage target. + * + * @summary Resumes client access to a previously suspended storage target. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Resume.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageTargetsResume() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const storageTargetName = "st1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargetOperations.beginResumeAndWait( + resourceGroupName, + cacheName, + storageTargetName + ); + console.log(result); +} + +storageTargetsResume().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsSuspend.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsSuspend.js new file mode 100644 index 00000000000..e6c8ad37780 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/storageTargetsSuspend.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Suspends client access to a storage target. + * + * @summary Suspends client access to a storage target. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Suspend.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageTargetsSuspend() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const storageTargetName = "st1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargetOperations.beginSuspendAndWait( + resourceGroupName, + cacheName, + storageTargetName + ); + console.log(result); +} + +storageTargetsSuspend().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/javascript/usageModelsList.js b/sdk/storagecache/arm-storagecache/samples/v5/javascript/usageModelsList.js new file mode 100644 index 00000000000..119258bd3ae --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/javascript/usageModelsList.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the list of Cache Usage Models available to this subscription. + * + * @summary Get the list of Cache Usage Models available to this subscription. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/UsageModels_List.json + */ +const { StorageCacheManagementClient } = require("@azure/arm-storagecache"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function usageModelsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.usageModels.list()) { + resArray.push(item); + } + console.log(resArray); +} + +usageModelsList().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/README.md b/sdk/storagecache/arm-storagecache/samples/v5/typescript/README.md new file mode 100644 index 00000000000..efdb7384613 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/README.md @@ -0,0 +1,113 @@ +# client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| ------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [ascOperationsGet.ts][ascoperationsget] | Gets the status of an asynchronous operation for the Azure HPC Cache x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/AscOperations_Get.json | +| [cachesCreateOrUpdate.ts][cachescreateorupdate] | Create or update a Cache. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_CreateOrUpdate.json | +| [cachesCreateOrUpdateLdapOnly.ts][cachescreateorupdateldaponly] | Create or update a Cache. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_CreateOrUpdate_ldap_only.json | +| [cachesDebugInfo.ts][cachesdebuginfo] | Tells a Cache to write generate debug info for support to process. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_DebugInfo.json | +| [cachesDelete.ts][cachesdelete] | Schedules a Cache for deletion. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Delete.json | +| [cachesDnsRefresh.ts][cachesdnsrefresh] | Tells a storage target to refresh its DNS information. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_DnsRefresh.json | +| [cachesFlush.ts][cachesflush] | Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors returned until the flush is complete. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Flush.json | +| [cachesGet.ts][cachesget] | Returns a Cache. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Get.json | +| [cachesList.ts][cacheslist] | Returns all Caches the user has access to under a subscription. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_List.json | +| [cachesListByResourceGroup.ts][cacheslistbyresourcegroup] | Returns all Caches the user has access to under a resource group. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_ListByResourceGroup.json | +| [cachesStart.ts][cachesstart] | Tells a Stopped state Cache to transition to Active state. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Start.json | +| [cachesStop.ts][cachesstop] | Tells an Active Cache to transition to Stopped state. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Stop.json | +| [cachesUpdate.ts][cachesupdate] | Update a Cache instance. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Update.json | +| [cachesUpdateLdapOnly.ts][cachesupdateldaponly] | Update a Cache instance. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Update_ldap_only.json | +| [cachesUpgradeFirmware.ts][cachesupgradefirmware] | Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_UpgradeFirmware.json | +| [skusList.ts][skuslist] | Get the list of StorageCache.Cache SKUs available to this subscription. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Skus_List.json | +| [storageTargetsCreateOrUpdate.ts][storagetargetscreateorupdate] | Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_CreateOrUpdate.json | +| [storageTargetsCreateOrUpdateBlobNfs.ts][storagetargetscreateorupdateblobnfs] | Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_CreateOrUpdate_BlobNfs.json | +| [storageTargetsCreateOrUpdateNoJunctions.ts][storagetargetscreateorupdatenojunctions] | Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_CreateOrUpdate_NoJunctions.json | +| [storageTargetsDelete.ts][storagetargetsdelete] | Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be deleted. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Delete.json | +| [storageTargetsFlush.ts][storagetargetsflush] | Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage target's namespace will return errors until the flush operation completes. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Flush.json | +| [storageTargetsGet.ts][storagetargetsget] | Returns a Storage Target from a Cache. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Get.json | +| [storageTargetsList.ts][storagetargetslist] | Returns a list of Storage Targets for the specified Cache. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_ListByCache.json | +| [storageTargetsResume.ts][storagetargetsresume] | Resumes client access to a previously suspended storage target. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Resume.json | +| [storageTargetsSuspend.ts][storagetargetssuspend] | Suspends client access to a storage target. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Suspend.json | +| [usageModelsList.ts][usagemodelslist] | Get the list of Cache Usage Models available to this subscription. x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/UsageModels_List.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/ascOperationsGet.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node dist/ascOperationsGet.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[ascoperationsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/ascOperationsGet.ts +[cachescreateorupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesCreateOrUpdate.ts +[cachescreateorupdateldaponly]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesCreateOrUpdateLdapOnly.ts +[cachesdebuginfo]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesDebugInfo.ts +[cachesdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesDelete.ts +[cachesdnsrefresh]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesDnsRefresh.ts +[cachesflush]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesFlush.ts +[cachesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesGet.ts +[cacheslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesList.ts +[cacheslistbyresourcegroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesListByResourceGroup.ts +[cachesstart]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesStart.ts +[cachesstop]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesStop.ts +[cachesupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesUpdate.ts +[cachesupdateldaponly]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesUpdateLdapOnly.ts +[cachesupgradefirmware]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesUpgradeFirmware.ts +[skuslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/skusList.ts +[storagetargetscreateorupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsCreateOrUpdate.ts +[storagetargetscreateorupdateblobnfs]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsCreateOrUpdateBlobNfs.ts +[storagetargetscreateorupdatenojunctions]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsCreateOrUpdateNoJunctions.ts +[storagetargetsdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsDelete.ts +[storagetargetsflush]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsFlush.ts +[storagetargetsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsGet.ts +[storagetargetslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsList.ts +[storagetargetsresume]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsResume.ts +[storagetargetssuspend]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsSuspend.ts +[usagemodelslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/usageModelsList.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-storagecache?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storagecache/arm-storagecache/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/package.json b/sdk/storagecache/arm-storagecache/samples/v5/typescript/package.json new file mode 100644 index 00000000000..fc2aef77ec9 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "azure-arm-storagecache-samples-ts", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript", + "engines": { + "node": ">=12.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/storagecache/arm-storagecache" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storagecache/arm-storagecache", + "dependencies": { + "@azure/arm-storagecache": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^12.0.0", + "typescript": "~4.4.0", + "rimraf": "latest" + } +} diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/sample.env b/sdk/storagecache/arm-storagecache/samples/v5/typescript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/ascOperationsGet.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/ascOperationsGet.ts new file mode 100644 index 00000000000..67ed67ec46c --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/ascOperationsGet.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets the status of an asynchronous operation for the Azure HPC Cache + * + * @summary Gets the status of an asynchronous operation for the Azure HPC Cache + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/AscOperations_Get.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function ascOperationsGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const location = "westus"; + const operationId = "testoperationid"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.ascOperations.get(location, operationId); + console.log(result); +} + +ascOperationsGet().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesCreateOrUpdate.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesCreateOrUpdate.ts new file mode 100644 index 00000000000..7038c809d82 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesCreateOrUpdate.ts @@ -0,0 +1,94 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update a Cache. + * + * @summary Create or update a Cache. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_CreateOrUpdate.json + */ +import { Cache, StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesCreateOrUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const cache: Cache = { + cacheSizeGB: 3072, + directoryServicesSettings: { + activeDirectory: { + cacheNetBiosName: "contosoSmb", + credentials: { password: "", username: "consotoAdmin" }, + domainName: "contosoAd.contoso.local", + domainNetBiosName: "contosoAd", + primaryDnsIpAddress: "192.0.2.10", + secondaryDnsIpAddress: "192.0.2.11" + }, + usernameDownload: { + credentials: { + bindDn: "cn=ldapadmin,dc=contosoad,dc=contoso,dc=local", + bindPassword: "" + }, + extendedGroups: true, + ldapBaseDN: "dc=contosoad,dc=contoso,dc=local", + ldapServer: "192.0.2.12", + usernameSource: "LDAP" + } + }, + encryptionSettings: { + keyEncryptionKey: { + keyUrl: "https://keyvault-cmk.vault.azure.net/keys/key2047/test", + sourceVault: { + id: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.KeyVault/vaults/keyvault-cmk" + } + } + }, + identity: { + type: "UserAssigned", + userAssignedIdentities: { + "/subscriptions/00000000000000000000000000000000/resourceGroups/scgroup/providers/MicrosoftManagedIdentity/userAssignedIdentities/identity1": {} + } + }, + location: "westus", + securitySettings: { + accessPolicies: [ + { + name: "default", + accessRules: [ + { + access: "rw", + rootSquash: false, + scope: "default", + submountAccess: true, + suid: false + } + ] + } + ] + }, + sku: { name: "Standard_2G" }, + subnet: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Network/virtualNetworks/scvnet/subnets/sub1", + tags: { dept: "Contoso" } + }; + const options = { cache: cache }; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginCreateOrUpdateAndWait( + resourceGroupName, + cacheName, + options + ); + console.log(result); +} + +cachesCreateOrUpdate().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesCreateOrUpdateLdapOnly.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesCreateOrUpdateLdapOnly.ts new file mode 100644 index 00000000000..e67616bcc20 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesCreateOrUpdateLdapOnly.ts @@ -0,0 +1,80 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update a Cache. + * + * @summary Create or update a Cache. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_CreateOrUpdate_ldap_only.json + */ +import { Cache, StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesCreateOrUpdateLdapOnly() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const cache: Cache = { + cacheSizeGB: 3072, + directoryServicesSettings: { + usernameDownload: { + credentials: { + bindDn: "cn=ldapadmin,dc=contosoad,dc=contoso,dc=local", + bindPassword: "" + }, + extendedGroups: true, + ldapBaseDN: "dc=contosoad,dc=contoso,dc=local", + ldapServer: "192.0.2.12", + usernameSource: "LDAP" + } + }, + encryptionSettings: { + keyEncryptionKey: { + keyUrl: "https://keyvault-cmk.vault.azure.net/keys/key2048/test", + sourceVault: { + id: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.KeyVault/vaults/keyvault-cmk" + } + } + }, + location: "westus", + securitySettings: { + accessPolicies: [ + { + name: "default", + accessRules: [ + { + access: "rw", + rootSquash: false, + scope: "default", + submountAccess: true, + suid: false + } + ] + } + ] + }, + sku: { name: "Standard_2G" }, + subnet: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Network/virtualNetworks/scvnet/subnets/sub1", + tags: { dept: "Contoso" } + }; + const options = { cache: cache }; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginCreateOrUpdateAndWait( + resourceGroupName, + cacheName, + options + ); + console.log(result); +} + +cachesCreateOrUpdateLdapOnly().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesDebugInfo.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesDebugInfo.ts new file mode 100644 index 00000000000..4772aa75ba8 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesDebugInfo.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Tells a Cache to write generate debug info for support to process. + * + * @summary Tells a Cache to write generate debug info for support to process. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_DebugInfo.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesDebugInfo() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginDebugInfoAndWait( + resourceGroupName, + cacheName + ); + console.log(result); +} + +cachesDebugInfo().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesDelete.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesDelete.ts new file mode 100644 index 00000000000..f0d58399d84 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesDelete.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Schedules a Cache for deletion. + * + * @summary Schedules a Cache for deletion. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Delete.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesDelete() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginDeleteAndWait( + resourceGroupName, + cacheName + ); + console.log(result); +} + +cachesDelete().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesDnsRefresh.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesDnsRefresh.ts new file mode 100644 index 00000000000..4d85fd9e367 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesDnsRefresh.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Tells a storage target to refresh its DNS information. + * + * @summary Tells a storage target to refresh its DNS information. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_DnsRefresh.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesDnsRefresh() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const storageTargetName = "st1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargets.beginDnsRefreshAndWait( + resourceGroupName, + cacheName, + storageTargetName + ); + console.log(result); +} + +cachesDnsRefresh().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesFlush.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesFlush.ts new file mode 100644 index 00000000000..b36de6d09b7 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesFlush.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors returned until the flush is complete. + * + * @summary Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see errors returned until the flush is complete. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Flush.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesFlush() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginFlushAndWait( + resourceGroupName, + cacheName + ); + console.log(result); +} + +cachesFlush().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesGet.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesGet.ts new file mode 100644 index 00000000000..9d18e8753c8 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesGet.ts @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a Cache. + * + * @summary Returns a Cache. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Get.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.get(resourceGroupName, cacheName); + console.log(result); +} + +cachesGet().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesList.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesList.ts new file mode 100644 index 00000000000..45f0eb156ff --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesList.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns all Caches the user has access to under a subscription. + * + * @summary Returns all Caches the user has access to under a subscription. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_List.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.caches.list()) { + resArray.push(item); + } + console.log(resArray); +} + +cachesList().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesListByResourceGroup.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesListByResourceGroup.ts new file mode 100644 index 00000000000..12dfd333385 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesListByResourceGroup.ts @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns all Caches the user has access to under a resource group. + * + * @summary Returns all Caches the user has access to under a resource group. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_ListByResourceGroup.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesListByResourceGroup() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.caches.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +cachesListByResourceGroup().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesStart.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesStart.ts new file mode 100644 index 00000000000..a83648d8d60 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesStart.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Tells a Stopped state Cache to transition to Active state. + * + * @summary Tells a Stopped state Cache to transition to Active state. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Start.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesStart() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginStartAndWait( + resourceGroupName, + cacheName + ); + console.log(result); +} + +cachesStart().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesStop.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesStop.ts new file mode 100644 index 00000000000..a7b067b0b2e --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesStop.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Tells an Active Cache to transition to Stopped state. + * + * @summary Tells an Active Cache to transition to Stopped state. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Stop.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesStop() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginStopAndWait( + resourceGroupName, + cacheName + ); + console.log(result); +} + +cachesStop().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesUpdate.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesUpdate.ts new file mode 100644 index 00000000000..f8845dd0c3e --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesUpdate.ts @@ -0,0 +1,105 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Update a Cache instance. + * + * @summary Update a Cache instance. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Update.json + */ +import { Cache, StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const cache: Cache = { + cacheSizeGB: 3072, + directoryServicesSettings: { + activeDirectory: { + cacheNetBiosName: "contosoSmb", + domainName: "contosoAd.contoso.local", + domainNetBiosName: "contosoAd", + primaryDnsIpAddress: "192.0.2.10", + secondaryDnsIpAddress: "192.0.2.11" + }, + usernameDownload: { extendedGroups: true, usernameSource: "AD" } + }, + location: "westus", + networkSettings: { + dnsSearchDomain: "contoso.com", + dnsServers: ["10.1.22.33", "10.1.12.33"], + mtu: 1500, + ntpServer: "time.contoso.com" + }, + securitySettings: { + accessPolicies: [ + { + name: "default", + accessRules: [ + { + access: "rw", + rootSquash: false, + scope: "default", + submountAccess: true, + suid: false + } + ] + }, + { + name: "restrictive", + accessRules: [ + { + access: "rw", + filter: "10.99.3.145", + rootSquash: false, + scope: "host", + submountAccess: true, + suid: true + }, + { + access: "rw", + filter: "10.99.1.0/24", + rootSquash: false, + scope: "network", + submountAccess: true, + suid: true + }, + { + access: "no", + anonymousGID: "65534", + anonymousUID: "65534", + rootSquash: true, + scope: "default", + submountAccess: true, + suid: false + } + ] + } + ] + }, + sku: { name: "Standard_2G" }, + subnet: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Network/virtualNetworks/scvnet/subnets/sub1", + tags: { dept: "Contoso" } + }; + const options = { cache: cache }; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.update( + resourceGroupName, + cacheName, + options + ); + console.log(result); +} + +cachesUpdate().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesUpdateLdapOnly.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesUpdateLdapOnly.ts new file mode 100644 index 00000000000..015bd9aa1ce --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesUpdateLdapOnly.ts @@ -0,0 +1,107 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Update a Cache instance. + * + * @summary Update a Cache instance. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_Update_ldap_only.json + */ +import { Cache, StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesUpdateLdapOnly() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const cache: Cache = { + cacheSizeGB: 3072, + directoryServicesSettings: { + usernameDownload: { + credentials: { + bindDn: "cn=ldapadmin,dc=contosoad,dc=contoso,dc=local", + bindPassword: "" + }, + extendedGroups: true, + ldapBaseDN: "dc=contosoad,dc=contoso,dc=local", + ldapServer: "192.0.2.12", + usernameSource: "LDAP" + } + }, + location: "westus", + networkSettings: { + dnsSearchDomain: "contoso.com", + dnsServers: ["10.1.22.33", "10.1.12.33"], + mtu: 1500, + ntpServer: "time.contoso.com" + }, + securitySettings: { + accessPolicies: [ + { + name: "default", + accessRules: [ + { + access: "rw", + rootSquash: false, + scope: "default", + submountAccess: true, + suid: false + } + ] + }, + { + name: "restrictive", + accessRules: [ + { + access: "rw", + filter: "10.99.3.145", + rootSquash: false, + scope: "host", + submountAccess: true, + suid: true + }, + { + access: "rw", + filter: "10.99.1.0/24", + rootSquash: false, + scope: "network", + submountAccess: true, + suid: true + }, + { + access: "no", + anonymousGID: "65534", + anonymousUID: "65534", + rootSquash: true, + scope: "default", + submountAccess: true, + suid: false + } + ] + } + ] + }, + sku: { name: "Standard_2G" }, + subnet: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Network/virtualNetworks/scvnet/subnets/sub1", + tags: { dept: "Contoso" } + }; + const options = { cache: cache }; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.update( + resourceGroupName, + cacheName, + options + ); + console.log(result); +} + +cachesUpdateLdapOnly().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesUpgradeFirmware.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesUpgradeFirmware.ts new file mode 100644 index 00000000000..b48c952c8d0 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/cachesUpgradeFirmware.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * + * @summary Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Caches_UpgradeFirmware.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cachesUpgradeFirmware() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.caches.beginUpgradeFirmwareAndWait( + resourceGroupName, + cacheName + ); + console.log(result); +} + +cachesUpgradeFirmware().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/skusList.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/skusList.ts new file mode 100644 index 00000000000..5cf7fc86edb --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/skusList.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the list of StorageCache.Cache SKUs available to this subscription. + * + * @summary Get the list of StorageCache.Cache SKUs available to this subscription. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/Skus_List.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function skusList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.skus.list()) { + resArray.push(item); + } + console.log(resArray); +} + +skusList().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsCreateOrUpdate.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsCreateOrUpdate.ts new file mode 100644 index 00000000000..e555265f656 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsCreateOrUpdate.ts @@ -0,0 +1,58 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @summary Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_CreateOrUpdate.json + */ +import { + StorageTarget, + StorageCacheManagementClient +} from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageTargetsCreateOrUpdate() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const storageTargetName = "st1"; + const storagetarget: StorageTarget = { + junctions: [ + { + namespacePath: "/path/on/cache", + nfsAccessPolicy: "default", + nfsExport: "exp1", + targetPath: "/path/on/exp1" + }, + { + namespacePath: "/path2/on/cache", + nfsAccessPolicy: "rootSquash", + nfsExport: "exp2", + targetPath: "/path2/on/exp2" + } + ], + nfs3: { target: "10.0.44.44", usageModel: "READ_HEAVY_INFREQ" }, + targetType: "nfs3" + }; + const options = { storagetarget: storagetarget }; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargets.beginCreateOrUpdateAndWait( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + console.log(result); +} + +storageTargetsCreateOrUpdate().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsCreateOrUpdateBlobNfs.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsCreateOrUpdateBlobNfs.ts new file mode 100644 index 00000000000..8639aa426f8 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsCreateOrUpdateBlobNfs.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @summary Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_CreateOrUpdate_BlobNfs.json + */ +import { + StorageTarget, + StorageCacheManagementClient +} from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageTargetsCreateOrUpdateBlobNfs() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const storageTargetName = "st1"; + const storagetarget: StorageTarget = { + blobNfs: { + target: + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/scgroup/providers/Microsoft.Storage/storageAccounts/blofnfs/blobServices/default/containers/blobnfs", + usageModel: "WRITE_WORKLOAD_15" + }, + junctions: [{ namespacePath: "/blobnfs" }], + targetType: "blobNfs" + }; + const options = { storagetarget: storagetarget }; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargets.beginCreateOrUpdateAndWait( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + console.log(result); +} + +storageTargetsCreateOrUpdateBlobNfs().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsCreateOrUpdateNoJunctions.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsCreateOrUpdateNoJunctions.ts new file mode 100644 index 00000000000..de23947c3ac --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsCreateOrUpdateNoJunctions.ts @@ -0,0 +1,44 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * + * @summary Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache is healthy again. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_CreateOrUpdate_NoJunctions.json + */ +import { + StorageTarget, + StorageCacheManagementClient +} from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageTargetsCreateOrUpdateNoJunctions() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const storageTargetName = "st1"; + const storagetarget: StorageTarget = { + nfs3: { target: "10.0.44.44", usageModel: "READ_HEAVY_INFREQ" }, + targetType: "nfs3" + }; + const options = { storagetarget: storagetarget }; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargets.beginCreateOrUpdateAndWait( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + console.log(result); +} + +storageTargetsCreateOrUpdateNoJunctions().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsDelete.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsDelete.ts new file mode 100644 index 00000000000..ff833b34265 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsDelete.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be deleted. + * + * @summary Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache is healthy again. Note that if the Cache has data to flush to the Storage Target, the data will be flushed before the Storage Target will be deleted. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Delete.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageTargetsDelete() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const storageTargetName = "st1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargets.beginDeleteAndWait( + resourceGroupName, + cacheName, + storageTargetName + ); + console.log(result); +} + +storageTargetsDelete().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsFlush.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsFlush.ts new file mode 100644 index 00000000000..1f617c06155 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsFlush.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage target's namespace will return errors until the flush operation completes. + * + * @summary Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to this storage target's namespace will return errors until the flush operation completes. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Flush.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageTargetsFlush() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const storageTargetName = "st1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargetOperations.beginFlushAndWait( + resourceGroupName, + cacheName, + storageTargetName + ); + console.log(result); +} + +storageTargetsFlush().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsGet.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsGet.ts new file mode 100644 index 00000000000..62c61ef9d2f --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsGet.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a Storage Target from a Cache. + * + * @summary Returns a Storage Target from a Cache. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Get.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageTargetsGet() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const storageTargetName = "st1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargets.get( + resourceGroupName, + cacheName, + storageTargetName + ); + console.log(result); +} + +storageTargetsGet().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsList.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsList.ts new file mode 100644 index 00000000000..3365d7b6a6b --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsList.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Returns a list of Storage Targets for the specified Cache. + * + * @summary Returns a list of Storage Targets for the specified Cache. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_ListByCache.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageTargetsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageTargets.listByCache( + resourceGroupName, + cacheName + )) { + resArray.push(item); + } + console.log(resArray); +} + +storageTargetsList().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsResume.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsResume.ts new file mode 100644 index 00000000000..3f16364eeb4 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsResume.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Resumes client access to a previously suspended storage target. + * + * @summary Resumes client access to a previously suspended storage target. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Resume.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageTargetsResume() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const storageTargetName = "st1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargetOperations.beginResumeAndWait( + resourceGroupName, + cacheName, + storageTargetName + ); + console.log(result); +} + +storageTargetsResume().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsSuspend.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsSuspend.ts new file mode 100644 index 00000000000..c277968845b --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/storageTargetsSuspend.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Suspends client access to a storage target. + * + * @summary Suspends client access to a storage target. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/StorageTargets_Suspend.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageTargetsSuspend() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const resourceGroupName = "scgroup"; + const cacheName = "sc"; + const storageTargetName = "st1"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const result = await client.storageTargetOperations.beginSuspendAndWait( + resourceGroupName, + cacheName, + storageTargetName + ); + console.log(result); +} + +storageTargetsSuspend().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/usageModelsList.ts b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/usageModelsList.ts new file mode 100644 index 00000000000..d3e1d2706d8 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/src/usageModelsList.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get the list of Cache Usage Models available to this subscription. + * + * @summary Get the list of Cache Usage Models available to this subscription. + * x-ms-original-file: specification/storagecache/resource-manager/Microsoft.StorageCache/stable/2021-09-01/examples/UsageModels_List.json + */ +import { StorageCacheManagementClient } from "@azure/arm-storagecache"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function usageModelsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new StorageCacheManagementClient(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.usageModels.list()) { + resArray.push(item); + } + console.log(resArray); +} + +usageModelsList().catch(console.error); diff --git a/sdk/storagecache/arm-storagecache/samples/v5/typescript/tsconfig.json b/sdk/storagecache/arm-storagecache/samples/v5/typescript/tsconfig.json new file mode 100644 index 00000000000..416c2dd82e0 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/samples/v5/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2018", + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "alwaysStrict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src/**.ts" + ] +} diff --git a/sdk/storagecache/arm-storagecache/src/index.ts b/sdk/storagecache/arm-storagecache/src/index.ts new file mode 100644 index 00000000000..92127b7a821 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +/// +export * from "./models"; +export { StorageCacheManagementClient } from "./storageCacheManagementClient"; +export * from "./operationsInterfaces"; diff --git a/sdk/storagecache/arm-storagecache/src/lroImpl.ts b/sdk/storagecache/arm-storagecache/src/lroImpl.ts new file mode 100644 index 00000000000..518d5f053b4 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/lroImpl.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export class LroImpl implements LongRunningOperation { + constructor( + private sendOperationFn: (args: any, spec: any) => Promise>, + private args: Record, + private spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record, + public requestPath: string = spec.path!, + public requestMethod: string = spec.httpMethod + ) {} + public async sendInitialRequest(): Promise> { + return this.sendOperationFn(this.args, this.spec); + } + public async sendPollRequest(path: string): Promise> { + const { requestBody, ...restSpec } = this.spec; + return this.sendOperationFn(this.args, { + ...restSpec, + path, + httpMethod: "GET" + }); + } +} diff --git a/sdk/storagecache/arm-storagecache/src/models/cachesMappers.ts b/sdk/storagecache/arm-storagecache/src/models/cachesMappers.ts deleted file mode 100644 index 9aed7646cd9..00000000000 --- a/sdk/storagecache/arm-storagecache/src/models/cachesMappers.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - BaseResource, - BlobNfsTarget, - Cache, - CacheActiveDirectorySettings, - CacheActiveDirectorySettingsCredentials, - CacheDirectorySettings, - CacheEncryptionSettings, - CacheHealth, - CacheIdentity, - CacheNetworkSettings, - CacheSecuritySettings, - CacheSku, - CachesListResult, - CacheUpgradeStatus, - CacheUsernameDownloadSettings, - CacheUsernameDownloadSettingsCredentials, - ClfsTarget, - CloudError, - Condition, - KeyVaultKeyReference, - KeyVaultKeyReferenceSourceVault, - NamespaceJunction, - Nfs3Target, - NfsAccessPolicy, - NfsAccessRule, - StorageTarget, - StorageTargetResource, - SystemData, - UnknownTarget -} from "../models/mappers"; diff --git a/sdk/storagecache/arm-storagecache/src/models/index.ts b/sdk/storagecache/arm-storagecache/src/models/index.ts index 969068b2dc0..786f9205497 100644 --- a/sdk/storagecache/arm-storagecache/src/models/index.ts +++ b/sdk/storagecache/arm-storagecache/src/models/index.ts @@ -6,1577 +6,1160 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export { BaseResource, CloudError }; - -/** - * The object that represents the operation. - */ -export interface ApiOperationDisplay { - /** - * Operation type: Read, write, delete, etc. - */ - operation?: string; - /** - * Service provider: Microsoft.StorageCache - */ - provider?: string; - /** - * Resource on which the operation is performed: Cache, etc. - */ - resource?: string; - /** - * The description of the operation - */ - description?: string; +/** Result of the request to list Resource Provider operations. It contains a list of operations and a URL link to get the next set of results. */ +export interface ApiOperationListResult { + /** URL to get the next set of operation list results if there are any. */ + nextLink?: string; + /** List of Resource Provider operations supported by the Microsoft.StorageCache resource provider. */ + value?: ApiOperation[]; } -/** - * Specifications of the Dimension of metrics. - */ -export interface MetricDimension { - /** - * Name of the dimension - */ - name?: string; - /** - * Localized friendly display name of the dimension - */ - displayName?: string; - /** - * Internal name of the dimension. - */ - internalName?: string; - /** - * To be exported to shoe box. - */ - toBeExportedForShoebox?: boolean; -} - -/** - * Details about operation related to metrics. - */ -export interface MetricSpecification { - /** - * The name of the metric. - */ - name?: string; - /** - * Localized display name of the metric. - */ - displayName?: string; - /** - * The description of the metric. - */ - displayDescription?: string; - /** - * The unit that the metric is measured in. - */ - unit?: string; - /** - * The type of metric aggregation. - */ - aggregationType?: string; - /** - * Support metric aggregation type. - */ - supportedAggregationTypes?: MetricAggregationType[]; - /** - * Type of metrics. - */ - metricClass?: string; - /** - * Dimensions of the metric - */ - dimensions?: MetricDimension[]; -} - -/** - * Specification of the all the metrics provided for a resource type. - */ -export interface ApiOperationPropertiesServiceSpecification { - /** - * Details about operations related to metrics. - */ - metricSpecifications?: MetricSpecification[]; -} - -/** - * REST API operation description: see - * https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/openapi-authoring-automated-guidelines.md#r3023-operationsapiimplementation - */ +/** REST API operation description: see https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/openapi-authoring-automated-guidelines.md#r3023-operationsapiimplementation */ export interface ApiOperation { - /** - * The object that represents the operation. - */ + /** The object that represents the operation. */ display?: ApiOperationDisplay; - /** - * Origin of the operation. - */ + /** Origin of the operation. */ origin?: string; - /** - * The flag that indicates whether the operation applies to data plane. - */ + /** The flag that indicates whether the operation applies to data plane. */ isDataAction?: boolean; - /** - * Operation name: {provider}/{resource}/{operation} - */ + /** Operation name: {provider}/{resource}/{operation} */ name?: string; - /** - * Specification of the all the metrics provided for a resource type. - */ + /** Specification of the all the metrics provided for a resource type. */ serviceSpecification?: ApiOperationPropertiesServiceSpecification; } -/** - * An error response. - */ +/** The object that represents the operation. */ +export interface ApiOperationDisplay { + /** Operation type: Read, write, delete, etc. */ + operation?: string; + /** Service provider: Microsoft.StorageCache */ + provider?: string; + /** Resource on which the operation is performed: Cache, etc. */ + resource?: string; + /** The description of the operation */ + description?: string; +} + +/** Specification of the all the metrics provided for a resource type. */ +export interface ApiOperationPropertiesServiceSpecification { + /** Details about operations related to metrics. */ + metricSpecifications?: MetricSpecification[]; +} + +/** Details about operation related to metrics. */ +export interface MetricSpecification { + /** The name of the metric. */ + name?: string; + /** Localized display name of the metric. */ + displayName?: string; + /** The description of the metric. */ + displayDescription?: string; + /** The unit that the metric is measured in. */ + unit?: string; + /** The type of metric aggregation. */ + aggregationType?: string; + /** Support metric aggregation type. */ + supportedAggregationTypes?: MetricAggregationType[]; + /** Type of metrics. */ + metricClass?: string; + /** Dimensions of the metric */ + dimensions?: MetricDimension[]; +} + +/** Specifications of the Dimension of metrics. */ +export interface MetricDimension { + /** Name of the dimension */ + name?: string; + /** Localized friendly display name of the dimension */ + displayName?: string; + /** Internal name of the dimension. */ + internalName?: string; + /** To be exported to shoe box. */ + toBeExportedForShoebox?: boolean; +} + +/** An error response. */ +export interface CloudError { + /** The body of the error. */ + error?: CloudErrorBody; +} + +/** An error response. */ export interface CloudErrorBody { - /** - * An identifier for the error. Codes are invariant and are intended to be consumed - * programmatically. - */ + /** An identifier for the error. Codes are invariant and are intended to be consumed programmatically. */ code?: string; - /** - * A list of additional details about the error. - */ + /** A list of additional details about the error. */ details?: CloudErrorBody[]; - /** - * A message describing the error, intended to be suitable for display in a user interface. - */ + /** A message describing the error, intended to be suitable for display in a user interface. */ message?: string; - /** - * The target of the particular error. For example, the name of the property in error. - */ + /** The target of the particular error. For example, the name of the property in error. */ target?: string; } -/** - * Describes the format of Error response. - */ +/** The response from the List Cache SKUs operation. */ +export interface ResourceSkusResult { + /** The URI to fetch the next page of Cache SKUs. */ + nextLink?: string; + /** + * The list of SKUs available for the subscription. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly value?: ResourceSku[]; +} + +/** A resource SKU. */ +export interface ResourceSku { + /** + * The type of resource the SKU applies to. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly resourceType?: string; + /** A list of capabilities of this SKU, such as throughput or ops/sec. */ + capabilities?: ResourceSkuCapabilities[]; + /** + * The set of locations where the SKU is available. This is the supported and registered Azure Geo Regions (e.g., West US, East US, Southeast Asia, etc.). + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly locations?: string[]; + /** The set of locations where the SKU is available. */ + locationInfo?: ResourceSkuLocationInfo[]; + /** The name of this SKU. */ + name?: string; + /** The restrictions preventing this SKU from being used. This is empty if there are no restrictions. */ + restrictions?: Restriction[]; +} + +/** A resource SKU capability. */ +export interface ResourceSkuCapabilities { + /** Name of a capability, such as ops/sec. */ + name?: string; + /** Quantity, if the capability is measured by quantity. */ + value?: string; +} + +/** Resource SKU location information. */ +export interface ResourceSkuLocationInfo { + /** Location where this SKU is available. */ + location?: string; + /** Zones if any. */ + zones?: string[]; +} + +/** The restrictions preventing this SKU from being used. */ +export interface Restriction { + /** + * The type of restrictions. In this version, the only possible value for this is location. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; + /** + * The value of restrictions. If the restriction type is set to location, then this would be the different locations where the SKU is restricted. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly values?: string[]; + /** The reason for the restriction. As of now this can be "QuotaId" or "NotAvailableForSubscription". "QuotaId" is set when the SKU has requiredQuotas parameter as the subscription does not belong to that quota. "NotAvailableForSubscription" is related to capacity at the datacenter. */ + reasonCode?: ReasonCode; +} + +/** A list of Cache usage models. */ +export interface UsageModelsResult { + /** The URI to fetch the next page of Cache usage models. */ + nextLink?: string; + /** The list of usage models available for the subscription. */ + value?: UsageModel[]; +} + +/** A usage model. */ +export interface UsageModel { + /** Localized information describing this usage model. */ + display?: UsageModelDisplay; + /** Non-localized keyword name for this usage model. */ + modelName?: string; + /** The type of Storage Target to which this model is applicable (only nfs3 as of this version). */ + targetType?: string; +} + +/** Localized information describing this usage model. */ +export interface UsageModelDisplay { + /** String to display for this usage model. */ + description?: string; +} + +/** The status of operation. */ +export interface AscOperation { + /** The operation Id. */ + id?: string; + /** The operation name. */ + name?: string; + /** The start time of the operation. */ + startTime?: string; + /** The end time of the operation. */ + endTime?: string; + /** The status of the operation. */ + status?: string; + /** The error detail of the operation if any. */ + error?: ErrorResponse; + /** Additional operation-specific output. */ + output?: { [propertyName: string]: Record }; +} + +/** Describes the format of Error response. */ export interface ErrorResponse { - /** - * Error code - */ + /** Error code */ code?: string; - /** - * Error message indicating why the operation failed. - */ + /** Error message indicating why the operation failed. */ message?: string; } -/** - * The status of operation. - */ -export interface AscOperation { - /** - * The operation Id. - */ - id?: string; - /** - * The operation name. - */ - name?: string; - /** - * The start time of the operation. - */ - startTime?: string; - /** - * The end time of the operation. - */ - endTime?: string; - /** - * The status of the operation. - */ - status?: string; - /** - * The error detail of the operation if any. - */ - error?: ErrorResponse; - /** - * Additional operation-specific output. - */ - output?: { [propertyName: string]: any }; +/** Result of the request to list Caches. It contains a list of Caches and a URL link to get the next set of results. */ +export interface CachesListResult { + /** URL to get the next set of Cache list results, if there are any. */ + nextLink?: string; + /** List of Caches. */ + value?: Cache[]; } -/** - * Cache identity properties. - */ -export interface CacheIdentity { - /** - * The principal id of the cache. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly principalId?: string; - /** - * The tenant id associated with the cache. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly tenantId?: string; - /** - * The type of identity used for the cache. Possible values include: 'SystemAssigned', 'None' - */ - type?: CacheIdentityType; -} - -/** - * 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. Possible values include: 'User', - * 'Application', 'ManagedIdentity', 'Key' - */ - 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. Possible values include: 'User', - * 'Application', 'ManagedIdentity', 'Key' - */ - lastModifiedByType?: CreatedByType; - /** - * The timestamp of resource last modification (UTC) - */ - lastModifiedAt?: Date; -} - -/** - * Outstanding conditions that will need to be resolved. - */ -export interface Condition { - /** - * The time when the condition was raised. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly timestamp?: Date; - /** - * The issue requiring attention. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly message?: string; -} - -/** - * An indication of Cache health. Gives more information about health than just that related to - * provisioning. - */ -export interface CacheHealth { - /** - * List of Cache health states. Possible values include: 'Unknown', 'Healthy', 'Degraded', - * 'Down', 'Transitioning', 'Stopping', 'Stopped', 'Upgrading', 'Flushing' - */ - state?: HealthStateType; - /** - * Describes explanation of state. - */ - statusDescription?: string; - /** - * Outstanding conditions that need to be investigated and resolved. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly conditions?: Condition[]; -} - -/** - * Properties describing the software upgrade state of the Cache. - */ -export interface CacheUpgradeStatus { - /** - * Version string of the firmware currently installed on this Cache. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly currentFirmwareVersion?: string; - /** - * True if there is a firmware update ready to install on this Cache. The firmware will - * automatically be installed after firmwareUpdateDeadline if not triggered earlier via the - * upgrade operation. Possible values include: 'available', 'unavailable' - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly firmwareUpdateStatus?: FirmwareStatusType; - /** - * Time at which the pending firmware update will automatically be installed on the Cache. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly firmwareUpdateDeadline?: Date; - /** - * Time of the last successful firmware update. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly lastFirmwareUpdate?: Date; - /** - * When firmwareUpdateAvailable is true, this field holds the version string for the update. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly pendingFirmwareVersion?: string; -} - -/** - * Cache network settings. - */ -export interface CacheNetworkSettings { - /** - * The IPv4 maximum transmission unit configured for the subnet. Default value: 1500. - */ - mtu?: number; - /** - * Array of additional IP addresses used by this Cache. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly utilityAddresses?: string[]; - /** - * DNS servers for the cache to use. It will be set from the network configuration if no value - * is provided. - */ - dnsServers?: string[]; - /** - * DNS search domain - */ - dnsSearchDomain?: string; - /** - * NTP server IP Address or FQDN for the cache to use. The default is time.windows.com. - */ - ntpServer?: string; -} - -/** - * Describes a resource Id to source Key Vault. - */ -export interface KeyVaultKeyReferenceSourceVault { - /** - * Resource Id. - */ - id?: string; -} - -/** - * Describes a reference to Key Vault Key. - */ -export interface KeyVaultKeyReference { - /** - * The URL referencing a key encryption key in Key Vault. - */ - keyUrl: string; - /** - * Describes a resource Id to source Key Vault. - */ - sourceVault: KeyVaultKeyReferenceSourceVault; -} - -/** - * Cache encryption settings. - */ -export interface CacheEncryptionSettings { - /** - * Specifies the location of the key encryption key in Key Vault. - */ - keyEncryptionKey?: KeyVaultKeyReference; -} - -/** - * Rule to place restrictions on portions of the cache namespace being presented to clients. - */ -export interface NfsAccessRule { - /** - * Scope for this rule. The scope and filter determine which clients match the rule. Possible - * values include: 'default', 'network', 'host' - */ - scope: NfsAccessRuleScope; - /** - * Filter applied to the scope for this rule. The filter's format depends on its scope. 'default' - * scope matches all clients and has no filter value. 'network' scope takes a filter in CIDR - * format (for example, 10.99.1.0/24). 'host' takes an IP address or fully qualified domain name - * as filter. If a client does not match any filter rule and there is no default rule, access is - * denied. - */ - filter?: string; - /** - * Access allowed by this rule. Possible values include: 'no', 'ro', 'rw' - */ - access: NfsAccessRuleAccess; - /** - * Allow SUID semantics. - */ - suid?: boolean; - /** - * For the default policy, allow access to subdirectories under the root export. If this is set - * to no, clients can only mount the path '/'. If set to yes, clients can mount a deeper path, - * like '/a/b'. - */ - submountAccess?: boolean; - /** - * Map root accesses to anonymousUID and anonymousGID. - */ - rootSquash?: boolean; - /** - * UID value that replaces 0 when rootSquash is true. 65534 will be used if not provided. - */ - anonymousUID?: string; - /** - * GID value that replaces 0 when rootSquash is true. This will use the value of anonymousUID if - * not provided. - */ - anonymousGID?: string; -} - -/** - * A set of rules describing access policies applied to NFSv3 clients of the cache. - */ -export interface NfsAccessPolicy { - /** - * Name identifying this policy. Access Policy names are not case sensitive. - */ - name: string; - /** - * The set of rules describing client accesses allowed under this policy. - */ - accessRules: NfsAccessRule[]; -} - -/** - * Cache security settings. - */ -export interface CacheSecuritySettings { - /** - * NFS access policies defined for this cache. - */ - accessPolicies?: NfsAccessPolicy[]; -} - -/** - * Active Directory admin credentials used to join the HPC Cache to a domain. - */ -export interface CacheActiveDirectorySettingsCredentials { - /** - * Username of the Active Directory domain administrator. This value is stored encrypted and not - * returned on response. - */ - username: string; - /** - * Plain text password of the Active Directory domain administrator. This value is stored - * encrypted and not returned on response. - */ - password: string; -} - -/** - * Active Directory settings used to join a cache to a domain. - */ -export interface CacheActiveDirectorySettings { - /** - * Primary DNS IP address used to resolve the Active Directory domain controller's fully - * qualified domain name. - */ - primaryDnsIpAddress: string; - /** - * Secondary DNS IP address used to resolve the Active Directory domain controller's fully - * qualified domain name. - */ - secondaryDnsIpAddress?: string; - /** - * The fully qualified domain name of the Active Directory domain controller. - */ - domainName: string; - /** - * The Active Directory domain's NetBIOS name. - */ - domainNetBiosName: string; - /** - * The NetBIOS name to assign to the HPC Cache when it joins the Active Directory domain as a - * server. Length must 1-15 characters from the class [-0-9a-zA-Z]. - */ - cacheNetBiosName: string; - /** - * True if the HPC Cache is joined to the Active Directory domain. Possible values include: - * 'Yes', 'No', 'Error' - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly domainJoined?: DomainJoinedType; - /** - * Active Directory admin credentials used to join the HPC Cache to a domain. - */ - credentials?: CacheActiveDirectorySettingsCredentials; -} - -/** - * When present, these are the credentials for the secure LDAP connection. - */ -export interface CacheUsernameDownloadSettingsCredentials { - /** - * The Bind Distinguished Name identity to be used in the secure LDAP connection. This value is - * stored encrypted and not returned on response. - */ - bindDn?: string; - /** - * The Bind password to be used in the secure LDAP connection. This value is stored encrypted and - * not returned on response. - */ - bindPassword?: string; -} - -/** - * Settings for Extended Groups username and group download. - */ -export interface CacheUsernameDownloadSettings { - /** - * Whether or not Extended Groups is enabled. - */ - extendedGroups?: boolean; - /** - * This setting determines how the cache gets username and group names for clients. Possible - * values include: 'AD', 'LDAP', 'File', 'None'. Default value: 'None'. - */ - usernameSource?: UsernameSource; - /** - * The URI of the file containing group information (in /etc/group file format). This field must - * be populated when 'usernameSource' is set to 'File'. - */ - groupFileURI?: string; - /** - * The URI of the file containing user information (in /etc/passwd file format). This field must - * be populated when 'usernameSource' is set to 'File'. - */ - userFileURI?: string; - /** - * The fully qualified domain name or IP address of the LDAP server to use. - */ - ldapServer?: string; - /** - * The base distinguished name for the LDAP domain. - */ - ldapBaseDN?: string; - /** - * Whether or not the LDAP connection should be encrypted. - */ - encryptLdapConnection?: boolean; - /** - * Determines if the certificates must be validated by a certificate authority. When true, - * caCertificateURI must be provided. - */ - requireValidCertificate?: boolean; - /** - * Determines if the certificate should be automatically downloaded. This applies to - * 'caCertificateURI' only if 'requireValidCertificate' is true. - */ - autoDownloadCertificate?: boolean; - /** - * The URI of the CA certificate to validate the LDAP secure connection. This field must be - * populated when 'requireValidCertificate' is set to true. - */ - caCertificateURI?: string; - /** - * Indicates whether or not the HPC Cache has performed the username download successfully. - * Possible values include: 'Yes', 'No', 'Error' - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly usernameDownloaded?: UsernameDownloadedType; - /** - * When present, these are the credentials for the secure LDAP connection. - */ - credentials?: CacheUsernameDownloadSettingsCredentials; -} - -/** - * Cache Directory Services settings. - */ -export interface CacheDirectorySettings { - /** - * Specifies settings for joining the HPC Cache to an Active Directory domain. - */ - activeDirectory?: CacheActiveDirectorySettings; - /** - * Specifies settings for Extended Groups. Extended Groups allows users to be members of more - * than 16 groups. - */ - usernameDownload?: CacheUsernameDownloadSettings; -} - -/** - * SKU for the Cache. - */ -export interface CacheSku { - /** - * SKU name for this Cache. - */ - name?: string; -} - -/** - * A Cache instance. Follows Azure Resource Manager standards: - * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md - */ -export interface Cache extends BaseResource { - /** - * Resource tags. - */ +/** A Cache instance. Follows Azure Resource Manager standards: https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/resource-api-reference.md */ +export interface Cache { + /** Resource tags. */ tags?: { [propertyName: string]: string }; /** * Resource ID of the Cache. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly id?: string; - /** - * Region name string. - */ + /** Region name string. */ location?: string; /** * Name of Cache. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly name?: string; /** * Type of the Cache; Microsoft.StorageCache/Cache - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly type?: string; - /** - * The identity of the cache, if configured. - */ + /** The identity of the cache, if configured. */ identity?: CacheIdentity; /** * The system meta data relating to this resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly systemData?: SystemData; - /** - * The size of this Cache, in GB. - */ + /** SKU for the Cache. */ + sku?: CacheSku; + /** The size of this Cache, in GB. */ cacheSizeGB?: number; /** * Health of the Cache. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly health?: CacheHealth; /** * Array of IP addresses that can be used by clients mounting this Cache. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly mountAddresses?: string[]; /** - * ARM provisioning state, see - * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. - * Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', 'Deleting', - * 'Updating' - */ - provisioningState?: ProvisioningStateType; - /** - * Subnet used for the Cache. + * ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property + * NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly provisioningState?: ProvisioningStateType; + /** Subnet used for the Cache. */ subnet?: string; /** * Upgrade status of the Cache. + * NOTE: This property will not be serialized. It can only be populated by the server. */ - upgradeStatus?: CacheUpgradeStatus; - /** - * Specifies network settings of the cache. - */ + readonly upgradeStatus?: CacheUpgradeStatus; + /** Specifies network settings of the cache. */ networkSettings?: CacheNetworkSettings; - /** - * Specifies encryption settings of the cache. - */ + /** Specifies encryption settings of the cache. */ encryptionSettings?: CacheEncryptionSettings; - /** - * Specifies security settings of the cache. - */ + /** Specifies security settings of the cache. */ securitySettings?: CacheSecuritySettings; - /** - * Specifies Directory Services settings of the cache. - */ + /** Specifies Directory Services settings of the cache. */ directoryServicesSettings?: CacheDirectorySettings; - /** - * SKU for the Cache. - */ - sku?: CacheSku; } -/** - * A namespace junction. - */ +/** Cache identity properties. */ +export interface CacheIdentity { + /** + * The principal ID for the system-assigned identity of the cache. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * The tenant ID associated with the cache. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tenantId?: string; + /** The type of identity used for the cache */ + type?: CacheIdentityType; + /** A dictionary where each key is a user assigned identity resource ID, and each key's value is an empty dictionary. */ + userAssignedIdentities?: { + [propertyName: string]: UserAssignedIdentitiesValue; + }; +} + +export interface UserAssignedIdentitiesValue { + /** + * The principal ID of the user-assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly principalId?: string; + /** + * The client ID of the user-assigned identity. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly clientId?: string; +} + +/** 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; +} + +/** An indication of Cache health. Gives more information about health than just that related to provisioning. */ +export interface CacheHealth { + /** List of Cache health states. */ + state?: HealthStateType; + /** Describes explanation of state. */ + statusDescription?: string; + /** + * Outstanding conditions that need to be investigated and resolved. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly conditions?: Condition[]; +} + +/** Outstanding conditions that will need to be resolved. */ +export interface Condition { + /** + * The time when the condition was raised. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly timestamp?: Date; + /** + * The issue requiring attention. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly message?: string; +} + +/** Properties describing the software upgrade state of the Cache. */ +export interface CacheUpgradeStatus { + /** + * Version string of the firmware currently installed on this Cache. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly currentFirmwareVersion?: string; + /** + * True if there is a firmware update ready to install on this Cache. The firmware will automatically be installed after firmwareUpdateDeadline if not triggered earlier via the upgrade operation. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly firmwareUpdateStatus?: FirmwareStatusType; + /** + * Time at which the pending firmware update will automatically be installed on the Cache. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly firmwareUpdateDeadline?: Date; + /** + * Time of the last successful firmware update. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastFirmwareUpdate?: Date; + /** + * When firmwareUpdateAvailable is true, this field holds the version string for the update. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly pendingFirmwareVersion?: string; +} + +/** Cache network settings. */ +export interface CacheNetworkSettings { + /** The IPv4 maximum transmission unit configured for the subnet. */ + mtu?: number; + /** + * Array of additional IP addresses used by this Cache. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly utilityAddresses?: string[]; + /** DNS servers for the cache to use. It will be set from the network configuration if no value is provided. */ + dnsServers?: string[]; + /** DNS search domain */ + dnsSearchDomain?: string; + /** NTP server IP Address or FQDN for the cache to use. The default is time.windows.com. */ + ntpServer?: string; +} + +/** Cache encryption settings. */ +export interface CacheEncryptionSettings { + /** Specifies the location of the key encryption key in Key Vault. */ + keyEncryptionKey?: KeyVaultKeyReference; + /** Specifies whether the service will automatically rotate to the newest version of the key in the Key Vault. */ + rotationToLatestKeyVersionEnabled?: boolean; +} + +/** Describes a reference to Key Vault Key. */ +export interface KeyVaultKeyReference { + /** The URL referencing a key encryption key in Key Vault. */ + keyUrl: string; + /** Describes a resource Id to source Key Vault. */ + sourceVault: KeyVaultKeyReferenceSourceVault; +} + +/** Describes a resource Id to source Key Vault. */ +export interface KeyVaultKeyReferenceSourceVault { + /** Resource Id. */ + id?: string; +} + +/** Cache security settings. */ +export interface CacheSecuritySettings { + /** NFS access policies defined for this cache. */ + accessPolicies?: NfsAccessPolicy[]; +} + +/** A set of rules describing access policies applied to NFSv3 clients of the cache. */ +export interface NfsAccessPolicy { + /** Name identifying this policy. Access Policy names are not case sensitive. */ + name: string; + /** The set of rules describing client accesses allowed under this policy. */ + accessRules: NfsAccessRule[]; +} + +/** Rule to place restrictions on portions of the cache namespace being presented to clients. */ +export interface NfsAccessRule { + /** Scope for this rule. The scope and filter determine which clients match the rule. */ + scope: NfsAccessRuleScope; + /** Filter applied to the scope for this rule. The filter's format depends on its scope. 'default' scope matches all clients and has no filter value. 'network' scope takes a filter in CIDR format (for example, 10.99.1.0/24). 'host' takes an IP address or fully qualified domain name as filter. If a client does not match any filter rule and there is no default rule, access is denied. */ + filter?: string; + /** Access allowed by this rule. */ + access: NfsAccessRuleAccess; + /** Allow SUID semantics. */ + suid?: boolean; + /** For the default policy, allow access to subdirectories under the root export. If this is set to no, clients can only mount the path '/'. If set to yes, clients can mount a deeper path, like '/a/b'. */ + submountAccess?: boolean; + /** Map root accesses to anonymousUID and anonymousGID. */ + rootSquash?: boolean; + /** UID value that replaces 0 when rootSquash is true. 65534 will be used if not provided. */ + anonymousUID?: string; + /** GID value that replaces 0 when rootSquash is true. This will use the value of anonymousUID if not provided. */ + anonymousGID?: string; +} + +/** Cache Directory Services settings. */ +export interface CacheDirectorySettings { + /** Specifies settings for joining the HPC Cache to an Active Directory domain. */ + activeDirectory?: CacheActiveDirectorySettings; + /** Specifies settings for Extended Groups. Extended Groups allows users to be members of more than 16 groups. */ + usernameDownload?: CacheUsernameDownloadSettings; +} + +/** Active Directory settings used to join a cache to a domain. */ +export interface CacheActiveDirectorySettings { + /** Primary DNS IP address used to resolve the Active Directory domain controller's fully qualified domain name. */ + primaryDnsIpAddress: string; + /** Secondary DNS IP address used to resolve the Active Directory domain controller's fully qualified domain name. */ + secondaryDnsIpAddress?: string; + /** The fully qualified domain name of the Active Directory domain controller. */ + domainName: string; + /** The Active Directory domain's NetBIOS name. */ + domainNetBiosName: string; + /** The NetBIOS name to assign to the HPC Cache when it joins the Active Directory domain as a server. Length must 1-15 characters from the class [-0-9a-zA-Z]. */ + cacheNetBiosName: string; + /** + * True if the HPC Cache is joined to the Active Directory domain. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly domainJoined?: DomainJoinedType; + /** Active Directory admin credentials used to join the HPC Cache to a domain. */ + credentials?: CacheActiveDirectorySettingsCredentials; +} + +/** Active Directory admin credentials used to join the HPC Cache to a domain. */ +export interface CacheActiveDirectorySettingsCredentials { + /** Username of the Active Directory domain administrator. This value is stored encrypted and not returned on response. */ + username: string; + /** Plain text password of the Active Directory domain administrator. This value is stored encrypted and not returned on response. */ + password: string; +} + +/** Settings for Extended Groups username and group download. */ +export interface CacheUsernameDownloadSettings { + /** Whether or not Extended Groups is enabled. */ + extendedGroups?: boolean; + /** This setting determines how the cache gets username and group names for clients. */ + usernameSource?: UsernameSource; + /** The URI of the file containing group information (in /etc/group file format). This field must be populated when 'usernameSource' is set to 'File'. */ + groupFileURI?: string; + /** The URI of the file containing user information (in /etc/passwd file format). This field must be populated when 'usernameSource' is set to 'File'. */ + userFileURI?: string; + /** The fully qualified domain name or IP address of the LDAP server to use. */ + ldapServer?: string; + /** The base distinguished name for the LDAP domain. */ + ldapBaseDN?: string; + /** Whether or not the LDAP connection should be encrypted. */ + encryptLdapConnection?: boolean; + /** Determines if the certificates must be validated by a certificate authority. When true, caCertificateURI must be provided. */ + requireValidCertificate?: boolean; + /** Determines if the certificate should be automatically downloaded. This applies to 'caCertificateURI' only if 'requireValidCertificate' is true. */ + autoDownloadCertificate?: boolean; + /** The URI of the CA certificate to validate the LDAP secure connection. This field must be populated when 'requireValidCertificate' is set to true. */ + caCertificateURI?: string; + /** + * Indicates whether or not the HPC Cache has performed the username download successfully. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly usernameDownloaded?: UsernameDownloadedType; + /** When present, these are the credentials for the secure LDAP connection. */ + credentials?: CacheUsernameDownloadSettingsCredentials; +} + +/** When present, these are the credentials for the secure LDAP connection. */ +export interface CacheUsernameDownloadSettingsCredentials { + /** The Bind Distinguished Name identity to be used in the secure LDAP connection. This value is stored encrypted and not returned on response. */ + bindDn?: string; + /** The Bind password to be used in the secure LDAP connection. This value is stored encrypted and not returned on response. */ + bindPassword?: string; +} + +/** SKU for the Cache. */ +export interface CacheSku { + /** SKU name for this Cache. */ + name?: string; +} + +/** A list of Storage Targets. */ +export interface StorageTargetsResult { + /** The URI to fetch the next page of Storage Targets. */ + nextLink?: string; + /** The list of Storage Targets defined for the Cache. */ + value?: StorageTarget[]; +} + +/** A namespace junction. */ export interface NamespaceJunction { - /** - * Namespace path on a Cache for a Storage Target. - */ + /** Namespace path on a Cache for a Storage Target. */ namespacePath?: string; - /** - * Path in Storage Target to which namespacePath points. - */ + /** Path in Storage Target to which namespacePath points. */ targetPath?: string; - /** - * NFS export where targetPath exists. - */ + /** NFS export where targetPath exists. */ nfsExport?: string; - /** - * Name of the access policy applied to this junction. - */ + /** Name of the access policy applied to this junction. */ nfsAccessPolicy?: string; } -/** - * Properties pertaining to the Nfs3Target - */ +/** Properties pertaining to the Nfs3Target */ export interface Nfs3Target { - /** - * IP address or host name of an NFSv3 host (e.g., 10.0.44.44). - */ + /** IP address or host name of an NFSv3 host (e.g., 10.0.44.44). */ target?: string; - /** - * Identifies the StorageCache usage model to be used for this storage target. - */ + /** Identifies the StorageCache usage model to be used for this storage target. */ usageModel?: string; } -/** - * Properties pertaining to the ClfsTarget - */ +/** Properties pertaining to the ClfsTarget */ export interface ClfsTarget { - /** - * Resource ID of storage container. - */ + /** Resource ID of storage container. */ target?: string; } -/** - * Properties pertaining to the UnknownTarget - */ +/** Properties pertaining to the UnknownTarget */ export interface UnknownTarget { - /** - * Dictionary of string->string pairs containing information about the Storage Target. - */ + /** Dictionary of string->string pairs containing information about the Storage Target. */ attributes?: { [propertyName: string]: string }; } -/** - * Properties pertaining to the BlobNfsTarget. - */ +/** Properties pertaining to the BlobNfsTarget. */ export interface BlobNfsTarget { - /** - * Resource ID of the storage container. - */ + /** Resource ID of the storage container. */ target?: string; - /** - * Identifies the StorageCache usage model to be used for this storage target. - */ + /** Identifies the StorageCache usage model to be used for this storage target. */ usageModel?: string; } -/** - * Resource used by a Cache. - */ -export interface StorageTargetResource extends BaseResource { +/** Resource used by a Cache. */ +export interface StorageTargetResource { /** * Name of the Storage Target. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly name?: string; /** * Resource ID of the Storage Target. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly id?: string; /** * Type of the Storage Target; Microsoft.StorageCache/Cache/StorageTarget - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly type?: string; /** * Region name string. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly location?: string; /** * The system meta data relating to this resource. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly systemData?: SystemData; } -/** - * Type of the Storage Target. - */ -export interface StorageTarget extends StorageTargetResource { - /** - * List of Cache namespace junctions to target for namespace associations. - */ +/** Type of the Storage Target. */ +export type StorageTarget = StorageTargetResource & { + /** List of Cache namespace junctions to target for namespace associations. */ junctions?: NamespaceJunction[]; + /** Type of the Storage Target. */ + targetType?: StorageTargetType; /** - * Type of the Storage Target. Possible values include: 'nfs3', 'clfs', 'unknown', 'blobNfs' - */ - targetType: StorageTargetType; - /** - * ARM provisioning state, see - * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property. - * Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', 'Deleting', - * 'Updating' - */ - provisioningState?: ProvisioningStateType; - /** - * Properties when targetType is nfs3. + * ARM provisioning state, see https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#provisioningstate-property + * NOTE: This property will not be serialized. It can only be populated by the server. */ + readonly provisioningState?: ProvisioningStateType; + /** Storage target operational state. */ + state?: OperationalStateType; + /** Properties when targetType is nfs3. */ nfs3?: Nfs3Target; - /** - * Properties when targetType is clfs. - */ + /** Properties when targetType is clfs. */ clfs?: ClfsTarget; - /** - * Properties when targetType is unknown. - */ + /** Properties when targetType is unknown. */ unknown?: UnknownTarget; - /** - * Properties when targetType is blobNfs. - */ + /** Properties when targetType is blobNfs. */ blobNfs?: BlobNfsTarget; +}; + +/** Known values of {@link MetricAggregationType} that the service accepts. */ +export enum KnownMetricAggregationType { + NotSpecified = "NotSpecified", + None = "None", + Average = "Average", + Minimum = "Minimum", + Maximum = "Maximum", + Total = "Total", + Count = "Count" } /** - * A resource SKU capability. + * Defines values for MetricAggregationType. \ + * {@link KnownMetricAggregationType} can be used interchangeably with MetricAggregationType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **NotSpecified** \ + * **None** \ + * **Average** \ + * **Minimum** \ + * **Maximum** \ + * **Total** \ + * **Count** */ -export interface ResourceSkuCapabilities { - /** - * Name of a capability, such as ops/sec. - */ - name?: string; - /** - * Quantity, if the capability is measured by quantity. - */ - value?: string; +export type MetricAggregationType = string; + +/** Known values of {@link ReasonCode} that the service accepts. */ +export enum KnownReasonCode { + QuotaId = "QuotaId", + NotAvailableForSubscription = "NotAvailableForSubscription" } /** - * Resource SKU location information. + * Defines values for ReasonCode. \ + * {@link KnownReasonCode} can be used interchangeably with ReasonCode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **QuotaId** \ + * **NotAvailableForSubscription** */ -export interface ResourceSkuLocationInfo { - /** - * Location where this SKU is available. - */ - location?: string; - /** - * Zones if any. - */ - zones?: string[]; +export type ReasonCode = string; + +/** Known values of {@link CreatedByType} that the service accepts. */ +export enum KnownCreatedByType { + User = "User", + Application = "Application", + ManagedIdentity = "ManagedIdentity", + Key = "Key" } /** - * The restrictions preventing this SKU from being used. + * Defines values for CreatedByType. \ + * {@link KnownCreatedByType} can be used interchangeably with CreatedByType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **User** \ + * **Application** \ + * **ManagedIdentity** \ + * **Key** */ -export interface Restriction { - /** - * The type of restrictions. In this version, the only possible value for this is location. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; - /** - * The value of restrictions. If the restriction type is set to location, then this would be the - * different locations where the SKU is restricted. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly values?: string[]; - /** - * The reason for the restriction. As of now this can be "QuotaId" or - * "NotAvailableForSubscription". "QuotaId" is set when the SKU has requiredQuotas parameter as - * the subscription does not belong to that quota. "NotAvailableForSubscription" is related to - * capacity at the datacenter. Possible values include: 'QuotaId', 'NotAvailableForSubscription' - */ - reasonCode?: ReasonCode; +export type CreatedByType = string; + +/** Known values of {@link HealthStateType} that the service accepts. */ +export enum KnownHealthStateType { + Unknown = "Unknown", + Healthy = "Healthy", + Degraded = "Degraded", + Down = "Down", + Transitioning = "Transitioning", + Stopping = "Stopping", + Stopped = "Stopped", + Upgrading = "Upgrading", + Flushing = "Flushing" } /** - * A resource SKU. + * Defines values for HealthStateType. \ + * {@link KnownHealthStateType} can be used interchangeably with HealthStateType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Unknown** \ + * **Healthy** \ + * **Degraded** \ + * **Down** \ + * **Transitioning** \ + * **Stopping** \ + * **Stopped** \ + * **Upgrading** \ + * **Flushing** */ -export interface ResourceSku { - /** - * The type of resource the SKU applies to. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly resourceType?: string; - /** - * A list of capabilities of this SKU, such as throughput or ops/sec. - */ - capabilities?: ResourceSkuCapabilities[]; - /** - * The set of locations where the SKU is available. This is the supported and registered Azure - * Geo Regions (e.g., West US, East US, Southeast Asia, etc.). - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly locations?: string[]; - /** - * The set of locations where the SKU is available. - */ - locationInfo?: ResourceSkuLocationInfo[]; - /** - * The name of this SKU. - */ - name?: string; - /** - * The restrictions preventing this SKU from being used. This is empty if there are no - * restrictions. - */ - restrictions?: Restriction[]; +export type HealthStateType = string; + +/** Known values of {@link ProvisioningStateType} that the service accepts. */ +export enum KnownProvisioningStateType { + Succeeded = "Succeeded", + Failed = "Failed", + Cancelled = "Cancelled", + Creating = "Creating", + Deleting = "Deleting", + Updating = "Updating" } /** - * Localized information describing this usage model. + * Defines values for ProvisioningStateType. \ + * {@link KnownProvisioningStateType} can be used interchangeably with ProvisioningStateType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Failed** \ + * **Cancelled** \ + * **Creating** \ + * **Deleting** \ + * **Updating** */ -export interface UsageModelDisplay { - /** - * String to display for this usage model. - */ - description?: string; +export type ProvisioningStateType = string; + +/** Known values of {@link FirmwareStatusType} that the service accepts. */ +export enum KnownFirmwareStatusType { + Available = "available", + Unavailable = "unavailable" } /** - * A usage model. + * Defines values for FirmwareStatusType. \ + * {@link KnownFirmwareStatusType} can be used interchangeably with FirmwareStatusType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **available** \ + * **unavailable** */ -export interface UsageModel { - /** - * Localized information describing this usage model. - */ - display?: UsageModelDisplay; - /** - * Non-localized keyword name for this usage model. - */ - modelName?: string; - /** - * The type of Storage Target to which this model is applicable (only nfs3 as of this version). - */ - targetType?: string; +export type FirmwareStatusType = string; + +/** Known values of {@link NfsAccessRuleScope} that the service accepts. */ +export enum KnownNfsAccessRuleScope { + Default = "default", + Network = "network", + Host = "host" } /** - * Optional Parameters. + * Defines values for NfsAccessRuleScope. \ + * {@link KnownNfsAccessRuleScope} can be used interchangeably with NfsAccessRuleScope, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **default** \ + * **network** \ + * **host** */ -export interface CachesCreateOrUpdateOptionalParams extends msRest.RequestOptionsBase { - /** - * Object containing the user-selectable properties of the new Cache. If read-only properties are - * included, they must match the existing values of those properties. - */ +export type NfsAccessRuleScope = string; + +/** Known values of {@link NfsAccessRuleAccess} that the service accepts. */ +export enum KnownNfsAccessRuleAccess { + No = "no", + Ro = "ro", + Rw = "rw" +} + +/** + * Defines values for NfsAccessRuleAccess. \ + * {@link KnownNfsAccessRuleAccess} can be used interchangeably with NfsAccessRuleAccess, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **no** \ + * **ro** \ + * **rw** + */ +export type NfsAccessRuleAccess = string; + +/** Known values of {@link DomainJoinedType} that the service accepts. */ +export enum KnownDomainJoinedType { + Yes = "Yes", + No = "No", + Error = "Error" +} + +/** + * Defines values for DomainJoinedType. \ + * {@link KnownDomainJoinedType} can be used interchangeably with DomainJoinedType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Yes** \ + * **No** \ + * **Error** + */ +export type DomainJoinedType = string; + +/** Known values of {@link UsernameSource} that the service accepts. */ +export enum KnownUsernameSource { + AD = "AD", + Ldap = "LDAP", + File = "File", + None = "None" +} + +/** + * Defines values for UsernameSource. \ + * {@link KnownUsernameSource} can be used interchangeably with UsernameSource, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **AD** \ + * **LDAP** \ + * **File** \ + * **None** + */ +export type UsernameSource = string; + +/** Known values of {@link UsernameDownloadedType} that the service accepts. */ +export enum KnownUsernameDownloadedType { + Yes = "Yes", + No = "No", + Error = "Error" +} + +/** + * Defines values for UsernameDownloadedType. \ + * {@link KnownUsernameDownloadedType} can be used interchangeably with UsernameDownloadedType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Yes** \ + * **No** \ + * **Error** + */ +export type UsernameDownloadedType = string; + +/** Known values of {@link StorageTargetType} that the service accepts. */ +export enum KnownStorageTargetType { + Nfs3 = "nfs3", + Clfs = "clfs", + Unknown = "unknown", + BlobNfs = "blobNfs" +} + +/** + * Defines values for StorageTargetType. \ + * {@link KnownStorageTargetType} can be used interchangeably with StorageTargetType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **nfs3** \ + * **clfs** \ + * **unknown** \ + * **blobNfs** + */ +export type StorageTargetType = string; + +/** Known values of {@link OperationalStateType} that the service accepts. */ +export enum KnownOperationalStateType { + Ready = "Ready", + Busy = "Busy", + Suspended = "Suspended", + Flushing = "Flushing" +} + +/** + * Defines values for OperationalStateType. \ + * {@link KnownOperationalStateType} can be used interchangeably with OperationalStateType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Ready** \ + * **Busy** \ + * **Suspended** \ + * **Flushing** + */ +export type OperationalStateType = string; +/** Defines values for CacheIdentityType. */ +export type CacheIdentityType = + | "SystemAssigned" + | "UserAssigned" + | "SystemAssigned, UserAssigned" + | "None"; + +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OperationsListResponse = ApiOperationListResult; + +/** Optional parameters. */ +export interface OperationsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OperationsListNextResponse = ApiOperationListResult; + +/** Optional parameters. */ +export interface SkusListOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type SkusListResponse = ResourceSkusResult; + +/** Optional parameters. */ +export interface SkusListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type SkusListNextResponse = ResourceSkusResult; + +/** Optional parameters. */ +export interface UsageModelsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type UsageModelsListResponse = UsageModelsResult; + +/** Optional parameters. */ +export interface UsageModelsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type UsageModelsListNextResponse = UsageModelsResult; + +/** Optional parameters. */ +export interface AscOperationsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type AscOperationsGetResponse = AscOperation; + +/** Optional parameters. */ +export interface CachesListOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type CachesListResponse = CachesListResult; + +/** Optional parameters. */ +export interface CachesListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type CachesListByResourceGroupResponse = CachesListResult; + +/** Optional parameters. */ +export interface CachesDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface CachesGetOptionalParams extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type CachesGetResponse = Cache; + +/** Optional parameters. */ +export interface CachesCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Object containing the user-selectable properties of the new Cache. If read-only properties are included, they must match the existing values of those properties. */ + cache?: Cache; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the createOrUpdate operation. */ +export type CachesCreateOrUpdateResponse = Cache; + +/** Optional parameters. */ +export interface CachesUpdateOptionalParams + extends coreClient.OperationOptions { + /** Object containing the user-selectable properties of the Cache. If read-only properties are included, they must match the existing values of those properties. */ cache?: Cache; } -/** - * Optional Parameters. - */ -export interface CachesUpdateOptionalParams extends msRest.RequestOptionsBase { - /** - * Object containing the user-selectable properties of the Cache. If read-only properties are - * included, they must match the existing values of those properties. - */ - cache?: Cache; +/** Contains response data for the update operation. */ +export type CachesUpdateResponse = Cache; + +/** Optional parameters. */ +export interface CachesDebugInfoOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; } -/** - * Optional Parameters. - */ -export interface CachesBeginCreateOrUpdateOptionalParams extends msRest.RequestOptionsBase { - /** - * Object containing the user-selectable properties of the new Cache. If read-only properties are - * included, they must match the existing values of those properties. - */ - cache?: Cache; +/** Optional parameters. */ +export interface CachesFlushOptionalParams extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; } -/** - * Optional Parameters. - */ -export interface StorageTargetsCreateOrUpdateOptionalParams extends msRest.RequestOptionsBase { - /** - * Object containing the definition of a Storage Target. - */ +/** Optional parameters. */ +export interface CachesStartOptionalParams extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface CachesStopOptionalParams extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface CachesUpgradeFirmwareOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface CachesListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type CachesListNextResponse = CachesListResult; + +/** Optional parameters. */ +export interface CachesListByResourceGroupNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroupNext operation. */ +export type CachesListByResourceGroupNextResponse = CachesListResult; + +/** Optional parameters. */ +export interface StorageTargetsDnsRefreshOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface StorageTargetsListByCacheOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByCache operation. */ +export type StorageTargetsListByCacheResponse = StorageTargetsResult; + +/** Optional parameters. */ +export interface StorageTargetsDeleteOptionalParams + extends coreClient.OperationOptions { + /** Boolean value requesting the force delete operation for a storage target. Force delete discards unwritten-data in the cache instead of flushing it to back-end storage. */ + force?: string; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface StorageTargetsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type StorageTargetsGetResponse = StorageTarget; + +/** Optional parameters. */ +export interface StorageTargetsCreateOrUpdateOptionalParams + extends coreClient.OperationOptions { + /** Object containing the definition of a Storage Target. */ storagetarget?: StorageTarget; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; } -/** - * Optional Parameters. - */ -export interface StorageTargetsBeginCreateOrUpdateOptionalParams extends msRest.RequestOptionsBase { - /** - * Object containing the definition of a Storage Target. - */ - storagetarget?: StorageTarget; +/** Contains response data for the createOrUpdate operation. */ +export type StorageTargetsCreateOrUpdateResponse = StorageTarget; + +/** Optional parameters. */ +export interface StorageTargetsListByCacheNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByCacheNext operation. */ +export type StorageTargetsListByCacheNextResponse = StorageTargetsResult; + +/** Optional parameters. */ +export interface StorageTargetFlushOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; } -/** - * An interface representing StorageCacheManagementClientOptions. - */ -export interface StorageCacheManagementClientOptions extends AzureServiceClientOptions { - baseUri?: string; +/** Optional parameters. */ +export interface StorageTargetSuspendOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; } -/** - * @interface - * Result of the request to list Resource Provider operations. It contains a list of operations and - * a URL link to get the next set of results. - * @extends Array - */ -export interface ApiOperationListResult extends Array { - /** - * URL to get the next set of operation list results if there are any. - */ - nextLink?: string; +/** Optional parameters. */ +export interface StorageTargetResumeOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; } -/** - * @interface - * The response from the List Cache SKUs operation. - * @extends Array - */ -export interface ResourceSkusResult extends Array { - /** - * The URI to fetch the next page of Cache SKUs. - */ - nextLink?: string; +/** Optional parameters. */ +export interface StorageCacheManagementClientOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; } - -/** - * @interface - * A list of Cache usage models. - * @extends Array - */ -export interface UsageModelsResult extends Array { - /** - * The URI to fetch the next page of Cache usage models. - */ - nextLink?: string; -} - -/** - * @interface - * Result of the request to list Caches. It contains a list of Caches and a URL link to get the - * next set of results. - * @extends Array - */ -export interface CachesListResult extends Array { - /** - * URL to get the next set of Cache list results, if there are any. - */ - nextLink?: string; -} - -/** - * @interface - * A list of Storage Targets. - * @extends Array - */ -export interface StorageTargetsResult extends Array { - /** - * The URI to fetch the next page of Storage Targets. - */ - nextLink?: string; -} - -/** - * Defines values for MetricAggregationType. - * Possible values include: 'NotSpecified', 'None', 'Average', 'Minimum', 'Maximum', 'Total', - * 'Count' - * @readonly - * @enum {string} - */ -export type MetricAggregationType = 'NotSpecified' | 'None' | 'Average' | 'Minimum' | 'Maximum' | 'Total' | 'Count'; - -/** - * Defines values for CacheIdentityType. - * Possible values include: 'SystemAssigned', 'None' - * @readonly - * @enum {string} - */ -export type CacheIdentityType = 'SystemAssigned' | 'None'; - -/** - * Defines values for CreatedByType. - * Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' - * @readonly - * @enum {string} - */ -export type CreatedByType = 'User' | 'Application' | 'ManagedIdentity' | 'Key'; - -/** - * Defines values for HealthStateType. - * Possible values include: 'Unknown', 'Healthy', 'Degraded', 'Down', 'Transitioning', 'Stopping', - * 'Stopped', 'Upgrading', 'Flushing' - * @readonly - * @enum {string} - */ -export type HealthStateType = 'Unknown' | 'Healthy' | 'Degraded' | 'Down' | 'Transitioning' | 'Stopping' | 'Stopped' | 'Upgrading' | 'Flushing'; - -/** - * Defines values for ProvisioningStateType. - * Possible values include: 'Succeeded', 'Failed', 'Cancelled', 'Creating', 'Deleting', 'Updating' - * @readonly - * @enum {string} - */ -export type ProvisioningStateType = 'Succeeded' | 'Failed' | 'Cancelled' | 'Creating' | 'Deleting' | 'Updating'; - -/** - * Defines values for FirmwareStatusType. - * Possible values include: 'available', 'unavailable' - * @readonly - * @enum {string} - */ -export type FirmwareStatusType = 'available' | 'unavailable'; - -/** - * Defines values for NfsAccessRuleScope. - * Possible values include: 'default', 'network', 'host' - * @readonly - * @enum {string} - */ -export type NfsAccessRuleScope = 'default' | 'network' | 'host'; - -/** - * Defines values for NfsAccessRuleAccess. - * Possible values include: 'no', 'ro', 'rw' - * @readonly - * @enum {string} - */ -export type NfsAccessRuleAccess = 'no' | 'ro' | 'rw'; - -/** - * Defines values for DomainJoinedType. - * Possible values include: 'Yes', 'No', 'Error' - * @readonly - * @enum {string} - */ -export type DomainJoinedType = 'Yes' | 'No' | 'Error'; - -/** - * Defines values for UsernameSource. - * Possible values include: 'AD', 'LDAP', 'File', 'None' - * @readonly - * @enum {string} - */ -export type UsernameSource = 'AD' | 'LDAP' | 'File' | 'None'; - -/** - * Defines values for UsernameDownloadedType. - * Possible values include: 'Yes', 'No', 'Error' - * @readonly - * @enum {string} - */ -export type UsernameDownloadedType = 'Yes' | 'No' | 'Error'; - -/** - * Defines values for StorageTargetType. - * Possible values include: 'nfs3', 'clfs', 'unknown', 'blobNfs' - * @readonly - * @enum {string} - */ -export type StorageTargetType = 'nfs3' | 'clfs' | 'unknown' | 'blobNfs'; - -/** - * Defines values for ReasonCode. - * Possible values include: 'QuotaId', 'NotAvailableForSubscription' - * @readonly - * @enum {string} - */ -export type ReasonCode = 'QuotaId' | 'NotAvailableForSubscription'; - -/** - * Contains response data for the list operation. - */ -export type OperationsListResponse = ApiOperationListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApiOperationListResult; - }; -}; - -/** - * Contains response data for the listNext operation. - */ -export type OperationsListNextResponse = ApiOperationListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ApiOperationListResult; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type SkusListResponse = ResourceSkusResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ResourceSkusResult; - }; -}; - -/** - * Contains response data for the listNext operation. - */ -export type SkusListNextResponse = ResourceSkusResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ResourceSkusResult; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type UsageModelsListResponse = UsageModelsResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: UsageModelsResult; - }; -}; - -/** - * Contains response data for the listNext operation. - */ -export type UsageModelsListNextResponse = UsageModelsResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: UsageModelsResult; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type AscOperationsGetResponse = AscOperation & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: AscOperation; - }; -}; - -/** - * Contains response data for the list operation. - */ -export type CachesListResponse = CachesListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: CachesListResult; - }; -}; - -/** - * Contains response data for the listByResourceGroup operation. - */ -export type CachesListByResourceGroupResponse = CachesListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: CachesListResult; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type CachesGetResponse = Cache & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Cache; - }; -}; - -/** - * Contains response data for the createOrUpdate operation. - */ -export type CachesCreateOrUpdateResponse = Cache & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Cache; - }; -}; - -/** - * Contains response data for the update operation. - */ -export type CachesUpdateResponse = Cache & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Cache; - }; -}; - -/** - * Contains response data for the beginCreateOrUpdate operation. - */ -export type CachesBeginCreateOrUpdateResponse = Cache & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Cache; - }; -}; - -/** - * Contains response data for the listNext operation. - */ -export type CachesListNextResponse = CachesListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: CachesListResult; - }; -}; - -/** - * Contains response data for the listByResourceGroupNext operation. - */ -export type CachesListByResourceGroupNextResponse = CachesListResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: CachesListResult; - }; -}; - -/** - * Contains response data for the listByCache operation. - */ -export type StorageTargetsListByCacheResponse = StorageTargetsResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: StorageTargetsResult; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type StorageTargetsGetResponse = StorageTarget & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: StorageTarget; - }; -}; - -/** - * Contains response data for the createOrUpdate operation. - */ -export type StorageTargetsCreateOrUpdateResponse = StorageTarget & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: StorageTarget; - }; -}; - -/** - * Contains response data for the beginCreateOrUpdate operation. - */ -export type StorageTargetsBeginCreateOrUpdateResponse = StorageTarget & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: StorageTarget; - }; -}; - -/** - * Contains response data for the listByCacheNext operation. - */ -export type StorageTargetsListByCacheNextResponse = StorageTargetsResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: StorageTargetsResult; - }; -}; diff --git a/sdk/storagecache/arm-storagecache/src/models/mappers.ts b/sdk/storagecache/arm-storagecache/src/models/mappers.ts index ca2d43cbe9a..c2e91f63c47 100644 --- a/sdk/storagecache/arm-storagecache/src/models/mappers.ts +++ b/sdk/storagecache/arm-storagecache/src/models/mappers.ts @@ -6,14 +6,77 @@ * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export const CloudError = CloudErrorMapper; -export const BaseResource = BaseResourceMapper; +export const ApiOperationListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApiOperationListResult", + modelProperties: { + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ApiOperation" + } + } + } + } + } + } +}; -export const ApiOperationDisplay: msRest.CompositeMapper = { - serializedName: "ApiOperation_display", +export const ApiOperation: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ApiOperation", + modelProperties: { + display: { + serializedName: "display", + type: { + name: "Composite", + className: "ApiOperationDisplay" + } + }, + origin: { + serializedName: "origin", + type: { + name: "String" + } + }, + isDataAction: { + serializedName: "isDataAction", + type: { + name: "Boolean" + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + serviceSpecification: { + serializedName: "properties.serviceSpecification", + type: { + name: "Composite", + className: "ApiOperationPropertiesServiceSpecification" + } + } + } + } +}; + +export const ApiOperationDisplay: coreClient.CompositeMapper = { type: { name: "Composite", className: "ApiOperationDisplay", @@ -46,42 +109,28 @@ export const ApiOperationDisplay: msRest.CompositeMapper = { } }; -export const MetricDimension: msRest.CompositeMapper = { - serializedName: "MetricDimension", +export const ApiOperationPropertiesServiceSpecification: coreClient.CompositeMapper = { type: { name: "Composite", - className: "MetricDimension", + className: "ApiOperationPropertiesServiceSpecification", modelProperties: { - name: { - serializedName: "name", + metricSpecifications: { + serializedName: "metricSpecifications", type: { - name: "String" - } - }, - displayName: { - serializedName: "displayName", - type: { - name: "String" - } - }, - internalName: { - serializedName: "internalName", - type: { - name: "String" - } - }, - toBeExportedForShoebox: { - serializedName: "toBeExportedForShoebox", - type: { - name: "Boolean" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "MetricSpecification" + } + } } } } } }; -export const MetricSpecification: msRest.CompositeMapper = { - serializedName: "MetricSpecification", +export const MetricSpecification: coreClient.CompositeMapper = { type: { name: "Composite", className: "MetricSpecification", @@ -149,72 +198,56 @@ export const MetricSpecification: msRest.CompositeMapper = { } }; -export const ApiOperationPropertiesServiceSpecification: msRest.CompositeMapper = { - serializedName: "ApiOperation_properties_serviceSpecification", +export const MetricDimension: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ApiOperationPropertiesServiceSpecification", + className: "MetricDimension", modelProperties: { - metricSpecifications: { - serializedName: "metricSpecifications", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "MetricSpecification" - } - } - } - } - } - } -}; - -export const ApiOperation: msRest.CompositeMapper = { - serializedName: "ApiOperation", - type: { - name: "Composite", - className: "ApiOperation", - modelProperties: { - display: { - serializedName: "display", - type: { - name: "Composite", - className: "ApiOperationDisplay" - } - }, - origin: { - serializedName: "origin", - type: { - name: "String" - } - }, - isDataAction: { - serializedName: "isDataAction", - type: { - name: "Boolean" - } - }, name: { serializedName: "name", type: { name: "String" } }, - serviceSpecification: { - serializedName: "properties.serviceSpecification", + displayName: { + serializedName: "displayName", type: { - name: "Composite", - className: "ApiOperationPropertiesServiceSpecification" + name: "String" + } + }, + internalName: { + serializedName: "internalName", + type: { + name: "String" + } + }, + toBeExportedForShoebox: { + serializedName: "toBeExportedForShoebox", + type: { + name: "Boolean" } } } } }; -export const CloudErrorBody: msRest.CompositeMapper = { - serializedName: "CloudErrorBody", +export const CloudError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CloudError", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "CloudErrorBody" + } + } + } + } +}; + +export const CloudErrorBody: coreClient.CompositeMapper = { type: { name: "Composite", className: "CloudErrorBody", @@ -253,20 +286,117 @@ export const CloudErrorBody: msRest.CompositeMapper = { } }; -export const ErrorResponse: msRest.CompositeMapper = { - serializedName: "ErrorResponse", +export const ResourceSkusResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ErrorResponse", + className: "ResourceSkusResult", modelProperties: { - code: { - serializedName: "code", + nextLink: { + serializedName: "nextLink", type: { name: "String" } }, - message: { - serializedName: "message", + value: { + serializedName: "value", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceSku" + } + } + } + } + } + } +}; + +export const ResourceSku: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceSku", + modelProperties: { + resourceType: { + serializedName: "resourceType", + readOnly: true, + type: { + name: "String" + } + }, + capabilities: { + serializedName: "capabilities", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceSkuCapabilities" + } + } + } + }, + locations: { + serializedName: "locations", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + locationInfo: { + serializedName: "locationInfo", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ResourceSkuLocationInfo" + } + } + } + }, + name: { + serializedName: "name", + type: { + name: "String" + } + }, + restrictions: { + serializedName: "restrictions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Restriction" + } + } + } + } + } + } +}; + +export const ResourceSkuCapabilities: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceSkuCapabilities", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + value: { + serializedName: "value", type: { name: "String" } @@ -275,8 +405,137 @@ export const ErrorResponse: msRest.CompositeMapper = { } }; -export const AscOperation: msRest.CompositeMapper = { - serializedName: "AscOperation", +export const ResourceSkuLocationInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ResourceSkuLocationInfo", + modelProperties: { + location: { + serializedName: "location", + type: { + name: "String" + } + }, + zones: { + serializedName: "zones", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const Restriction: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Restriction", + modelProperties: { + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + values: { + serializedName: "values", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + reasonCode: { + serializedName: "reasonCode", + type: { + name: "String" + } + } + } + } +}; + +export const UsageModelsResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UsageModelsResult", + modelProperties: { + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "UsageModel" + } + } + } + } + } + } +}; + +export const UsageModel: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UsageModel", + modelProperties: { + display: { + serializedName: "display", + type: { + name: "Composite", + className: "UsageModelDisplay" + } + }, + modelName: { + serializedName: "modelName", + type: { + name: "String" + } + }, + targetType: { + serializedName: "targetType", + type: { + name: "String" + } + } + } + } +}; + +export const UsageModelDisplay: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UsageModelDisplay", + modelProperties: { + description: { + serializedName: "description", + type: { + name: "String" + } + } + } + } +}; + +export const AscOperation: coreClient.CompositeMapper = { type: { name: "Composite", className: "AscOperation", @@ -323,8 +582,54 @@ export const AscOperation: msRest.CompositeMapper = { type: { name: "Dictionary", value: { + type: { name: "Dictionary", value: { type: { name: "any" } } } + } + } + } + } + } +}; + +export const ErrorResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ErrorResponse", + modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + } + } + } +}; + +export const CachesListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CachesListResult", + modelProperties: { + nextLink: { + serializedName: "nextLink", + type: { + name: "String" + } + }, + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { type: { - name: "Object" + name: "Composite", + className: "Cache" } } } @@ -333,22 +638,161 @@ export const AscOperation: msRest.CompositeMapper = { } }; -export const CacheIdentity: msRest.CompositeMapper = { - serializedName: "CacheIdentity", +export const Cache: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Cache", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + name: { + constraints: { + Pattern: new RegExp("^[-0-9a-zA-Z_]{1,80}$") + }, + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + }, + identity: { + serializedName: "identity", + type: { + name: "Composite", + className: "CacheIdentity" + } + }, + systemData: { + serializedName: "systemData", + type: { + name: "Composite", + className: "SystemData" + } + }, + sku: { + serializedName: "sku", + type: { + name: "Composite", + className: "CacheSku" + } + }, + cacheSizeGB: { + serializedName: "properties.cacheSizeGB", + type: { + name: "Number" + } + }, + health: { + serializedName: "properties.health", + type: { + name: "Composite", + className: "CacheHealth" + } + }, + mountAddresses: { + serializedName: "properties.mountAddresses", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + subnet: { + serializedName: "properties.subnet", + type: { + name: "String" + } + }, + upgradeStatus: { + serializedName: "properties.upgradeStatus", + type: { + name: "Composite", + className: "CacheUpgradeStatus" + } + }, + networkSettings: { + serializedName: "properties.networkSettings", + type: { + name: "Composite", + className: "CacheNetworkSettings" + } + }, + encryptionSettings: { + serializedName: "properties.encryptionSettings", + type: { + name: "Composite", + className: "CacheEncryptionSettings" + } + }, + securitySettings: { + serializedName: "properties.securitySettings", + type: { + name: "Composite", + className: "CacheSecuritySettings" + } + }, + directoryServicesSettings: { + serializedName: "properties.directoryServicesSettings", + type: { + name: "Composite", + className: "CacheDirectorySettings" + } + } + } + } +}; + +export const CacheIdentity: coreClient.CompositeMapper = { type: { name: "Composite", className: "CacheIdentity", modelProperties: { principalId: { - readOnly: true, serializedName: "principalId", + readOnly: true, type: { name: "String" } }, tenantId: { - readOnly: true, serializedName: "tenantId", + readOnly: true, type: { name: "String" } @@ -359,16 +803,52 @@ export const CacheIdentity: msRest.CompositeMapper = { name: "Enum", allowedValues: [ "SystemAssigned", + "UserAssigned", + "SystemAssigned, UserAssigned", "None" ] } + }, + userAssignedIdentities: { + serializedName: "userAssignedIdentities", + type: { + name: "Dictionary", + value: { + type: { + name: "Composite", + className: "UserAssignedIdentitiesValue" + } + } + } } } } }; -export const SystemData: msRest.CompositeMapper = { - serializedName: "systemData", +export const UserAssignedIdentitiesValue: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "UserAssignedIdentitiesValue", + modelProperties: { + principalId: { + serializedName: "principalId", + readOnly: true, + type: { + name: "String" + } + }, + clientId: { + serializedName: "clientId", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const SystemData: coreClient.CompositeMapper = { type: { name: "Composite", className: "SystemData", @@ -413,32 +893,7 @@ export const SystemData: msRest.CompositeMapper = { } }; -export const Condition: msRest.CompositeMapper = { - serializedName: "Condition", - type: { - name: "Composite", - className: "Condition", - modelProperties: { - timestamp: { - readOnly: true, - serializedName: "timestamp", - type: { - name: "DateTime" - } - }, - message: { - readOnly: true, - serializedName: "message", - type: { - name: "String" - } - } - } - } -}; - -export const CacheHealth: msRest.CompositeMapper = { - serializedName: "CacheHealth", +export const CacheHealth: coreClient.CompositeMapper = { type: { name: "Composite", className: "CacheHealth", @@ -456,8 +911,8 @@ export const CacheHealth: msRest.CompositeMapper = { } }, conditions: { - readOnly: true, serializedName: "conditions", + readOnly: true, type: { name: "Sequence", element: { @@ -472,43 +927,21 @@ export const CacheHealth: msRest.CompositeMapper = { } }; -export const CacheUpgradeStatus: msRest.CompositeMapper = { - serializedName: "CacheUpgradeStatus", +export const Condition: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CacheUpgradeStatus", + className: "Condition", modelProperties: { - currentFirmwareVersion: { + timestamp: { + serializedName: "timestamp", readOnly: true, - serializedName: "currentFirmwareVersion", - type: { - name: "String" - } - }, - firmwareUpdateStatus: { - readOnly: true, - serializedName: "firmwareUpdateStatus", - type: { - name: "String" - } - }, - firmwareUpdateDeadline: { - readOnly: true, - serializedName: "firmwareUpdateDeadline", type: { name: "DateTime" } }, - lastFirmwareUpdate: { + message: { + serializedName: "message", readOnly: true, - serializedName: "lastFirmwareUpdate", - type: { - name: "DateTime" - } - }, - pendingFirmwareVersion: { - readOnly: true, - serializedName: "pendingFirmwareVersion", type: { name: "String" } @@ -517,26 +950,69 @@ export const CacheUpgradeStatus: msRest.CompositeMapper = { } }; -export const CacheNetworkSettings: msRest.CompositeMapper = { - serializedName: "CacheNetworkSettings", +export const CacheUpgradeStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CacheUpgradeStatus", + modelProperties: { + currentFirmwareVersion: { + serializedName: "currentFirmwareVersion", + readOnly: true, + type: { + name: "String" + } + }, + firmwareUpdateStatus: { + serializedName: "firmwareUpdateStatus", + readOnly: true, + type: { + name: "String" + } + }, + firmwareUpdateDeadline: { + serializedName: "firmwareUpdateDeadline", + readOnly: true, + type: { + name: "DateTime" + } + }, + lastFirmwareUpdate: { + serializedName: "lastFirmwareUpdate", + readOnly: true, + type: { + name: "DateTime" + } + }, + pendingFirmwareVersion: { + serializedName: "pendingFirmwareVersion", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const CacheNetworkSettings: coreClient.CompositeMapper = { type: { name: "Composite", className: "CacheNetworkSettings", modelProperties: { mtu: { - serializedName: "mtu", defaultValue: 1500, constraints: { InclusiveMaximum: 1500, InclusiveMinimum: 576 }, + serializedName: "mtu", type: { name: "Number" } }, utilityAddresses: { - readOnly: true, serializedName: "utilityAddresses", + readOnly: true, type: { name: "Sequence", element: { @@ -564,6 +1040,7 @@ export const CacheNetworkSettings: msRest.CompositeMapper = { } }, ntpServer: { + defaultValue: "time.windows.com", serializedName: "ntpServer", type: { name: "String" @@ -573,8 +1050,52 @@ export const CacheNetworkSettings: msRest.CompositeMapper = { } }; -export const KeyVaultKeyReferenceSourceVault: msRest.CompositeMapper = { - serializedName: "KeyVaultKeyReference_sourceVault", +export const CacheEncryptionSettings: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CacheEncryptionSettings", + modelProperties: { + keyEncryptionKey: { + serializedName: "keyEncryptionKey", + type: { + name: "Composite", + className: "KeyVaultKeyReference" + } + }, + rotationToLatestKeyVersionEnabled: { + serializedName: "rotationToLatestKeyVersionEnabled", + type: { + name: "Boolean" + } + } + } + } +}; + +export const KeyVaultKeyReference: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "KeyVaultKeyReference", + modelProperties: { + keyUrl: { + serializedName: "keyUrl", + required: true, + type: { + name: "String" + } + }, + sourceVault: { + serializedName: "sourceVault", + type: { + name: "Composite", + className: "KeyVaultKeyReferenceSourceVault" + } + } + } + } +}; + +export const KeyVaultKeyReferenceSourceVault: coreClient.CompositeMapper = { type: { name: "Composite", className: "KeyVaultKeyReferenceSourceVault", @@ -589,57 +1110,64 @@ export const KeyVaultKeyReferenceSourceVault: msRest.CompositeMapper = { } }; -export const KeyVaultKeyReference: msRest.CompositeMapper = { - serializedName: "KeyVaultKeyReference", +export const CacheSecuritySettings: coreClient.CompositeMapper = { type: { name: "Composite", - className: "KeyVaultKeyReference", + className: "CacheSecuritySettings", modelProperties: { - keyUrl: { + accessPolicies: { + serializedName: "accessPolicies", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "NfsAccessPolicy" + } + } + } + } + } + } +}; + +export const NfsAccessPolicy: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "NfsAccessPolicy", + modelProperties: { + name: { + serializedName: "name", required: true, - serializedName: "keyUrl", type: { name: "String" } }, - sourceVault: { + accessRules: { + serializedName: "accessRules", required: true, - serializedName: "sourceVault", type: { - name: "Composite", - className: "KeyVaultKeyReferenceSourceVault" + name: "Sequence", + element: { + type: { + name: "Composite", + className: "NfsAccessRule" + } + } } } } } }; -export const CacheEncryptionSettings: msRest.CompositeMapper = { - serializedName: "CacheEncryptionSettings", - type: { - name: "Composite", - className: "CacheEncryptionSettings", - modelProperties: { - keyEncryptionKey: { - serializedName: "keyEncryptionKey", - type: { - name: "Composite", - className: "KeyVaultKeyReference" - } - } - } - } -}; - -export const NfsAccessRule: msRest.CompositeMapper = { - serializedName: "NfsAccessRule", +export const NfsAccessRule: coreClient.CompositeMapper = { type: { name: "Composite", className: "NfsAccessRule", modelProperties: { scope: { - required: true, serializedName: "scope", + required: true, type: { name: "String" } @@ -651,8 +1179,8 @@ export const NfsAccessRule: msRest.CompositeMapper = { } }, access: { - required: true, serializedName: "access", + required: true, type: { name: "String" } @@ -691,91 +1219,37 @@ export const NfsAccessRule: msRest.CompositeMapper = { } }; -export const NfsAccessPolicy: msRest.CompositeMapper = { - serializedName: "NfsAccessPolicy", +export const CacheDirectorySettings: coreClient.CompositeMapper = { type: { name: "Composite", - className: "NfsAccessPolicy", + className: "CacheDirectorySettings", modelProperties: { - name: { - required: true, - serializedName: "name", + activeDirectory: { + serializedName: "activeDirectory", type: { - name: "String" + name: "Composite", + className: "CacheActiveDirectorySettings" } }, - accessRules: { - required: true, - serializedName: "accessRules", + usernameDownload: { + serializedName: "usernameDownload", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "NfsAccessRule" - } - } + name: "Composite", + className: "CacheUsernameDownloadSettings" } } } } }; -export const CacheSecuritySettings: msRest.CompositeMapper = { - serializedName: "CacheSecuritySettings", - type: { - name: "Composite", - className: "CacheSecuritySettings", - modelProperties: { - accessPolicies: { - serializedName: "accessPolicies", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "NfsAccessPolicy" - } - } - } - } - } - } -}; - -export const CacheActiveDirectorySettingsCredentials: msRest.CompositeMapper = { - serializedName: "CacheActiveDirectorySettings_credentials", - type: { - name: "Composite", - className: "CacheActiveDirectorySettingsCredentials", - modelProperties: { - username: { - required: true, - serializedName: "username", - type: { - name: "String" - } - }, - password: { - required: true, - serializedName: "password", - type: { - name: "String" - } - } - } - } -}; - -export const CacheActiveDirectorySettings: msRest.CompositeMapper = { - serializedName: "CacheActiveDirectorySettings", +export const CacheActiveDirectorySettings: coreClient.CompositeMapper = { type: { name: "Composite", className: "CacheActiveDirectorySettings", modelProperties: { primaryDnsIpAddress: { - required: true, serializedName: "primaryDnsIpAddress", + required: true, type: { name: "String" } @@ -787,32 +1261,32 @@ export const CacheActiveDirectorySettings: msRest.CompositeMapper = { } }, domainName: { - required: true, serializedName: "domainName", + required: true, type: { name: "String" } }, domainNetBiosName: { - required: true, serializedName: "domainNetBiosName", + required: true, type: { name: "String" } }, cacheNetBiosName: { - required: true, - serializedName: "cacheNetBiosName", constraints: { - Pattern: /^[-0-9a-zA-Z]{1,15}$/ + Pattern: new RegExp("^[-0-9a-zA-Z]{1,15}$") }, + serializedName: "cacheNetBiosName", + required: true, type: { name: "String" } }, domainJoined: { - readOnly: true, serializedName: "domainJoined", + readOnly: true, type: { name: "String" } @@ -828,20 +1302,21 @@ export const CacheActiveDirectorySettings: msRest.CompositeMapper = { } }; -export const CacheUsernameDownloadSettingsCredentials: msRest.CompositeMapper = { - serializedName: "CacheUsernameDownloadSettings_credentials", +export const CacheActiveDirectorySettingsCredentials: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CacheUsernameDownloadSettingsCredentials", + className: "CacheActiveDirectorySettingsCredentials", modelProperties: { - bindDn: { - serializedName: "bindDn", + username: { + serializedName: "username", + required: true, type: { name: "String" } }, - bindPassword: { - serializedName: "bindPassword", + password: { + serializedName: "password", + required: true, type: { name: "String" } @@ -850,8 +1325,7 @@ export const CacheUsernameDownloadSettingsCredentials: msRest.CompositeMapper = } }; -export const CacheUsernameDownloadSettings: msRest.CompositeMapper = { - serializedName: "CacheUsernameDownloadSettings", +export const CacheUsernameDownloadSettings: coreClient.CompositeMapper = { type: { name: "Composite", className: "CacheUsernameDownloadSettings", @@ -863,8 +1337,8 @@ export const CacheUsernameDownloadSettings: msRest.CompositeMapper = { } }, usernameSource: { + defaultValue: "None", serializedName: "usernameSource", - defaultValue: 'None', type: { name: "String" } @@ -918,8 +1392,8 @@ export const CacheUsernameDownloadSettings: msRest.CompositeMapper = { } }, usernameDownloaded: { - readOnly: true, serializedName: "usernameDownloaded", + readOnly: true, type: { name: "String" } @@ -935,32 +1409,28 @@ export const CacheUsernameDownloadSettings: msRest.CompositeMapper = { } }; -export const CacheDirectorySettings: msRest.CompositeMapper = { - serializedName: "CacheDirectorySettings", +export const CacheUsernameDownloadSettingsCredentials: coreClient.CompositeMapper = { type: { name: "Composite", - className: "CacheDirectorySettings", + className: "CacheUsernameDownloadSettingsCredentials", modelProperties: { - activeDirectory: { - serializedName: "activeDirectory", + bindDn: { + serializedName: "bindDn", type: { - name: "Composite", - className: "CacheActiveDirectorySettings" + name: "String" } }, - usernameDownload: { - serializedName: "usernameDownload", + bindPassword: { + serializedName: "bindPassword", type: { - name: "Composite", - className: "CacheUsernameDownloadSettings" + name: "String" } } } } }; -export const CacheSku: msRest.CompositeMapper = { - serializedName: "Cache_sku", +export const CacheSku: coreClient.CompositeMapper = { type: { name: "Composite", className: "CacheSku", @@ -975,151 +1445,34 @@ export const CacheSku: msRest.CompositeMapper = { } }; -export const Cache: msRest.CompositeMapper = { - serializedName: "Cache", +export const StorageTargetsResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Cache", + className: "StorageTargetsResult", modelProperties: { - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { - type: { - name: "String" - } - } - } - }, - id: { - readOnly: true, - serializedName: "id", + nextLink: { + serializedName: "nextLink", type: { name: "String" } }, - location: { - serializedName: "location", - type: { - name: "String" - } - }, - name: { - readOnly: true, - serializedName: "name", - type: { - name: "String" - } - }, - type: { - readOnly: true, - serializedName: "type", - type: { - name: "String" - } - }, - identity: { - serializedName: "identity", - type: { - name: "Composite", - className: "CacheIdentity" - } - }, - systemData: { - readOnly: true, - serializedName: "systemData", - type: { - name: "Composite", - className: "SystemData" - } - }, - cacheSizeGB: { - serializedName: "properties.cacheSizeGB", - type: { - name: "Number" - } - }, - health: { - readOnly: true, - serializedName: "properties.health", - type: { - name: "Composite", - className: "CacheHealth" - } - }, - mountAddresses: { - readOnly: true, - serializedName: "properties.mountAddresses", + value: { + serializedName: "value", type: { name: "Sequence", element: { type: { - name: "String" + name: "Composite", + className: "StorageTarget" } } } - }, - provisioningState: { - serializedName: "properties.provisioningState", - type: { - name: "String" - } - }, - subnet: { - serializedName: "properties.subnet", - type: { - name: "String" - } - }, - upgradeStatus: { - serializedName: "properties.upgradeStatus", - type: { - name: "Composite", - className: "CacheUpgradeStatus" - } - }, - networkSettings: { - serializedName: "properties.networkSettings", - type: { - name: "Composite", - className: "CacheNetworkSettings" - } - }, - encryptionSettings: { - serializedName: "properties.encryptionSettings", - type: { - name: "Composite", - className: "CacheEncryptionSettings" - } - }, - securitySettings: { - serializedName: "properties.securitySettings", - type: { - name: "Composite", - className: "CacheSecuritySettings" - } - }, - directoryServicesSettings: { - serializedName: "properties.directoryServicesSettings", - type: { - name: "Composite", - className: "CacheDirectorySettings" - } - }, - sku: { - serializedName: "sku", - type: { - name: "Composite", - className: "CacheSku" - } } } } }; -export const NamespaceJunction: msRest.CompositeMapper = { - serializedName: "NamespaceJunction", +export const NamespaceJunction: coreClient.CompositeMapper = { type: { name: "Composite", className: "NamespaceJunction", @@ -1143,6 +1496,7 @@ export const NamespaceJunction: msRest.CompositeMapper = { } }, nfsAccessPolicy: { + defaultValue: "default", serializedName: "nfsAccessPolicy", type: { name: "String" @@ -1152,17 +1506,16 @@ export const NamespaceJunction: msRest.CompositeMapper = { } }; -export const Nfs3Target: msRest.CompositeMapper = { - serializedName: "Nfs3Target", +export const Nfs3Target: coreClient.CompositeMapper = { type: { name: "Composite", className: "Nfs3Target", modelProperties: { target: { - serializedName: "target", constraints: { - Pattern: /^[-.0-9a-zA-Z]+$/ + Pattern: new RegExp("^[-.,0-9a-zA-Z]+$") }, + serializedName: "target", type: { name: "String" } @@ -1177,8 +1530,7 @@ export const Nfs3Target: msRest.CompositeMapper = { } }; -export const ClfsTarget: msRest.CompositeMapper = { - serializedName: "ClfsTarget", +export const ClfsTarget: coreClient.CompositeMapper = { type: { name: "Composite", className: "ClfsTarget", @@ -1193,8 +1545,7 @@ export const ClfsTarget: msRest.CompositeMapper = { } }; -export const UnknownTarget: msRest.CompositeMapper = { - serializedName: "UnknownTarget", +export const UnknownTarget: coreClient.CompositeMapper = { type: { name: "Composite", className: "UnknownTarget", @@ -1203,19 +1554,14 @@ export const UnknownTarget: msRest.CompositeMapper = { serializedName: "attributes", type: { name: "Dictionary", - value: { - type: { - name: "String" - } - } + value: { type: { name: "String" } } } } } } }; -export const BlobNfsTarget: msRest.CompositeMapper = { - serializedName: "BlobNfsTarget", +export const BlobNfsTarget: coreClient.CompositeMapper = { type: { name: "Composite", className: "BlobNfsTarget", @@ -1236,42 +1582,43 @@ export const BlobNfsTarget: msRest.CompositeMapper = { } }; -export const StorageTargetResource: msRest.CompositeMapper = { - serializedName: "StorageTargetResource", +export const StorageTargetResource: coreClient.CompositeMapper = { type: { name: "Composite", className: "StorageTargetResource", modelProperties: { name: { - readOnly: true, + constraints: { + Pattern: new RegExp("^[-0-9a-zA-Z_]{1,80}$") + }, serializedName: "name", + readOnly: true, type: { name: "String" } }, id: { - readOnly: true, serializedName: "id", + readOnly: true, type: { name: "String" } }, type: { - readOnly: true, serializedName: "type", + readOnly: true, type: { name: "String" } }, location: { - readOnly: true, serializedName: "location", + readOnly: true, type: { name: "String" } }, systemData: { - readOnly: true, serializedName: "systemData", type: { name: "Composite", @@ -1282,8 +1629,7 @@ export const StorageTargetResource: msRest.CompositeMapper = { } }; -export const StorageTarget: msRest.CompositeMapper = { - serializedName: "StorageTarget", +export const StorageTarget: coreClient.CompositeMapper = { type: { name: "Composite", className: "StorageTarget", @@ -1302,7 +1648,6 @@ export const StorageTarget: msRest.CompositeMapper = { } }, targetType: { - required: true, serializedName: "properties.targetType", type: { name: "String" @@ -1310,6 +1655,13 @@ export const StorageTarget: msRest.CompositeMapper = { }, provisioningState: { serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + state: { + serializedName: "properties.state", type: { name: "String" } @@ -1345,344 +1697,3 @@ export const StorageTarget: msRest.CompositeMapper = { } } }; - -export const ResourceSkuCapabilities: msRest.CompositeMapper = { - serializedName: "ResourceSkuCapabilities", - type: { - name: "Composite", - className: "ResourceSkuCapabilities", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String" - } - }, - value: { - serializedName: "value", - type: { - name: "String" - } - } - } - } -}; - -export const ResourceSkuLocationInfo: msRest.CompositeMapper = { - serializedName: "ResourceSkuLocationInfo", - type: { - name: "Composite", - className: "ResourceSkuLocationInfo", - modelProperties: { - location: { - serializedName: "location", - type: { - name: "String" - } - }, - zones: { - serializedName: "zones", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - } - } - } -}; - -export const Restriction: msRest.CompositeMapper = { - serializedName: "Restriction", - type: { - name: "Composite", - className: "Restriction", - modelProperties: { - type: { - readOnly: true, - serializedName: "type", - type: { - name: "String" - } - }, - values: { - readOnly: true, - serializedName: "values", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - reasonCode: { - serializedName: "reasonCode", - type: { - name: "String" - } - } - } - } -}; - -export const ResourceSku: msRest.CompositeMapper = { - serializedName: "ResourceSku", - type: { - name: "Composite", - className: "ResourceSku", - modelProperties: { - resourceType: { - readOnly: true, - serializedName: "resourceType", - type: { - name: "String" - } - }, - capabilities: { - serializedName: "capabilities", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ResourceSkuCapabilities" - } - } - } - }, - locations: { - readOnly: true, - serializedName: "locations", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } - } - }, - locationInfo: { - serializedName: "locationInfo", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ResourceSkuLocationInfo" - } - } - } - }, - name: { - serializedName: "name", - type: { - name: "String" - } - }, - restrictions: { - serializedName: "restrictions", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Restriction" - } - } - } - } - } - } -}; - -export const UsageModelDisplay: msRest.CompositeMapper = { - serializedName: "UsageModel_display", - type: { - name: "Composite", - className: "UsageModelDisplay", - modelProperties: { - description: { - serializedName: "description", - type: { - name: "String" - } - } - } - } -}; - -export const UsageModel: msRest.CompositeMapper = { - serializedName: "UsageModel", - type: { - name: "Composite", - className: "UsageModel", - modelProperties: { - display: { - serializedName: "display", - type: { - name: "Composite", - className: "UsageModelDisplay" - } - }, - modelName: { - serializedName: "modelName", - type: { - name: "String" - } - }, - targetType: { - serializedName: "targetType", - type: { - name: "String" - } - } - } - } -}; - -export const ApiOperationListResult: msRest.CompositeMapper = { - serializedName: "ApiOperationListResult", - type: { - name: "Composite", - className: "ApiOperationListResult", - modelProperties: { - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - }, - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ApiOperation" - } - } - } - } - } - } -}; - -export const ResourceSkusResult: msRest.CompositeMapper = { - serializedName: "ResourceSkusResult", - type: { - name: "Composite", - className: "ResourceSkusResult", - modelProperties: { - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - }, - value: { - readOnly: true, - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ResourceSku" - } - } - } - } - } - } -}; - -export const UsageModelsResult: msRest.CompositeMapper = { - serializedName: "UsageModelsResult", - type: { - name: "Composite", - className: "UsageModelsResult", - modelProperties: { - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - }, - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "UsageModel" - } - } - } - } - } - } -}; - -export const CachesListResult: msRest.CompositeMapper = { - serializedName: "CachesListResult", - type: { - name: "Composite", - className: "CachesListResult", - modelProperties: { - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - }, - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Cache" - } - } - } - } - } - } -}; - -export const StorageTargetsResult: msRest.CompositeMapper = { - serializedName: "StorageTargetsResult", - type: { - name: "Composite", - className: "StorageTargetsResult", - modelProperties: { - nextLink: { - serializedName: "nextLink", - type: { - name: "String" - } - }, - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "StorageTarget" - } - } - } - } - } - } -}; diff --git a/sdk/storagecache/arm-storagecache/src/models/operationsMappers.ts b/sdk/storagecache/arm-storagecache/src/models/operationsMappers.ts deleted file mode 100644 index c7bc36f6531..00000000000 --- a/sdk/storagecache/arm-storagecache/src/models/operationsMappers.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - ApiOperation, - ApiOperationDisplay, - ApiOperationListResult, - ApiOperationPropertiesServiceSpecification, - CloudError, - MetricDimension, - MetricSpecification -} from "../models/mappers"; diff --git a/sdk/storagecache/arm-storagecache/src/models/parameters.ts b/sdk/storagecache/arm-storagecache/src/models/parameters.ts index f59cdb795e2..a56894dd8ca 100644 --- a/sdk/storagecache/arm-storagecache/src/models/parameters.ts +++ b/sdk/storagecache/arm-storagecache/src/models/parameters.ts @@ -3,106 +3,167 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + Cache as CacheMapper, + StorageTarget as StorageTargetMapper +} from "../models/mappers"; -export const acceptLanguage: msRest.OperationParameter = { - parameterPath: "acceptLanguage", +export const accept: OperationParameter = { + parameterPath: "accept", mapper: { - serializedName: "accept-language", - defaultValue: 'en-US', + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", type: { name: "String" } } }; -export const apiVersion: msRest.OperationQueryParameter = { - parameterPath: "apiVersion", + +export const $host: OperationURLParameter = { + parameterPath: "$host", mapper: { + serializedName: "$host", required: true, - serializedName: "api-version", - type: { - name: "String" - } - } -}; -export const cacheName: msRest.OperationURLParameter = { - parameterPath: "cacheName", - mapper: { - required: true, - serializedName: "cacheName", - constraints: { - Pattern: /^[-0-9a-zA-Z_]{1,80}$/ - }, - type: { - name: "String" - } - } -}; -export const location: msRest.OperationURLParameter = { - parameterPath: "location", - mapper: { - required: true, - serializedName: "location", - type: { - name: "String" - } - } -}; -export const nextPageLink: msRest.OperationURLParameter = { - parameterPath: "nextPageLink", - mapper: { - required: true, - serializedName: "nextLink", type: { name: "String" } }, skipEncoding: true }; -export const operationId: msRest.OperationURLParameter = { - parameterPath: "operationId", + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", mapper: { - required: true, - serializedName: "operationId", + defaultValue: "2021-09-01", + isConstant: true, + serializedName: "api-version", type: { name: "String" } } }; -export const resourceGroupName: msRest.OperationURLParameter = { - parameterPath: "resourceGroupName", + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", mapper: { + serializedName: "nextLink", required: true, - serializedName: "resourceGroupName", type: { name: "String" } - } + }, + skipEncoding: true }; -export const storageTargetName: msRest.OperationURLParameter = { - parameterPath: "storageTargetName", - mapper: { - required: true, - serializedName: "storageTargetName", - constraints: { - Pattern: /^[-0-9a-zA-Z_]{1,80}$/ - }, - type: { - name: "String" - } - } -}; -export const subscriptionId: msRest.OperationURLParameter = { + +export const subscriptionId: OperationURLParameter = { parameterPath: "subscriptionId", mapper: { - required: true, serializedName: "subscriptionId", + required: true, type: { name: "String" } } }; + +export const location: OperationURLParameter = { + parameterPath: "location", + mapper: { + serializedName: "location", + required: true, + type: { + name: "String" + } + } +}; + +export const operationId: OperationURLParameter = { + parameterPath: "operationId", + mapper: { + serializedName: "operationId", + required: true, + type: { + name: "String" + } + } +}; + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + serializedName: "resourceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const cacheName: OperationURLParameter = { + parameterPath: "cacheName", + mapper: { + constraints: { + Pattern: new RegExp("^[-0-9a-zA-Z_]{1,80}$") + }, + serializedName: "cacheName", + required: true, + type: { + name: "String" + } + } +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", + type: { + name: "String" + } + } +}; + +export const cache: OperationParameter = { + parameterPath: ["options", "cache"], + mapper: CacheMapper +}; + +export const storageTargetName: OperationURLParameter = { + parameterPath: "storageTargetName", + mapper: { + constraints: { + Pattern: new RegExp("^[-0-9a-zA-Z_]{1,80}$") + }, + serializedName: "storageTargetName", + required: true, + type: { + name: "String" + } + } +}; + +export const force: OperationQueryParameter = { + parameterPath: ["options", "force"], + mapper: { + serializedName: "force", + type: { + name: "String" + } + } +}; + +export const storagetarget: OperationParameter = { + parameterPath: ["options", "storagetarget"], + mapper: StorageTargetMapper +}; diff --git a/sdk/storagecache/arm-storagecache/src/models/skusMappers.ts b/sdk/storagecache/arm-storagecache/src/models/skusMappers.ts deleted file mode 100644 index 08ac5a68e1b..00000000000 --- a/sdk/storagecache/arm-storagecache/src/models/skusMappers.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - CloudError, - ResourceSku, - ResourceSkuCapabilities, - ResourceSkuLocationInfo, - ResourceSkusResult, - Restriction -} from "../models/mappers"; diff --git a/sdk/storagecache/arm-storagecache/src/models/storageTargetsMappers.ts b/sdk/storagecache/arm-storagecache/src/models/storageTargetsMappers.ts deleted file mode 100644 index ef6ef98db32..00000000000 --- a/sdk/storagecache/arm-storagecache/src/models/storageTargetsMappers.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - BaseResource, - BlobNfsTarget, - Cache, - CacheActiveDirectorySettings, - CacheActiveDirectorySettingsCredentials, - CacheDirectorySettings, - CacheEncryptionSettings, - CacheHealth, - CacheIdentity, - CacheNetworkSettings, - CacheSecuritySettings, - CacheSku, - CacheUpgradeStatus, - CacheUsernameDownloadSettings, - CacheUsernameDownloadSettingsCredentials, - ClfsTarget, - CloudError, - Condition, - KeyVaultKeyReference, - KeyVaultKeyReferenceSourceVault, - NamespaceJunction, - Nfs3Target, - NfsAccessPolicy, - NfsAccessRule, - StorageTarget, - StorageTargetResource, - StorageTargetsResult, - SystemData, - UnknownTarget -} from "../models/mappers"; diff --git a/sdk/storagecache/arm-storagecache/src/operations/ascOperations.ts b/sdk/storagecache/arm-storagecache/src/operations/ascOperations.ts index 08840b3e109..c3951b4ac34 100644 --- a/sdk/storagecache/arm-storagecache/src/operations/ascOperations.ts +++ b/sdk/storagecache/arm-storagecache/src/operations/ascOperations.ts @@ -3,25 +3,28 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/ascOperationsMappers"; +import { AscOperations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { StorageCacheManagementClientContext } from "../storageCacheManagementClientContext"; +import { StorageCacheManagementClient } from "../storageCacheManagementClient"; +import { + AscOperationsGetOptionalParams, + AscOperationsGetResponse +} from "../models"; -/** Class representing a AscOperations. */ -export class AscOperations { - private readonly client: StorageCacheManagementClientContext; +/** Class containing AscOperations operations. */ +export class AscOperationsImpl implements AscOperations { + private readonly client: StorageCacheManagementClient; /** - * Create a AscOperations. - * @param {StorageCacheManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class AscOperations class. + * @param client Reference to the service client */ - constructor(client: StorageCacheManagementClientContext) { + constructor(client: StorageCacheManagementClient) { this.client = client; } @@ -29,51 +32,26 @@ export class AscOperations { * Gets the status of an asynchronous operation for the Azure HPC Cache * @param location The name of the region used to look up the operation. * @param operationId The operation id which uniquely identifies the asynchronous operation. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(location: string, operationId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param location The name of the region used to look up the operation. - * @param operationId The operation id which uniquely identifies the asynchronous operation. - * @param callback The callback - */ - get(location: string, operationId: string, callback: msRest.ServiceCallback): void; - /** - * @param location The name of the region used to look up the operation. - * @param operationId The operation id which uniquely identifies the asynchronous operation. - * @param options The optional parameters - * @param callback The callback - */ - get(location: string, operationId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(location: string, operationId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + location: string, + operationId: string, + options?: AscOperationsGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - location, - operationId, - options - }, - getOperationSpec, - callback) as Promise; + { location, operationId, options }, + getOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/ascOperations/{operationId}", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/locations/{location}/ascOperations/{operationId}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.location, - Parameters.operationId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.AscOperation @@ -82,5 +60,13 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.location, + Parameters.operationId + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/storagecache/arm-storagecache/src/operations/caches.ts b/sdk/storagecache/arm-storagecache/src/operations/caches.ts index e305fdff225..8c54767cbeb 100644 --- a/sdk/storagecache/arm-storagecache/src/operations/caches.ts +++ b/sdk/storagecache/arm-storagecache/src/operations/caches.ts @@ -3,450 +3,823 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/cachesMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Caches } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { StorageCacheManagementClientContext } from "../storageCacheManagementClientContext"; +import { StorageCacheManagementClient } from "../storageCacheManagementClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + Cache, + CachesListNextOptionalParams, + CachesListOptionalParams, + CachesListByResourceGroupNextOptionalParams, + CachesListByResourceGroupOptionalParams, + CachesListResponse, + CachesListByResourceGroupResponse, + CachesDeleteOptionalParams, + CachesGetOptionalParams, + CachesGetResponse, + CachesCreateOrUpdateOptionalParams, + CachesCreateOrUpdateResponse, + CachesUpdateOptionalParams, + CachesUpdateResponse, + CachesDebugInfoOptionalParams, + CachesFlushOptionalParams, + CachesStartOptionalParams, + CachesStopOptionalParams, + CachesUpgradeFirmwareOptionalParams, + CachesListNextResponse, + CachesListByResourceGroupNextResponse +} from "../models"; -/** Class representing a Caches. */ -export class Caches { - private readonly client: StorageCacheManagementClientContext; +/// +/** Class containing Caches operations. */ +export class CachesImpl implements Caches { + private readonly client: StorageCacheManagementClient; /** - * Create a Caches. - * @param {StorageCacheManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class Caches class. + * @param client Reference to the service client */ - constructor(client: StorageCacheManagementClientContext) { + constructor(client: StorageCacheManagementClient) { this.client = client; } /** * Returns all Caches the user has access to under a subscription. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options + public list( + options?: CachesListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); }, - listOperationSpec, - callback) as Promise; + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: CachesListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: CachesListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } } /** * Returns all Caches the user has access to under a resource group. * @param resourceGroupName Target resource group. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName Target resource group. - * @param callback The callback - */ - listByResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Target resource group. - * @param options The optional parameters - * @param callback The callback - */ - listByResourceGroup(resourceGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - options + public listByResourceGroup( + resourceGroupName: string, + options?: CachesListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); }, - listByResourceGroupOperationSpec, - callback) as Promise; + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByResourceGroupPagingPage(resourceGroupName, options); + } + }; + } + + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: CachesListByResourceGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listByResourceGroup(resourceGroupName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByResourceGroupNext( + resourceGroupName, + continuationToken, + options + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: CachesListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * Returns all Caches the user has access to under a subscription. + * @param options The options parameters. + */ + private _list( + options?: CachesListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + + /** + * Returns all Caches the user has access to under a resource group. + * @param resourceGroupName Target resource group. + * @param options The options parameters. + */ + private _listByResourceGroup( + resourceGroupName: string, + options?: CachesListByResourceGroupOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); } /** * Schedules a Cache for deletion. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - deleteMethod(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginDeleteMethod(resourceGroupName,cacheName,options) - .then(lroPoller => lroPoller.pollUntilFinished()); + async beginDelete( + resourceGroupName: string, + cacheName: string, + options?: CachesDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, options }, + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Schedules a Cache for deletion. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + cacheName, + options + ); + return poller.pollUntilDone(); } /** * Returns a Cache. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - get(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param callback The callback - */ - get(resourceGroupName: string, cacheName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, cacheName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + cacheName: string, + options?: CachesGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - cacheName, - options - }, - getOperationSpec, - callback) as Promise; + { resourceGroupName, cacheName, options }, + getOperationSpec + ); } /** * Create or update a Cache. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - createOrUpdate(resourceGroupName: string, cacheName: string, options?: Models.CachesCreateOrUpdateOptionalParams): Promise { - return this.beginCreateOrUpdate(resourceGroupName,cacheName,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginCreateOrUpdate( + resourceGroupName: string, + cacheName: string, + options?: CachesCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + CachesCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, options }, + createOrUpdateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Create or update a Cache. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + cacheName, + options + ); + return poller.pollUntilDone(); } /** * Update a Cache instance. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - update(resourceGroupName: string, cacheName: string, options?: Models.CachesUpdateOptionalParams): Promise; - /** - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param callback The callback - */ - update(resourceGroupName: string, cacheName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param options The optional parameters - * @param callback The callback - */ - update(resourceGroupName: string, cacheName: string, options: Models.CachesUpdateOptionalParams, callback: msRest.ServiceCallback): void; - update(resourceGroupName: string, cacheName: string, options?: Models.CachesUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + update( + resourceGroupName: string, + cacheName: string, + options?: CachesUpdateOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - cacheName, - options - }, - updateOperationSpec, - callback) as Promise; + { resourceGroupName, cacheName, options }, + updateOperationSpec + ); } /** * Tells a Cache to write generate debug info for support to process. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - debugInfo(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginDebugInfo(resourceGroupName,cacheName,options) - .then(lroPoller => lroPoller.pollUntilFinished()); - } + async beginDebugInfo( + resourceGroupName: string, + cacheName: string, + options?: CachesDebugInfoOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; - /** - * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will - * see errors returned until the flush is complete. - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise - */ - flush(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginFlush(resourceGroupName,cacheName,options) - .then(lroPoller => lroPoller.pollUntilFinished()); - } - - /** - * Tells a Stopped state Cache to transition to Active state. - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise - */ - start(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginStart(resourceGroupName,cacheName,options) - .then(lroPoller => lroPoller.pollUntilFinished()); - } - - /** - * Tells an Active Cache to transition to Stopped state. - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise - */ - stop(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginStop(resourceGroupName,cacheName,options) - .then(lroPoller => lroPoller.pollUntilFinished()); - } - - /** - * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no - * effect. - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise - */ - upgradeFirmware(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginUpgradeFirmware(resourceGroupName,cacheName,options) - .then(lroPoller => lroPoller.pollUntilFinished()); - } - - /** - * Schedules a Cache for deletion. - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise - */ - beginDeleteMethod(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - cacheName, - options - }, - beginDeleteMethodOperationSpec, - options); - } - - /** - * Create or update a Cache. - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise - */ - beginCreateOrUpdate(resourceGroupName: string, cacheName: string, options?: Models.CachesBeginCreateOrUpdateOptionalParams): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - cacheName, - options - }, - beginCreateOrUpdateOperationSpec, - options); + const lro = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, options }, + debugInfoOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); } /** * Tells a Cache to write generate debug info for support to process. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - beginDebugInfo(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - cacheName, - options - }, - beginDebugInfoOperationSpec, - options); + async beginDebugInfoAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesDebugInfoOptionalParams + ): Promise { + const poller = await this.beginDebugInfo( + resourceGroupName, + cacheName, + options + ); + return poller.pollUntilDone(); } /** - * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will - * see errors returned until the flush is complete. + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see + * errors returned until the flush is complete. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - beginFlush(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - cacheName, - options - }, - beginFlushOperationSpec, - options); + async beginFlush( + resourceGroupName: string, + cacheName: string, + options?: CachesFlushOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, options }, + flushOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see + * errors returned until the flush is complete. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + async beginFlushAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesFlushOptionalParams + ): Promise { + const poller = await this.beginFlush(resourceGroupName, cacheName, options); + return poller.pollUntilDone(); } /** * Tells a Stopped state Cache to transition to Active state. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - beginStart(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - cacheName, - options - }, - beginStartOperationSpec, - options); + async beginStart( + resourceGroupName: string, + cacheName: string, + options?: CachesStartOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, options }, + startOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Tells a Stopped state Cache to transition to Active state. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + async beginStartAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesStartOptionalParams + ): Promise { + const poller = await this.beginStart(resourceGroupName, cacheName, options); + return poller.pollUntilDone(); } /** * Tells an Active Cache to transition to Stopped state. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - beginStop(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - cacheName, - options - }, - beginStopOperationSpec, - options); + async beginStop( + resourceGroupName: string, + cacheName: string, + options?: CachesStopOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, options }, + stopOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); } /** - * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no - * effect. + * Tells an Active Cache to transition to Stopped state. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - beginUpgradeFirmware(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - cacheName, - options - }, - beginUpgradeFirmwareOperationSpec, - options); + async beginStopAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesStopOptionalParams + ): Promise { + const poller = await this.beginStop(resourceGroupName, cacheName, options); + return poller.pollUntilDone(); } /** - * Returns all Caches the user has access to under a subscription. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + async beginUpgradeFirmware( + resourceGroupName: string, + cacheName: string, + options?: CachesUpgradeFirmwareOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, options }, + upgradeFirmwareOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); } /** - * Returns all Caches the user has access to under a resource group. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - listByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + async beginUpgradeFirmwareAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesUpgradeFirmwareOptionalParams + ): Promise { + const poller = await this.beginUpgradeFirmware( + resourceGroupName, + cacheName, + options + ); + return poller.pollUntilDone(); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listByResourceGroupNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listByResourceGroupNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByResourceGroupNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + nextLink: string, + options?: CachesListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listByResourceGroupNextOperationSpec, - callback) as Promise; + { nextLink, options }, + listNextOperationSpec + ); + } + + /** + * ListByResourceGroupNext + * @param resourceGroupName Target resource group. + * @param nextLink The nextLink from the previous successful call to the ListByResourceGroup method. + * @param options The options parameters. + */ + private _listByResourceGroupNext( + resourceGroupName: string, + nextLink: string, + options?: CachesListByResourceGroupNextOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, nextLink, options }, + listByResourceGroupNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/caches", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.CachesListResult @@ -455,22 +828,15 @@ const listOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], serializer }; - -const listByResourceGroupOperationSpec: msRest.OperationSpec = { +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.CachesListResult @@ -479,242 +845,21 @@ const listByResourceGroupOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.resourceGroupName, - Parameters.cacheName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.Cache - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const updateOperationSpec: msRest.OperationSpec = { - httpMethod: "PATCH", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", - urlParameters: [ - Parameters.resourceGroupName, + Parameters.$host, Parameters.subscriptionId, - Parameters.cacheName + Parameters.resourceGroupName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: [ - "options", - "cache" - ], - mapper: Mappers.Cache - }, - responses: { - 200: { - bodyMapper: Mappers.Cache - }, - default: { - bodyMapper: Mappers.CloudError - } - }, + headerParameters: [Parameters.accept], serializer }; - -const beginDeleteMethodOperationSpec: msRest.OperationSpec = { +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.cacheName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.subscriptionId, - Parameters.cacheName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: [ - "options", - "cache" - ], - mapper: Mappers.Cache - }, - responses: { - 200: { - bodyMapper: Mappers.Cache - }, - 201: { - bodyMapper: Mappers.Cache - }, - 202: {}, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const beginDebugInfoOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.subscriptionId, - Parameters.cacheName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const beginFlushOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.subscriptionId, - Parameters.cacheName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const beginStartOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.subscriptionId, - Parameters.cacheName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const beginStopOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.subscriptionId, - Parameters.cacheName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const beginUpgradeFirmwareOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.subscriptionId, - Parameters.cacheName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { 201: {}, 202: {}, 204: {}, @@ -722,22 +867,213 @@ const beginUpgradeFirmwareOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName + ], + headerParameters: [Parameters.accept], serializer }; - -const listNextOperationSpec: msRest.OperationSpec = { +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", + responses: { + 200: { + bodyMapper: Mappers.Cache + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.nextPageLink + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName ], - queryParameters: [ - Parameters.apiVersion + headerParameters: [Parameters.accept], + serializer +}; +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.Cache + }, + 201: { + bodyMapper: Mappers.Cache + }, + 202: { + bodyMapper: Mappers.Cache + }, + 204: { + bodyMapper: Mappers.Cache + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.cache, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName ], - headerParameters: [ - Parameters.acceptLanguage + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.Cache + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + requestBody: Parameters.cache, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const debugInfoOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/debugInfo", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName + ], + headerParameters: [Parameters.accept], + serializer +}; +const flushOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/flush", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName + ], + headerParameters: [Parameters.accept], + serializer +}; +const startOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/start", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName + ], + headerParameters: [Parameters.accept], + serializer +}; +const stopOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/stop", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName + ], + headerParameters: [Parameters.accept], + serializer +}; +const upgradeFirmwareOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/upgrade", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.CachesListResult @@ -746,22 +1082,18 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept], serializer }; - -const listByResourceGroupNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listByResourceGroupNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.CachesListResult @@ -770,5 +1102,13 @@ const listByResourceGroupNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/storagecache/arm-storagecache/src/operations/index.ts b/sdk/storagecache/arm-storagecache/src/operations/index.ts index e855b3e0869..b254cecd423 100644 --- a/sdk/storagecache/arm-storagecache/src/operations/index.ts +++ b/sdk/storagecache/arm-storagecache/src/operations/index.ts @@ -3,8 +3,7 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ export * from "./operations"; @@ -13,3 +12,4 @@ export * from "./usageModels"; export * from "./ascOperations"; export * from "./caches"; export * from "./storageTargets"; +export * from "./storageTargetOperations"; diff --git a/sdk/storagecache/arm-storagecache/src/operations/operations.ts b/sdk/storagecache/arm-storagecache/src/operations/operations.ts index 5310858388a..0c23b36dc4f 100644 --- a/sdk/storagecache/arm-storagecache/src/operations/operations.ts +++ b/sdk/storagecache/arm-storagecache/src/operations/operations.ts @@ -3,116 +3,109 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/operationsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { StorageCacheManagementClientContext } from "../storageCacheManagementClientContext"; +import { StorageCacheManagementClient } from "../storageCacheManagementClient"; +import { + ApiOperation, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; -/** Class representing a Operations. */ -export class Operations { - private readonly client: StorageCacheManagementClientContext; +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: StorageCacheManagementClient; /** - * Create a Operations. - * @param {StorageCacheManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client */ - constructor(client: StorageCacheManagementClientContext) { + constructor(client: StorageCacheManagementClient) { this.client = client; } /** * Lists all of the available Resource Provider operations. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options + public list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); }, - listOperationSpec, - callback) as Promise; + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } } /** * Lists all of the available Resource Provider operations. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + private _list( + options?: OperationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + nextLink: string, + options?: OperationsListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.StorageCache/operations", - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.ApiOperationListResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); -const listNextOperationSpec: msRest.OperationSpec = { +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.StorageCache/operations", httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.ApiOperationListResult @@ -121,5 +114,24 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ApiOperationListResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/storagecache/arm-storagecache/src/operations/skus.ts b/sdk/storagecache/arm-storagecache/src/operations/skus.ts index 1a932a055c2..9f7d458638b 100644 --- a/sdk/storagecache/arm-storagecache/src/operations/skus.ts +++ b/sdk/storagecache/arm-storagecache/src/operations/skus.ts @@ -3,126 +3,137 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/skusMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Skus } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { StorageCacheManagementClientContext } from "../storageCacheManagementClientContext"; +import { StorageCacheManagementClient } from "../storageCacheManagementClient"; +import { + ResourceSku, + SkusListNextOptionalParams, + SkusListOptionalParams, + SkusListResponse, + SkusListNextResponse +} from "../models"; -/** Class representing a Skus. */ -export class Skus { - private readonly client: StorageCacheManagementClientContext; +/// +/** Class containing Skus operations. */ +export class SkusImpl implements Skus { + private readonly client: StorageCacheManagementClient; /** - * Create a Skus. - * @param {StorageCacheManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class Skus class. + * @param client Reference to the service client */ - constructor(client: StorageCacheManagementClientContext) { + constructor(client: StorageCacheManagementClient) { this.client = client; } /** * Get the list of StorageCache.Cache SKUs available to this subscription. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options + public list( + options?: SkusListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); }, - listOperationSpec, - callback) as Promise; + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: SkusListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: SkusListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } } /** * Get the list of StorageCache.Cache SKUs available to this subscription. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + private _list(options?: SkusListOptionalParams): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + nextLink: string, + options?: SkusListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/skus", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/skus", + responses: { + 200: { + bodyMapper: Mappers.ResourceSkusResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.ResourceSkusResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, + Parameters.nextLink, Parameters.subscriptionId ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.ResourceSkusResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.ResourceSkusResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/storagecache/arm-storagecache/src/operations/storageTargetOperations.ts b/sdk/storagecache/arm-storagecache/src/operations/storageTargetOperations.ts new file mode 100644 index 00000000000..2e9efd27c3d --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/operations/storageTargetOperations.ts @@ -0,0 +1,374 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { StorageTargetOperations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { StorageCacheManagementClient } from "../storageCacheManagementClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + StorageTargetFlushOptionalParams, + StorageTargetSuspendOptionalParams, + StorageTargetResumeOptionalParams +} from "../models"; + +/** Class containing StorageTargetOperations operations. */ +export class StorageTargetOperationsImpl implements StorageTargetOperations { + private readonly client: StorageCacheManagementClient; + + /** + * Initialize a new instance of the class StorageTargetOperations class. + * @param client Reference to the service client + */ + constructor(client: StorageCacheManagementClient) { + this.client = client; + } + + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to + * this storage target's namespace will return errors until the flush operation completes. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + async beginFlush( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetFlushOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, storageTargetName, options }, + flushOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to + * this storage target's namespace will return errors until the flush operation completes. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + async beginFlushAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetFlushOptionalParams + ): Promise { + const poller = await this.beginFlush( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Suspends client access to a storage target. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + async beginSuspend( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetSuspendOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, storageTargetName, options }, + suspendOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Suspends client access to a storage target. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + async beginSuspendAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetSuspendOptionalParams + ): Promise { + const poller = await this.beginSuspend( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Resumes client access to a previously suspended storage target. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + async beginResume( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetResumeOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, storageTargetName, options }, + resumeOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Resumes client access to a previously suspended storage target. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + async beginResumeAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetResumeOptionalParams + ): Promise { + const poller = await this.beginResume( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + return poller.pollUntilDone(); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const flushOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/flush", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName, + Parameters.storageTargetName + ], + headerParameters: [Parameters.accept], + serializer +}; +const suspendOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/suspend", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName, + Parameters.storageTargetName + ], + headerParameters: [Parameters.accept], + serializer +}; +const resumeOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/resume", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName, + Parameters.storageTargetName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/storagecache/arm-storagecache/src/operations/storageTargets.ts b/sdk/storagecache/arm-storagecache/src/operations/storageTargets.ts index 28e5eb568ea..1a250281900 100644 --- a/sdk/storagecache/arm-storagecache/src/operations/storageTargets.ts +++ b/sdk/storagecache/arm-storagecache/src/operations/storageTargets.ts @@ -3,263 +3,478 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/storageTargetsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { StorageTargets } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { StorageCacheManagementClientContext } from "../storageCacheManagementClientContext"; +import { StorageCacheManagementClient } from "../storageCacheManagementClient"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + StorageTarget, + StorageTargetsListByCacheNextOptionalParams, + StorageTargetsListByCacheOptionalParams, + StorageTargetsDnsRefreshOptionalParams, + StorageTargetsListByCacheResponse, + StorageTargetsDeleteOptionalParams, + StorageTargetsGetOptionalParams, + StorageTargetsGetResponse, + StorageTargetsCreateOrUpdateOptionalParams, + StorageTargetsCreateOrUpdateResponse, + StorageTargetsListByCacheNextResponse +} from "../models"; -/** Class representing a StorageTargets. */ -export class StorageTargets { - private readonly client: StorageCacheManagementClientContext; +/// +/** Class containing StorageTargets operations. */ +export class StorageTargetsImpl implements StorageTargets { + private readonly client: StorageCacheManagementClient; /** - * Create a StorageTargets. - * @param {StorageCacheManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class StorageTargets class. + * @param client Reference to the service client */ - constructor(client: StorageCacheManagementClientContext) { + constructor(client: StorageCacheManagementClient) { this.client = client; } - /** - * Tells a storage target to refresh its DNS information. - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param storageTargetName Name of Storage Target. - * @param [options] The optional parameters - * @returns Promise - */ - dnsRefresh(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginDnsRefresh(resourceGroupName,cacheName,storageTargetName,options) - .then(lroPoller => lroPoller.pollUntilFinished()); - } - /** * Returns a list of Storage Targets for the specified Cache. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. */ - listByCache(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param callback The callback - */ - listByCache(resourceGroupName: string, cacheName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param options The optional parameters - * @param callback The callback - */ - listByCache(resourceGroupName: string, cacheName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByCache(resourceGroupName: string, cacheName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { + public listByCache( + resourceGroupName: string, + cacheName: string, + options?: StorageTargetsListByCacheOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByCachePagingAll( + resourceGroupName, + cacheName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByCachePagingPage( + resourceGroupName, + cacheName, + options + ); + } + }; + } + + private async *listByCachePagingPage( + resourceGroupName: string, + cacheName: string, + options?: StorageTargetsListByCacheOptionalParams + ): AsyncIterableIterator { + let result = await this._listByCache(resourceGroupName, cacheName, options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listByCacheNext( resourceGroupName, cacheName, + continuationToken, options - }, - listByCacheOperationSpec, - callback) as Promise; + ); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listByCachePagingAll( + resourceGroupName: string, + cacheName: string, + options?: StorageTargetsListByCacheOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByCachePagingPage( + resourceGroupName, + cacheName, + options + )) { + yield* page; + } } /** - * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache - * is down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache is + * Tells a storage target to refresh its DNS information. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + async beginDnsRefresh( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsDnsRefreshOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, storageTargetName, options }, + dnsRefreshOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs, + lroResourceLocationConfig: "azure-async-operation" + }); + } + + /** + * Tells a storage target to refresh its DNS information. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + async beginDnsRefreshAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsDnsRefreshOptionalParams + ): Promise { + const poller = await this.beginDnsRefresh( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Returns a list of Storage Targets for the specified Cache. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + private _listByCache( + resourceGroupName: string, + cacheName: string, + options?: StorageTargetsListByCacheOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, cacheName, options }, + listByCacheOperationSpec + ); + } + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is + * down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache is * healthy again. Note that if the Cache has data to flush to the Storage Target, the data will be * flushed before the Storage Target will be deleted. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - deleteMethod(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginDeleteMethod(resourceGroupName,cacheName,storageTargetName,options) - .then(lroPoller => lroPoller.pollUntilFinished()); + async beginDelete( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, storageTargetName, options }, + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is + * down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache is + * healthy again. Note that if the Cache has data to flush to the Storage Target, the data will be + * flushed before the Storage Target will be deleted. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + return poller.pollUntilDone(); } /** * Returns a Storage Target from a Cache. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param storageTargetName Name of Storage Target. - * @param callback The callback - */ - get(resourceGroupName: string, cacheName: string, storageTargetName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param storageTargetName Name of Storage Target. - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, cacheName: string, storageTargetName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - cacheName, - storageTargetName, - options - }, - getOperationSpec, - callback) as Promise; + { resourceGroupName, cacheName, storageTargetName, options }, + getOperationSpec + ); } /** - * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is - * down or unhealthy, the actual creation/modification of the Storage Target may be delayed until - * the Cache is healthy again. + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down + * or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache + * is healthy again. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - createOrUpdate(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: Models.StorageTargetsCreateOrUpdateOptionalParams): Promise { - return this.beginCreateOrUpdate(resourceGroupName,cacheName,storageTargetName,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginCreateOrUpdate( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + StorageTargetsCreateOrUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, cacheName, storageTargetName, options }, + createOrUpdateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** - * Tells a storage target to refresh its DNS information. + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down + * or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache + * is healthy again. * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. * @param storageTargetName Name of Storage Target. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginDnsRefresh(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - cacheName, - storageTargetName, - options - }, - beginDnsRefreshOperationSpec, - options); + async beginCreateOrUpdateAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsCreateOrUpdateOptionalParams + ): Promise { + const poller = await this.beginCreateOrUpdate( + resourceGroupName, + cacheName, + storageTargetName, + options + ); + return poller.pollUntilDone(); } /** - * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache - * is down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache is - * healthy again. Note that if the Cache has data to flush to the Storage Target, the data will be - * flushed before the Storage Target will be deleted. + * ListByCacheNext * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param storageTargetName Name of Storage Target. - * @param [options] The optional parameters - * @returns Promise + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param nextLink The nextLink from the previous successful call to the ListByCache method. + * @param options The options parameters. */ - beginDeleteMethod(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - cacheName, - storageTargetName, - options - }, - beginDeleteMethodOperationSpec, - options); - } - - /** - * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is - * down or unhealthy, the actual creation/modification of the Storage Target may be delayed until - * the Cache is healthy again. - * @param resourceGroupName Target resource group. - * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be - * from the [-0-9a-zA-Z_] char class. - * @param storageTargetName Name of Storage Target. - * @param [options] The optional parameters - * @returns Promise - */ - beginCreateOrUpdate(resourceGroupName: string, cacheName: string, storageTargetName: string, options?: Models.StorageTargetsBeginCreateOrUpdateOptionalParams): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - cacheName, - storageTargetName, - options - }, - beginCreateOrUpdateOperationSpec, - options); - } - - /** - * Returns a list of Storage Targets for the specified Cache. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise - */ - listByCacheNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback - */ - listByCacheNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listByCacheNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByCacheNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listByCacheNext( + resourceGroupName: string, + cacheName: string, + nextLink: string, + options?: StorageTargetsListByCacheNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listByCacheNextOperationSpec, - callback) as Promise; + { resourceGroupName, cacheName, nextLink, options }, + listByCacheNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listByCacheOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets", +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const dnsRefreshOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.resourceGroupName, + Parameters.$host, Parameters.subscriptionId, - Parameters.cacheName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.resourceGroupName, + Parameters.cacheName, + Parameters.storageTargetName ], + headerParameters: [Parameters.accept], + serializer +}; +const listByCacheOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.StorageTargetsResult @@ -268,24 +483,44 @@ const listByCacheOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName + ], + headerParameters: [Parameters.accept], serializer }; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}", +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion, Parameters.force], urlParameters: [ - Parameters.resourceGroupName, + Parameters.$host, Parameters.subscriptionId, + Parameters.resourceGroupName, Parameters.cacheName, Parameters.storageTargetName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.StorageTarget @@ -294,82 +529,21 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, - serializer -}; - -const beginDnsRefreshOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}/dnsRefresh", + queryParameters: [Parameters.apiVersion], urlParameters: [ - Parameters.resourceGroupName, + Parameters.$host, Parameters.subscriptionId, + Parameters.resourceGroupName, Parameters.cacheName, Parameters.storageTargetName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: {}, - 202: {}, - default: { - bodyMapper: Mappers.CloudError - } - }, + headerParameters: [Parameters.accept], serializer }; - -const beginDeleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.subscriptionId, - Parameters.cacheName, - Parameters.storageTargetName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: {}, - 202: {}, - 204: {}, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { +const createOrUpdateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}", httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.StorageCache/caches/{cacheName}/storageTargets/{storageTargetName}", - urlParameters: [ - Parameters.resourceGroupName, - Parameters.subscriptionId, - Parameters.cacheName, - Parameters.storageTargetName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: [ - "options", - "storagetarget" - ], - mapper: Mappers.StorageTarget - }, responses: { 200: { bodyMapper: Mappers.StorageTarget @@ -377,27 +551,32 @@ const beginCreateOrUpdateOperationSpec: msRest.OperationSpec = { 201: { bodyMapper: Mappers.StorageTarget }, - 202: {}, + 202: { + bodyMapper: Mappers.StorageTarget + }, + 204: { + bodyMapper: Mappers.StorageTarget + }, default: { bodyMapper: Mappers.CloudError } }, + requestBody: Parameters.storagetarget, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName, + Parameters.storageTargetName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", serializer }; - -const listByCacheNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", +const listByCacheNextOperationSpec: coreClient.OperationSpec = { path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.StorageTargetsResult @@ -406,5 +585,14 @@ const listByCacheNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.CloudError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.nextLink, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.cacheName + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/storagecache/arm-storagecache/src/operations/usageModels.ts b/sdk/storagecache/arm-storagecache/src/operations/usageModels.ts index 17029293a4b..a0f0a8f02d6 100644 --- a/sdk/storagecache/arm-storagecache/src/operations/usageModels.ts +++ b/sdk/storagecache/arm-storagecache/src/operations/usageModels.ts @@ -3,126 +3,140 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/usageModelsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { UsageModels } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { StorageCacheManagementClientContext } from "../storageCacheManagementClientContext"; +import { StorageCacheManagementClient } from "../storageCacheManagementClient"; +import { + UsageModel, + UsageModelsListNextOptionalParams, + UsageModelsListOptionalParams, + UsageModelsListResponse, + UsageModelsListNextResponse +} from "../models"; -/** Class representing a UsageModels. */ -export class UsageModels { - private readonly client: StorageCacheManagementClientContext; +/// +/** Class containing UsageModels operations. */ +export class UsageModelsImpl implements UsageModels { + private readonly client: StorageCacheManagementClient; /** - * Create a UsageModels. - * @param {StorageCacheManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class UsageModels class. + * @param client Reference to the service client */ - constructor(client: StorageCacheManagementClientContext) { + constructor(client: StorageCacheManagementClient) { this.client = client; } /** * Get the list of Cache Usage Models available to this subscription. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options + public list( + options?: UsageModelsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); }, - listOperationSpec, - callback) as Promise; + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: UsageModelsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: UsageModelsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } } /** * Get the list of Cache Usage Models available to this subscription. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + private _list( + options?: UsageModelsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + nextLink: string, + options?: UsageModelsListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/usageModels", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.StorageCache/usageModels", + responses: { + 200: { + bodyMapper: Mappers.UsageModelsResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.UsageModelsResult + }, + default: { + bodyMapper: Mappers.CloudError + } + }, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, + Parameters.nextLink, Parameters.subscriptionId ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.UsageModelsResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, - serializer -}; - -const listNextOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.UsageModelsResult - }, - default: { - bodyMapper: Mappers.CloudError - } - }, + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/storagecache/arm-storagecache/src/operationsInterfaces/ascOperations.ts b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/ascOperations.ts new file mode 100644 index 00000000000..95356add12e --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/ascOperations.ts @@ -0,0 +1,27 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + AscOperationsGetOptionalParams, + AscOperationsGetResponse +} from "../models"; + +/** Interface representing a AscOperations. */ +export interface AscOperations { + /** + * Gets the status of an asynchronous operation for the Azure HPC Cache + * @param location The name of the region used to look up the operation. + * @param operationId The operation id which uniquely identifies the asynchronous operation. + * @param options The options parameters. + */ + get( + location: string, + operationId: string, + options?: AscOperationsGetOptionalParams + ): Promise; +} diff --git a/sdk/storagecache/arm-storagecache/src/operationsInterfaces/caches.ts b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/caches.ts new file mode 100644 index 00000000000..200ea3798b6 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/caches.ts @@ -0,0 +1,245 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + Cache, + CachesListOptionalParams, + CachesListByResourceGroupOptionalParams, + CachesDeleteOptionalParams, + CachesGetOptionalParams, + CachesGetResponse, + CachesCreateOrUpdateOptionalParams, + CachesCreateOrUpdateResponse, + CachesUpdateOptionalParams, + CachesUpdateResponse, + CachesDebugInfoOptionalParams, + CachesFlushOptionalParams, + CachesStartOptionalParams, + CachesStopOptionalParams, + CachesUpgradeFirmwareOptionalParams +} from "../models"; + +/// +/** Interface representing a Caches. */ +export interface Caches { + /** + * Returns all Caches the user has access to under a subscription. + * @param options The options parameters. + */ + list(options?: CachesListOptionalParams): PagedAsyncIterableIterator; + /** + * Returns all Caches the user has access to under a resource group. + * @param resourceGroupName Target resource group. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: CachesListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Schedules a Cache for deletion. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + cacheName: string, + options?: CachesDeleteOptionalParams + ): Promise, void>>; + /** + * Schedules a Cache for deletion. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesDeleteOptionalParams + ): Promise; + /** + * Returns a Cache. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + cacheName: string, + options?: CachesGetOptionalParams + ): Promise; + /** + * Create or update a Cache. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + cacheName: string, + options?: CachesCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + CachesCreateOrUpdateResponse + > + >; + /** + * Create or update a Cache. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesCreateOrUpdateOptionalParams + ): Promise; + /** + * Update a Cache instance. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + update( + resourceGroupName: string, + cacheName: string, + options?: CachesUpdateOptionalParams + ): Promise; + /** + * Tells a Cache to write generate debug info for support to process. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginDebugInfo( + resourceGroupName: string, + cacheName: string, + options?: CachesDebugInfoOptionalParams + ): Promise, void>>; + /** + * Tells a Cache to write generate debug info for support to process. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginDebugInfoAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesDebugInfoOptionalParams + ): Promise; + /** + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see + * errors returned until the flush is complete. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginFlush( + resourceGroupName: string, + cacheName: string, + options?: CachesFlushOptionalParams + ): Promise, void>>; + /** + * Tells a Cache to write all dirty data to the Storage Target(s). During the flush, clients will see + * errors returned until the flush is complete. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginFlushAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesFlushOptionalParams + ): Promise; + /** + * Tells a Stopped state Cache to transition to Active state. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginStart( + resourceGroupName: string, + cacheName: string, + options?: CachesStartOptionalParams + ): Promise, void>>; + /** + * Tells a Stopped state Cache to transition to Active state. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginStartAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesStartOptionalParams + ): Promise; + /** + * Tells an Active Cache to transition to Stopped state. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginStop( + resourceGroupName: string, + cacheName: string, + options?: CachesStopOptionalParams + ): Promise, void>>; + /** + * Tells an Active Cache to transition to Stopped state. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginStopAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesStopOptionalParams + ): Promise; + /** + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginUpgradeFirmware( + resourceGroupName: string, + cacheName: string, + options?: CachesUpgradeFirmwareOptionalParams + ): Promise, void>>; + /** + * Upgrade a Cache's firmware if a new version is available. Otherwise, this operation has no effect. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + beginUpgradeFirmwareAndWait( + resourceGroupName: string, + cacheName: string, + options?: CachesUpgradeFirmwareOptionalParams + ): Promise; +} diff --git a/sdk/storagecache/arm-storagecache/src/operationsInterfaces/index.ts b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/index.ts new file mode 100644 index 00000000000..b254cecd423 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/index.ts @@ -0,0 +1,15 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./operations"; +export * from "./skus"; +export * from "./usageModels"; +export * from "./ascOperations"; +export * from "./caches"; +export * from "./storageTargets"; +export * from "./storageTargetOperations"; diff --git a/sdk/storagecache/arm-storagecache/src/operationsInterfaces/operations.ts b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/operations.ts new file mode 100644 index 00000000000..b8cab468f6e --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/operations.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { ApiOperation, OperationsListOptionalParams } from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * Lists all of the available Resource Provider operations. + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/storagecache/arm-storagecache/src/operationsInterfaces/skus.ts b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/skus.ts new file mode 100644 index 00000000000..4955941f644 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/skus.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { ResourceSku, SkusListOptionalParams } from "../models"; + +/// +/** Interface representing a Skus. */ +export interface Skus { + /** + * Get the list of StorageCache.Cache SKUs available to this subscription. + * @param options The options parameters. + */ + list( + options?: SkusListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/storagecache/arm-storagecache/src/operationsInterfaces/storageTargetOperations.ts b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/storageTargetOperations.ts new file mode 100644 index 00000000000..df99bf74a0c --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/storageTargetOperations.ts @@ -0,0 +1,104 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + StorageTargetFlushOptionalParams, + StorageTargetSuspendOptionalParams, + StorageTargetResumeOptionalParams +} from "../models"; + +/** Interface representing a StorageTargetOperations. */ +export interface StorageTargetOperations { + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to + * this storage target's namespace will return errors until the flush operation completes. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginFlush( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetFlushOptionalParams + ): Promise, void>>; + /** + * Tells the cache to write all dirty data to the Storage Target's backend storage. Client requests to + * this storage target's namespace will return errors until the flush operation completes. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginFlushAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetFlushOptionalParams + ): Promise; + /** + * Suspends client access to a storage target. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginSuspend( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetSuspendOptionalParams + ): Promise, void>>; + /** + * Suspends client access to a storage target. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginSuspendAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetSuspendOptionalParams + ): Promise; + /** + * Resumes client access to a previously suspended storage target. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginResume( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetResumeOptionalParams + ): Promise, void>>; + /** + * Resumes client access to a previously suspended storage target. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginResumeAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetResumeOptionalParams + ): Promise; +} diff --git a/sdk/storagecache/arm-storagecache/src/operationsInterfaces/storageTargets.ts b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/storageTargets.ts new file mode 100644 index 00000000000..0f7e85ddc7f --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/storageTargets.ts @@ -0,0 +1,150 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + StorageTarget, + StorageTargetsListByCacheOptionalParams, + StorageTargetsDnsRefreshOptionalParams, + StorageTargetsDeleteOptionalParams, + StorageTargetsGetOptionalParams, + StorageTargetsGetResponse, + StorageTargetsCreateOrUpdateOptionalParams, + StorageTargetsCreateOrUpdateResponse +} from "../models"; + +/// +/** Interface representing a StorageTargets. */ +export interface StorageTargets { + /** + * Returns a list of Storage Targets for the specified Cache. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param options The options parameters. + */ + listByCache( + resourceGroupName: string, + cacheName: string, + options?: StorageTargetsListByCacheOptionalParams + ): PagedAsyncIterableIterator; + /** + * Tells a storage target to refresh its DNS information. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginDnsRefresh( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsDnsRefreshOptionalParams + ): Promise, void>>; + /** + * Tells a storage target to refresh its DNS information. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginDnsRefreshAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsDnsRefreshOptionalParams + ): Promise; + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is + * down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache is + * healthy again. Note that if the Cache has data to flush to the Storage Target, the data will be + * flushed before the Storage Target will be deleted. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsDeleteOptionalParams + ): Promise, void>>; + /** + * Removes a Storage Target from a Cache. This operation is allowed at any time, but if the Cache is + * down or unhealthy, the actual removal of the Storage Target may be delayed until the Cache is + * healthy again. Note that if the Cache has data to flush to the Storage Target, the data will be + * flushed before the Storage Target will be deleted. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsDeleteOptionalParams + ): Promise; + /** + * Returns a Storage Target from a Cache. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsGetOptionalParams + ): Promise; + /** + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down + * or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache + * is healthy again. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginCreateOrUpdate( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsCreateOrUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + StorageTargetsCreateOrUpdateResponse + > + >; + /** + * Create or update a Storage Target. This operation is allowed at any time, but if the Cache is down + * or unhealthy, the actual creation/modification of the Storage Target may be delayed until the Cache + * is healthy again. + * @param resourceGroupName Target resource group. + * @param cacheName Name of Cache. Length of name must not be greater than 80 and chars must be from + * the [-0-9a-zA-Z_] char class. + * @param storageTargetName Name of Storage Target. + * @param options The options parameters. + */ + beginCreateOrUpdateAndWait( + resourceGroupName: string, + cacheName: string, + storageTargetName: string, + options?: StorageTargetsCreateOrUpdateOptionalParams + ): Promise; +} diff --git a/sdk/storagecache/arm-storagecache/src/operationsInterfaces/usageModels.ts b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/usageModels.ts new file mode 100644 index 00000000000..b07e9c06165 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/src/operationsInterfaces/usageModels.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { UsageModel, UsageModelsListOptionalParams } from "../models"; + +/// +/** Interface representing a UsageModels. */ +export interface UsageModels { + /** + * Get the list of Cache Usage Models available to this subscription. + * @param options The options parameters. + */ + list( + options?: UsageModelsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/storagecache/arm-storagecache/src/storageCacheManagementClient.ts b/sdk/storagecache/arm-storagecache/src/storageCacheManagementClient.ts index cb15178503b..6b15255992f 100644 --- a/sdk/storagecache/arm-storagecache/src/storageCacheManagementClient.ts +++ b/sdk/storagecache/arm-storagecache/src/storageCacheManagementClient.ts @@ -3,50 +3,102 @@ * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "./models"; -import * as Mappers from "./models/mappers"; -import * as operations from "./operations"; -import { StorageCacheManagementClientContext } from "./storageCacheManagementClientContext"; +import * as coreClient from "@azure/core-client"; +import * as coreAuth from "@azure/core-auth"; +import { + OperationsImpl, + SkusImpl, + UsageModelsImpl, + AscOperationsImpl, + CachesImpl, + StorageTargetsImpl, + StorageTargetOperationsImpl +} from "./operations"; +import { + Operations, + Skus, + UsageModels, + AscOperations, + Caches, + StorageTargets, + StorageTargetOperations +} from "./operationsInterfaces"; +import { StorageCacheManagementClientOptionalParams } from "./models"; - -class StorageCacheManagementClient extends StorageCacheManagementClientContext { - // Operation groups - operations: operations.Operations; - skus: operations.Skus; - usageModels: operations.UsageModels; - ascOperations: operations.AscOperations; - caches: operations.Caches; - storageTargets: operations.StorageTargets; +export class StorageCacheManagementClient extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; /** * Initializes a new instance of the StorageCacheManagementClient class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure - * subscription. The subscription ID forms part of the URI for every service call. - * @param [options] The parameter options + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure subscription. + * The subscription ID forms part of the URI for every service call. + * @param options The parameter options */ - constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.StorageCacheManagementClientOptions) { - super(credentials, subscriptionId, options); - this.operations = new operations.Operations(this); - this.skus = new operations.Skus(this); - this.usageModels = new operations.UsageModels(this); - this.ascOperations = new operations.AscOperations(this); - this.caches = new operations.Caches(this); - this.storageTargets = new operations.StorageTargets(this); + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: StorageCacheManagementClientOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (subscriptionId === undefined) { + throw new Error("'subscriptionId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: StorageCacheManagementClientOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-storagecache/5.0.0`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + if (!options.credentialScopes) { + options.credentialScopes = ["https://management.azure.com/.default"]; + } + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: options.endpoint || "https://management.azure.com" + }; + super(optionsWithDefaults); + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2021-09-01"; + this.operations = new OperationsImpl(this); + this.skus = new SkusImpl(this); + this.usageModels = new UsageModelsImpl(this); + this.ascOperations = new AscOperationsImpl(this); + this.caches = new CachesImpl(this); + this.storageTargets = new StorageTargetsImpl(this); + this.storageTargetOperations = new StorageTargetOperationsImpl(this); } + + operations: Operations; + skus: Skus; + usageModels: UsageModels; + ascOperations: AscOperations; + caches: Caches; + storageTargets: StorageTargets; + storageTargetOperations: StorageTargetOperations; } - -// Operation Specifications - -export { - StorageCacheManagementClient, - StorageCacheManagementClientContext, - Models as StorageCacheManagementModels, - Mappers as StorageCacheManagementMappers -}; -export * from "./operations"; diff --git a/sdk/storagecache/arm-storagecache/src/storageCacheManagementClientContext.ts b/sdk/storagecache/arm-storagecache/src/storageCacheManagementClientContext.ts deleted file mode 100644 index 563563daa71..00000000000 --- a/sdk/storagecache/arm-storagecache/src/storageCacheManagementClientContext.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. - * Licensed under the MIT License. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import * as Models from "./models"; -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; - -const packageName = "@azure/arm-storagecache"; -const packageVersion = "4.0.0"; - -export class StorageCacheManagementClientContext extends msRestAzure.AzureServiceClient { - credentials: msRest.ServiceClientCredentials; - subscriptionId: string; - apiVersion?: string; - - /** - * Initializes a new instance of the StorageCacheManagementClient class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure - * subscription. The subscription ID forms part of the URI for every service call. - * @param [options] The parameter options - */ - constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.StorageCacheManagementClientOptions) { - if (credentials == undefined) { - throw new Error('\'credentials\' cannot be null.'); - } - if (subscriptionId == undefined) { - throw new Error('\'subscriptionId\' cannot be null.'); - } - - if (!options) { - options = {}; - } - if(!options.userAgent) { - const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); - options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; - } - - super(credentials, options); - - this.apiVersion = '2021-03-01'; - this.acceptLanguage = 'en-US'; - this.longRunningOperationRetryTimeout = 30; - this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; - this.requestContentType = "application/json; charset=utf-8"; - this.credentials = credentials; - this.subscriptionId = subscriptionId; - - if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { - this.acceptLanguage = options.acceptLanguage; - } - if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { - this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; - } - } -} diff --git a/sdk/storagecache/arm-storagecache/test/sampleTest.ts b/sdk/storagecache/arm-storagecache/test/sampleTest.ts new file mode 100644 index 00000000000..7ed89b043e1 --- /dev/null +++ b/sdk/storagecache/arm-storagecache/test/sampleTest.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + env, + record, + RecorderEnvironmentSetup, + Recorder +} from "@azure-tools/test-recorder"; +import * as assert from "assert"; + +const recorderEnvSetup: RecorderEnvironmentSetup = { + replaceableVariables: { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" + }, + customizationsOnRecordings: [ + (recording: any): any => + recording.replace( + /"access_token":"[^"]*"/g, + `"access_token":"access_token"` + ) + ], + queryParametersToSkip: [] +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function() { + recorder = record(this, recorderEnvSetup); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/storagecache/arm-storagecache/tsconfig.json b/sdk/storagecache/arm-storagecache/tsconfig.json index 422b584abd5..c2eb8c5f77f 100644 --- a/sdk/storagecache/arm-storagecache/tsconfig.json +++ b/sdk/storagecache/arm-storagecache/tsconfig.json @@ -3,7 +3,7 @@ "module": "es6", "moduleResolution": "node", "strict": true, - "target": "es5", + "target": "es6", "sourceMap": true, "declarationMap": true, "esModuleInterop": true, @@ -11,9 +11,10 @@ "forceConsistentCasingInFileNames": true, "lib": ["es6", "dom"], "declaration": true, - "outDir": "./esm", - "importHelpers": true + "outDir": "./dist-esm", + "importHelpers": true, + "paths": { "@azure/arm-storagecache": ["./src/index"] } }, - "include": ["./src/**/*.ts"], + "include": ["./src/**/*.ts", "./test/**/*.ts", "samples-dev/**/*.ts"], "exclude": ["node_modules"] } diff --git a/sdk/storagecache/ci.yml b/sdk/storagecache/ci.yml new file mode 100644 index 00000000000..23185bf8ccb --- /dev/null +++ b/sdk/storagecache/ci.yml @@ -0,0 +1,30 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/storagecache/ + +pr: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/storagecache/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: storagecache + Artifacts: + - name: azure-arm-storagecache + safeName: azurearmstoragecache + \ No newline at end of file diff --git a/sdk/storagesync/arm-storagesync/CHANGELOG.md b/sdk/storagesync/arm-storagesync/CHANGELOG.md new file mode 100644 index 00000000000..df2621245d7 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 9.0.0 (2022-01-21) + +The package of @azure/arm-storagesync is using our next generation design principles since version 9.0.0, which contains breaking changes. + +To understand the detail of the change, please refer to [Changelog](https://aka.ms/js-track2-changelog). + +To migrate the existing applications to the latest version, please refer to [Migration Guide](https://aka.ms/js-track2-migration-guide). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/js-track2-quickstart). diff --git a/sdk/storagesync/arm-storagesync/LICENSE b/sdk/storagesync/arm-storagesync/LICENSE new file mode 100644 index 00000000000..5d1d36e0af8 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/storagesync/arm-storagesync/README.md b/sdk/storagesync/arm-storagesync/README.md index 3020fe4cd13..f9269c1da30 100644 --- a/sdk/storagesync/arm-storagesync/README.md +++ b/sdk/storagesync/arm-storagesync/README.md @@ -1,99 +1,98 @@ -## Azure StorageSyncManagementClient SDK for JavaScript +# Azure Service client library for JavaScript -This package contains an isomorphic SDK for StorageSyncManagementClient. +This package contains an isomorphic SDK (runs both in Node.js and in browsers) for Azure Service client. + +Microsoft Storage Sync Service API + +[Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storagesync/arm-storagesync) | +[Package (NPM)](https://www.npmjs.com/package/@azure/arm-storagesync) | +[API reference documentation](https://docs.microsoft.com/javascript/api/@azure/arm-storagesync) | +[Samples](https://github.com/Azure-Samples/azure-samples-js-management) + +## Getting started ### Currently supported environments - [LTS versions of Node.js](https://nodejs.org/about/releases/) -- Latest versions of Safari, Chrome, Edge, and Firefox. +- Latest versions of Safari, Chrome, Edge and Firefox. -### How to Install +### Prerequisites + +- An [Azure subscription][azure_sub]. + +### Install the `@azure/arm-storagesync` package + +Install the Azure Service client library for JavaScript with `npm`: ```bash npm install @azure/arm-storagesync ``` -### How to use +### Create and authenticate a `MicrosoftStorageSync` -#### nodejs - Authentication, client creation and list operations as an example written in TypeScript. +To create a client object to access the Azure Service API, you will need the `endpoint` of your Azure Service resource and a `credential`. The Azure Service client can use Azure Active Directory credentials to authenticate. +You can find the endpoint for your Azure Service resource in the [Azure Portal][azure_portal]. -##### Install @azure/ms-rest-nodeauth +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). -- Please install minimum version of `"@azure/ms-rest-nodeauth": "^3.0.0"`. -```bash -npm install @azure/ms-rest-nodeauth@"^3.0.0" -``` - -##### Sample code - -```typescript -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as msRestNodeAuth from "@azure/ms-rest-nodeauth"; -import { StorageSyncManagementClient, StorageSyncManagementModels, StorageSyncManagementMappers } from "@azure/arm-storagesync"; -const subscriptionId = process.env["AZURE_SUBSCRIPTION_ID"]; - -msRestNodeAuth.interactiveLogin().then((creds) => { - const client = new StorageSyncManagementClient(creds, subscriptionId); - client.operations.list().then((result) => { - console.log("The result is:"); - console.log(result); - }); -}).catch((err) => { - console.error(err); -}); -``` - -#### browser - Authentication, client creation and list operations as an example written in JavaScript. - -##### Install @azure/ms-rest-browserauth +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/ms-rest-browserauth +npm install @azure/identity ``` -##### Sample code +You will also need to **register a new AAD application and grant access to Azure Service** by assigning the suitable role to your service principal (note: roles such as `"Owner"` will not grant the necessary permissions). +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET`. -See https://github.com/Azure/ms-rest-browserauth to learn how to authenticate to Azure in the browser. +For more information about how to create an Azure AD Application check out [this guide](https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal). -- index.html -```html - - - - @azure/arm-storagesync sample - - - - - - - - +```javascript +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); +const subscriptionId = "00000000-0000-0000-0000-000000000000"; +const client = new MicrosoftStorageSync(new DefaultAzureCredential(), 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 + +### MicrosoftStorageSync + +`MicrosoftStorageSync` is the primary interface for developers using the Azure Service client library. Explore the methods on this client object to understand the different features of the Azure Service service that you can access. + +## Troubleshooting + +### Logging + +Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`: + +```javascript +const { setLogLevel } = require("@azure/logger"); +setLogLevel("info"); +``` + +For more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger). + +## Next steps + +Please take a look at the [samples](https://github.com/Azure-Samples/azure-samples-js-management) directory for detailed examples on how to use this library. + +## Contributing + +If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code. + ## Related projects -- [Microsoft Azure SDK for Javascript](https://github.com/Azure/azure-sdk-for-js) +- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js) -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js/sdk/storagesync/arm-storagesync/README.png) +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fstoragesync%2Farm-storagesync%2FREADME.png) + +[azure_cli]: https://docs.microsoft.com/cli/azure +[azure_sub]: https://azure.microsoft.com/free/ +[azure_sub]: https://azure.microsoft.com/free/ +[azure_portal]: https://portal.azure.com +[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity +[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential diff --git a/sdk/storagesync/arm-storagesync/_meta.json b/sdk/storagesync/arm-storagesync/_meta.json new file mode 100644 index 00000000000..8e1326356db --- /dev/null +++ b/sdk/storagesync/arm-storagesync/_meta.json @@ -0,0 +1,7 @@ +{ + "commit": "f9a6cb686bcc0f1b23761db19f2491c5c4df95cb", + "readme": "specification/storagesync/resource-manager/readme.md", + "autorest_command": "autorest --version=3.7.3 --typescript --modelerfour.lenient-model-deduplication --head-as-boolean=true --license-header=MICROSOFT_MIT_NO_VERSION --generate-test --typescript-sdks-folder=D:\\mydev\\azure-sdk-for-js ../azure-rest-api-specs/specification/storagesync/resource-manager/readme.md --use=@autorest/typescript@6.0.0-alpha.16.20220114.1 --generate-sample=true", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "use": "@autorest/typescript@6.0.0-alpha.16.20220114.1" +} \ No newline at end of file diff --git a/sdk/storagesync/arm-storagesync/api-extractor.json b/sdk/storagesync/arm-storagesync/api-extractor.json new file mode 100644 index 00000000000..7d7ca49f31a --- /dev/null +++ b/sdk/storagesync/arm-storagesync/api-extractor.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "mainEntryPointFilePath": "./dist-esm/src/index.d.ts", + "docModel": { "enabled": true }, + "apiReport": { "enabled": true, "reportFolder": "./review" }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "", + "publicTrimmedFilePath": "./types/arm-storagesync.d.ts" + }, + "messages": { + "tsdocMessageReporting": { "default": { "logLevel": "none" } }, + "extractorMessageReporting": { + "ae-missing-release-tag": { "logLevel": "none" }, + "ae-unresolved-link": { "logLevel": "none" } + } + } +} diff --git a/sdk/storagesync/arm-storagesync/package.json b/sdk/storagesync/arm-storagesync/package.json index 29b8ef52098..7ca01610c98 100644 --- a/sdk/storagesync/arm-storagesync/package.json +++ b/sdk/storagesync/arm-storagesync/package.json @@ -1,58 +1,103 @@ { "name": "@azure/arm-storagesync", + "sdk-type": "mgmt", "author": "Microsoft Corporation", - "description": "StorageSyncManagementClient Library with typescript type definitions for node.js and browser.", - "version": "8.0.0", + "description": "A generated SDK for MicrosoftStorageSync.", + "version": "9.0.0", + "engines": { "node": ">=12.0.0" }, "dependencies": { - "@azure/ms-rest-azure-js": "^2.0.1", - "@azure/ms-rest-js": "^2.0.4", - "tslib": "^1.10.0" + "@azure/core-lro": "^2.2.0", + "@azure/abort-controller": "^1.0.0", + "@azure/core-paging": "^1.2.0", + "@azure/core-client": "^1.0.0", + "@azure/core-auth": "^1.3.0", + "@azure/core-rest-pipeline": "^1.1.0", + "tslib": "^2.2.0" }, - "keywords": [ - "node", - "azure", - "typescript", - "browser", - "isomorphic" - ], + "keywords": ["node", "azure", "typescript", "browser", "isomorphic"], "license": "MIT", - "main": "./dist/arm-storagesync.js", - "module": "./esm/storageSyncManagementClient.js", - "types": "./esm/storageSyncManagementClient.d.ts", + "main": "./dist/index.js", + "module": "./dist-esm/src/index.js", + "types": "./types/arm-storagesync.d.ts", "devDependencies": { - "typescript": "^3.5.3", - "rollup": "^1.18.0", - "rollup-plugin-node-resolve": "^5.2.0", + "@microsoft/api-extractor": "^7.18.11", + "@rollup/plugin-commonjs": "11.0.2", + "@rollup/plugin-json": "^4.0.0", + "@rollup/plugin-multi-entry": "^3.0.0", + "@rollup/plugin-node-resolve": "^8.0.0", + "mkdirp": "^1.0.4", + "rollup": "^1.16.3", "rollup-plugin-sourcemaps": "^0.4.2", - "uglify-js": "^3.6.0" + "typescript": "~4.2.0", + "uglify-js": "^3.4.9", + "rimraf": "^3.0.0", + "@azure/identity": "^2.0.1", + "@azure-tools/test-recorder": "^1.0.0", + "mocha": "^7.1.1", + "cross-env": "^7.0.2" }, "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storagesync/arm-storagesync", "repository": { "type": "git", "url": "https://github.com/Azure/azure-sdk-for-js.git" }, - "bugs": { - "url": "https://github.com/Azure/azure-sdk-for-js/issues" - }, + "bugs": { "url": "https://github.com/Azure/azure-sdk-for-js/issues" }, "files": [ "dist/**/*.js", "dist/**/*.js.map", "dist/**/*.d.ts", "dist/**/*.d.ts.map", - "esm/**/*.js", - "esm/**/*.js.map", - "esm/**/*.d.ts", - "esm/**/*.d.ts.map", + "dist-esm/**/*.js", + "dist-esm/**/*.js.map", + "dist-esm/**/*.d.ts", + "dist-esm/**/*.d.ts.map", "src/**/*.ts", "README.md", + "LICENSE", "rollup.config.js", - "tsconfig.json" + "tsconfig.json", + "review/*", + "CHANGELOG.md", + "types/*" ], "scripts": { - "build": "tsc && rollup -c rollup.config.js && npm run minify", - "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/arm-storagesync.js.map'\" -o ./dist/arm-storagesync.min.js ./dist/arm-storagesync.js", - "prepack": "npm install && npm run build" + "build": "npm run clean && tsc && rollup -c 2>&1 && npm run minify && mkdirp ./review && npm run extract-api", + "minify": "uglifyjs -c -m --comments --source-map \"content='./dist/index.js.map'\" -o ./dist/index.min.js ./dist/index.js", + "prepack": "npm run build", + "pack": "npm pack 2>&1", + "extract-api": "api-extractor run --local", + "lint": "echo skipped", + "audit": "echo skipped", + "clean": "rimraf dist dist-browser dist-esm test-dist temp types *.tgz *.log", + "build:node": "echo skipped", + "build:browser": "echo skipped", + "build:test": "echo skipped", + "build:samples": "echo skipped.", + "check-format": "echo skipped", + "execute:samples": "echo skipped", + "format": "echo skipped", + "test": "npm run integration-test", + "test:node": "echo skipped", + "test:browser": "echo skipped", + "unit-test": "npm run unit-test:node && npm run unit-test:browser", + "unit-test:node": "cross-env TEST_MODE=playback npm run integration-test:node", + "unit-test:browser": "echo skipped", + "integration-test": "npm run integration-test:node && npm run integration-test:browser", + "integration-test:node": "mocha -r esm --require ts-node/register --timeout 1200000 --full-trace test/*.ts --reporter ../../../common/tools/mocha-multi-reporter.js", + "integration-test:browser": "echo skipped", + "docs": "echo skipped" }, "sideEffects": false, - "autoPublish": true + "//metadata": { + "constantPaths": [ + { "path": "src/MicrosoftStorageSync.ts", "prefix": "packageDetails" } + ] + }, + "autoPublish": true, + "//sampleConfiguration": { + "productName": "", + "productSlugs": ["azure"], + "disableDocsMs": true, + "apiRefLink": "https://docs.microsoft.com/javascript/api/@azure/arm-storagesync?view=azure-node-preview" + } } diff --git a/sdk/storagesync/arm-storagesync/recordings/node/my_test/recording_sample_test.js b/sdk/storagesync/arm-storagesync/recordings/node/my_test/recording_sample_test.js new file mode 100644 index 00000000000..0f6ecb857ac --- /dev/null +++ b/sdk/storagesync/arm-storagesync/recordings/node/my_test/recording_sample_test.js @@ -0,0 +1,5 @@ +let nock = require('nock'); + +module.exports.hash = "7a6be38bb8cb644d64b4094802301751"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} diff --git a/sdk/storagesync/arm-storagesync/review/arm-storagesync.api.md b/sdk/storagesync/arm-storagesync/review/arm-storagesync.api.md new file mode 100644 index 00000000000..762e62b1aa1 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/review/arm-storagesync.api.md @@ -0,0 +1,1614 @@ +## API Report File for "@azure/arm-storagesync" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import * as coreAuth from '@azure/core-auth'; +import * as coreClient from '@azure/core-client'; +import { PagedAsyncIterableIterator } from '@azure/core-paging'; +import { PollerLike } from '@azure/core-lro'; +import { PollOperationState } from '@azure/core-lro'; + +// @public +export interface BackupRequest { + azureFileShare?: string; +} + +// @public +export type ChangeDetectionMode = string; + +// @public +export interface CheckNameAvailabilityParameters { + name: string; + type: "Microsoft.StorageSync/storageSyncServices"; +} + +// @public +export interface CheckNameAvailabilityResult { + readonly message?: string; + readonly nameAvailable?: boolean; + readonly reason?: NameAvailabilityReason; +} + +// @public +export type CloudEndpoint = ProxyResource & { + storageAccountResourceId?: string; + azureFileShareName?: string; + storageAccountTenantId?: string; + partnershipId?: string; + friendlyName?: string; + readonly backupEnabled?: string; + provisioningState?: string; + lastWorkflowId?: string; + lastOperationName?: string; + readonly changeEnumerationStatus?: CloudEndpointChangeEnumerationStatus; +}; + +// @public +export interface CloudEndpointArray { + value?: CloudEndpoint[]; +} + +// @public +export interface CloudEndpointChangeEnumerationActivity { + readonly deletesProgressPercent?: number; + readonly lastUpdatedTimestamp?: Date; + readonly minutesRemaining?: number; + readonly operationState?: CloudEndpointChangeEnumerationActivityState; + readonly processedDirectoriesCount?: number; + readonly processedFilesCount?: number; + readonly progressPercent?: number; + readonly startedTimestamp?: Date; + readonly statusCode?: number; + readonly totalCountsState?: CloudEndpointChangeEnumerationTotalCountsState; + readonly totalDirectoriesCount?: number; + readonly totalFilesCount?: number; + readonly totalSizeBytes?: number; +} + +// @public +export type CloudEndpointChangeEnumerationActivityState = string; + +// @public +export interface CloudEndpointChangeEnumerationStatus { + readonly activity?: CloudEndpointChangeEnumerationActivity; + readonly lastEnumerationStatus?: CloudEndpointLastChangeEnumerationStatus; + readonly lastUpdatedTimestamp?: Date; +} + +// @public +export type CloudEndpointChangeEnumerationTotalCountsState = string; + +// @public +export type CloudEndpointCreateParameters = ProxyResource & { + storageAccountResourceId?: string; + azureFileShareName?: string; + storageAccountTenantId?: string; + friendlyName?: string; +}; + +// @public +export interface CloudEndpointLastChangeEnumerationStatus { + readonly completedTimestamp?: Date; + readonly namespaceDirectoriesCount?: number; + readonly namespaceFilesCount?: number; + readonly namespaceSizeBytes?: number; + readonly nextRunTimestamp?: Date; + readonly startedTimestamp?: Date; +} + +// @public +export interface CloudEndpoints { + beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: CloudEndpointCreateParameters, options?: CloudEndpointsCreateOptionalParams): Promise, CloudEndpointsCreateResponse>>; + beginCreateAndWait(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: CloudEndpointCreateParameters, options?: CloudEndpointsCreateOptionalParams): Promise; + beginDelete(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: CloudEndpointsDeleteOptionalParams): Promise, CloudEndpointsDeleteResponse>>; + beginDeleteAndWait(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: CloudEndpointsDeleteOptionalParams): Promise; + beginPostBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: BackupRequest, options?: CloudEndpointsPostBackupOptionalParams): Promise, CloudEndpointsPostBackupResponse>>; + beginPostBackupAndWait(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: BackupRequest, options?: CloudEndpointsPostBackupOptionalParams): Promise; + beginPostRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: PostRestoreRequest, options?: CloudEndpointsPostRestoreOptionalParams): Promise, void>>; + beginPostRestoreAndWait(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: PostRestoreRequest, options?: CloudEndpointsPostRestoreOptionalParams): Promise; + beginPreBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: BackupRequest, options?: CloudEndpointsPreBackupOptionalParams): Promise, CloudEndpointsPreBackupResponse>>; + beginPreBackupAndWait(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: BackupRequest, options?: CloudEndpointsPreBackupOptionalParams): Promise; + beginPreRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: PreRestoreRequest, options?: CloudEndpointsPreRestoreOptionalParams): Promise, void>>; + beginPreRestoreAndWait(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: PreRestoreRequest, options?: CloudEndpointsPreRestoreOptionalParams): Promise; + beginTriggerChangeDetection(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: TriggerChangeDetectionParameters, options?: CloudEndpointsTriggerChangeDetectionOptionalParams): Promise, void>>; + beginTriggerChangeDetectionAndWait(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: TriggerChangeDetectionParameters, options?: CloudEndpointsTriggerChangeDetectionOptionalParams): Promise; + get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: CloudEndpointsGetOptionalParams): Promise; + listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: CloudEndpointsListBySyncGroupOptionalParams): PagedAsyncIterableIterator; + restoreheartbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: CloudEndpointsRestoreheartbeatOptionalParams): Promise; +} + +// @public +export interface CloudEndpointsCreateHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface CloudEndpointsCreateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type CloudEndpointsCreateResponse = CloudEndpointsCreateHeaders & CloudEndpoint; + +// @public +export interface CloudEndpointsDeleteHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface CloudEndpointsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type CloudEndpointsDeleteResponse = CloudEndpointsDeleteHeaders; + +// @public +export interface CloudEndpointsGetHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface CloudEndpointsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CloudEndpointsGetResponse = CloudEndpointsGetHeaders & CloudEndpoint; + +// @public +export interface CloudEndpointsListBySyncGroupHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface CloudEndpointsListBySyncGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CloudEndpointsListBySyncGroupResponse = CloudEndpointsListBySyncGroupHeaders & CloudEndpointArray; + +// @public +export interface CloudEndpointsPostBackupHeaders { + location?: string; + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface CloudEndpointsPostBackupOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type CloudEndpointsPostBackupResponse = CloudEndpointsPostBackupHeaders & PostBackupResponse; + +// @public +export interface CloudEndpointsPostRestoreHeaders { + location?: string; + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface CloudEndpointsPostRestoreOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface CloudEndpointsPreBackupHeaders { + location?: string; + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface CloudEndpointsPreBackupOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type CloudEndpointsPreBackupResponse = CloudEndpointsPreBackupHeaders; + +// @public +export interface CloudEndpointsPreRestoreHeaders { + location?: string; + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface CloudEndpointsPreRestoreOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface CloudEndpointsRestoreheartbeatHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface CloudEndpointsRestoreheartbeatOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type CloudEndpointsRestoreheartbeatResponse = CloudEndpointsRestoreheartbeatHeaders; + +// @public +export interface CloudEndpointsTriggerChangeDetectionHeaders { + location?: string; + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface CloudEndpointsTriggerChangeDetectionOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface CloudTieringCachePerformance { + readonly cacheHitBytes?: number; + readonly cacheHitBytesPercent?: number; + readonly cacheMissBytes?: number; + readonly lastUpdatedTimestamp?: Date; +} + +// @public +export interface CloudTieringDatePolicyStatus { + readonly lastUpdatedTimestamp?: Date; + readonly tieredFilesMostRecentAccessTimestamp?: Date; +} + +// @public +export interface CloudTieringFilesNotTiering { + readonly errors?: FilesNotTieringError[]; + readonly lastUpdatedTimestamp?: Date; + readonly totalFileCount?: number; +} + +// @public +export interface CloudTieringSpaceSavings { + readonly cachedSizeBytes?: number; + readonly lastUpdatedTimestamp?: Date; + readonly spaceSavingsBytes?: number; + readonly spaceSavingsPercent?: number; + readonly totalSizeCloudBytes?: number; + readonly volumeSizeBytes?: number; +} + +// @public +export interface CloudTieringVolumeFreeSpacePolicyStatus { + readonly currentVolumeFreeSpacePercent?: number; + readonly effectiveVolumeFreeSpacePolicy?: number; + readonly lastUpdatedTimestamp?: Date; +} + +// @public +export type FeatureStatus = string; + +// @public +export interface FilesNotTieringError { + readonly errorCode?: number; + readonly fileCount?: number; +} + +// @public +export type IncomingTrafficPolicy = string; + +// @public +export type InitialDownloadPolicy = string; + +// @public +export type InitialUploadPolicy = string; + +// @public +export enum KnownChangeDetectionMode { + // (undocumented) + Default = "Default", + // (undocumented) + Recursive = "Recursive" +} + +// @public +export enum KnownCloudEndpointChangeEnumerationActivityState { + // (undocumented) + EnumerationInProgress = "EnumerationInProgress", + // (undocumented) + InitialEnumerationInProgress = "InitialEnumerationInProgress" +} + +// @public +export enum KnownCloudEndpointChangeEnumerationTotalCountsState { + // (undocumented) + Calculating = "Calculating", + // (undocumented) + Final = "Final" +} + +// @public +export enum KnownFeatureStatus { + // (undocumented) + Off = "off", + // (undocumented) + On = "on" +} + +// @public +export enum KnownIncomingTrafficPolicy { + // (undocumented) + AllowAllTraffic = "AllowAllTraffic", + // (undocumented) + AllowVirtualNetworksOnly = "AllowVirtualNetworksOnly" +} + +// @public +export enum KnownInitialDownloadPolicy { + // (undocumented) + AvoidTieredFiles = "AvoidTieredFiles", + // (undocumented) + NamespaceOnly = "NamespaceOnly", + // (undocumented) + NamespaceThenModifiedFiles = "NamespaceThenModifiedFiles" +} + +// @public +export enum KnownInitialUploadPolicy { + // (undocumented) + Merge = "Merge", + // (undocumented) + ServerAuthoritative = "ServerAuthoritative" +} + +// @public +export enum KnownLocalCacheMode { + // (undocumented) + DownloadNewAndModifiedFiles = "DownloadNewAndModifiedFiles", + // (undocumented) + UpdateLocallyCachedFiles = "UpdateLocallyCachedFiles" +} + +// @public +export enum KnownOperationDirection { + // (undocumented) + Cancel = "cancel", + // (undocumented) + Do = "do", + // (undocumented) + Undo = "undo" +} + +// @public +export enum KnownPrivateEndpointConnectionProvisioningState { + // (undocumented) + Creating = "Creating", + // (undocumented) + Deleting = "Deleting", + // (undocumented) + Failed = "Failed", + // (undocumented) + Succeeded = "Succeeded" +} + +// @public +export enum KnownPrivateEndpointServiceConnectionStatus { + // (undocumented) + Approved = "Approved", + // (undocumented) + Pending = "Pending", + // (undocumented) + Rejected = "Rejected" +} + +// @public +export enum KnownProgressType { + // (undocumented) + Download = "download", + // (undocumented) + Initialize = "initialize", + // (undocumented) + None = "none", + // (undocumented) + Recall = "recall", + // (undocumented) + Upload = "upload" +} + +// @public +export enum KnownReason { + // (undocumented) + Deleted = "Deleted", + // (undocumented) + Registered = "Registered", + // (undocumented) + Suspended = "Suspended", + // (undocumented) + Unregistered = "Unregistered", + // (undocumented) + Warned = "Warned" +} + +// @public +export enum KnownRegisteredServerAgentVersionStatus { + // (undocumented) + Blocked = "Blocked", + // (undocumented) + Expired = "Expired", + // (undocumented) + NearExpiry = "NearExpiry", + // (undocumented) + Ok = "Ok" +} + +// @public +export enum KnownServerEndpointHealthState { + // (undocumented) + Error = "Error", + // (undocumented) + Healthy = "Healthy", + // (undocumented) + Unavailable = "Unavailable" +} + +// @public +export enum KnownServerEndpointOfflineDataTransferState { + // (undocumented) + Complete = "Complete", + // (undocumented) + InProgress = "InProgress", + // (undocumented) + NotRunning = "NotRunning", + // (undocumented) + Stopping = "Stopping" +} + +// @public +export enum KnownServerEndpointSyncActivityState { + // (undocumented) + Download = "Download", + // (undocumented) + Upload = "Upload", + // (undocumented) + UploadAndDownload = "UploadAndDownload" +} + +// @public +export enum KnownServerEndpointSyncMode { + // (undocumented) + InitialFullDownload = "InitialFullDownload", + // (undocumented) + InitialUpload = "InitialUpload", + // (undocumented) + NamespaceDownload = "NamespaceDownload", + // (undocumented) + Regular = "Regular", + // (undocumented) + SnapshotUpload = "SnapshotUpload" +} + +// @public +export enum KnownWorkflowStatus { + // (undocumented) + Aborted = "aborted", + // (undocumented) + Active = "active", + // (undocumented) + Expired = "expired", + // (undocumented) + Failed = "failed", + // (undocumented) + Succeeded = "succeeded" +} + +// @public +export type LocalCacheMode = string; + +// @public +export interface LocationOperationStatus { + readonly endTime?: Date; + readonly error?: StorageSyncApiError; + readonly id?: string; + readonly name?: string; + readonly percentComplete?: number; + readonly startTime?: Date; + readonly status?: string; +} + +// @public +export interface LocationOperationStatusOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type LocationOperationStatusResponse = MicrosoftStorageSyncLocationOperationStatusHeaders & LocationOperationStatus; + +// @public (undocumented) +export class MicrosoftStorageSync extends coreClient.ServiceClient { + // (undocumented) + $host: string; + constructor(credentials: coreAuth.TokenCredential, subscriptionId: string, options?: MicrosoftStorageSyncOptionalParams); + // (undocumented) + apiVersion: string; + // (undocumented) + cloudEndpoints: CloudEndpoints; + locationOperationStatus(locationName: string, operationId: string, options?: LocationOperationStatusOptionalParams): Promise; + // (undocumented) + operations: Operations; + // (undocumented) + operationStatusOperations: OperationStatusOperations; + // (undocumented) + privateEndpointConnections: PrivateEndpointConnections; + // (undocumented) + privateLinkResources: PrivateLinkResources; + // (undocumented) + registeredServers: RegisteredServers; + // (undocumented) + serverEndpoints: ServerEndpoints; + // (undocumented) + storageSyncServices: StorageSyncServices; + // (undocumented) + subscriptionId: string; + // (undocumented) + syncGroups: SyncGroups; + // (undocumented) + workflows: Workflows; +} + +// @public +export interface MicrosoftStorageSyncLocationOperationStatusHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface MicrosoftStorageSyncOptionalParams extends coreClient.ServiceClientOptions { + $host?: string; + apiVersion?: string; + endpoint?: string; +} + +// @public +export type NameAvailabilityReason = "Invalid" | "AlreadyExists"; + +// @public +export type OperationDirection = string; + +// @public +export interface OperationDisplayInfo { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public +export interface OperationDisplayResource { + description?: string; + operation?: string; + provider?: string; + resource?: string; +} + +// @public +export interface OperationEntity { + display?: OperationDisplayInfo; + name?: string; + origin?: string; + properties?: OperationProperties; +} + +// @public +export interface OperationEntityListResult { + nextLink?: string; + value?: OperationEntity[]; +} + +// @public +export interface OperationProperties { + serviceSpecification?: OperationResourceServiceSpecification; +} + +// @public +export interface OperationResourceMetricSpecification { + aggregationType?: string; + dimensions?: OperationResourceMetricSpecificationDimension[]; + displayDescription?: string; + displayName?: string; + fillGapWithZero?: boolean; + name?: string; + unit?: string; +} + +// @public +export interface OperationResourceMetricSpecificationDimension { + displayName?: string; + name?: string; + toBeExportedForShoebox?: boolean; +} + +// @public +export interface OperationResourceServiceSpecification { + metricSpecifications?: OperationResourceMetricSpecification[]; +} + +// @public +export interface Operations { + list(options?: OperationsListOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface OperationsListHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface OperationsListNextHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface OperationsListNextOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListNextResponse = OperationsListNextHeaders & OperationEntityListResult; + +// @public +export interface OperationsListOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationsListResponse = OperationsListHeaders & OperationEntityListResult; + +// @public +export interface OperationStatus { + readonly endTime?: Date; + readonly error?: StorageSyncApiError; + readonly name?: string; + readonly startTime?: Date; + readonly status?: string; +} + +// @public +export interface OperationStatusGetHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface OperationStatusGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type OperationStatusGetResponse = OperationStatusGetHeaders & OperationStatus; + +// @public +export interface OperationStatusOperations { + get(resourceGroupName: string, locationName: string, workflowId: string, operationId: string, options?: OperationStatusGetOptionalParams): Promise; +} + +// @public +export interface PostBackupResponse { + readonly cloudEndpointName?: string; +} + +// @public +export interface PostRestoreRequest { + azureFileShareUri?: string; + failedFileList?: string; + partition?: string; + replicaGroup?: string; + requestId?: string; + restoreFileSpec?: RestoreFileSpec[]; + sourceAzureFileShareUri?: string; + status?: string; +} + +// @public +export interface PreRestoreRequest { + azureFileShareUri?: string; + backupMetadataPropertyBag?: string; + partition?: string; + pauseWaitForSyncDrainTimePeriodInSeconds?: number; + replicaGroup?: string; + requestId?: string; + restoreFileSpec?: RestoreFileSpec[]; + sourceAzureFileShareUri?: string; + status?: string; +} + +// @public +export interface PrivateEndpoint { + readonly id?: string; +} + +// @public +export type PrivateEndpointConnection = Resource & { + privateEndpoint?: PrivateEndpoint; + privateLinkServiceConnectionState?: PrivateLinkServiceConnectionState; + readonly provisioningState?: PrivateEndpointConnectionProvisioningState; +}; + +// @public +export interface PrivateEndpointConnectionListResult { + value?: PrivateEndpointConnection[]; +} + +// @public +export type PrivateEndpointConnectionProvisioningState = string; + +// @public +export interface PrivateEndpointConnections { + beginCreate(resourceGroupName: string, storageSyncServiceName: string, privateEndpointConnectionName: string, properties: PrivateEndpointConnection, options?: PrivateEndpointConnectionsCreateOptionalParams): Promise, PrivateEndpointConnectionsCreateResponse>>; + beginCreateAndWait(resourceGroupName: string, storageSyncServiceName: string, privateEndpointConnectionName: string, properties: PrivateEndpointConnection, options?: PrivateEndpointConnectionsCreateOptionalParams): Promise; + beginDelete(resourceGroupName: string, storageSyncServiceName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): Promise, void>>; + beginDeleteAndWait(resourceGroupName: string, storageSyncServiceName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsDeleteOptionalParams): Promise; + get(resourceGroupName: string, storageSyncServiceName: string, privateEndpointConnectionName: string, options?: PrivateEndpointConnectionsGetOptionalParams): Promise; + listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options?: PrivateEndpointConnectionsListByStorageSyncServiceOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface PrivateEndpointConnectionsCreateHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: string; + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface PrivateEndpointConnectionsCreateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type PrivateEndpointConnectionsCreateResponse = PrivateEndpointConnection; + +// @public +export interface PrivateEndpointConnectionsDeleteHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: string; + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface PrivateEndpointConnectionsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export interface PrivateEndpointConnectionsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type PrivateEndpointConnectionsGetResponse = PrivateEndpointConnection; + +// @public +export interface PrivateEndpointConnectionsListByStorageSyncServiceHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface PrivateEndpointConnectionsListByStorageSyncServiceOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type PrivateEndpointConnectionsListByStorageSyncServiceResponse = PrivateEndpointConnectionsListByStorageSyncServiceHeaders & PrivateEndpointConnectionListResult; + +// @public +export type PrivateEndpointServiceConnectionStatus = string; + +// @public +export type PrivateLinkResource = Resource & { + readonly groupId?: string; + readonly requiredMembers?: string[]; + requiredZoneNames?: string[]; +}; + +// @public +export interface PrivateLinkResourceListResult { + value?: PrivateLinkResource[]; +} + +// @public +export interface PrivateLinkResources { + listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options?: PrivateLinkResourcesListByStorageSyncServiceOptionalParams): Promise; +} + +// @public +export interface PrivateLinkResourcesListByStorageSyncServiceOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type PrivateLinkResourcesListByStorageSyncServiceResponse = PrivateLinkResourceListResult; + +// @public +export interface PrivateLinkServiceConnectionState { + actionsRequired?: string; + description?: string; + status?: PrivateEndpointServiceConnectionStatus; +} + +// @public +export type ProgressType = string; + +// @public +export type ProxyResource = Resource & {}; + +// @public +export type Reason = string; + +// @public +export interface RecallActionParameters { + pattern?: string; + recallPath?: string; +} + +// @public +export type RegisteredServer = ProxyResource & { + serverCertificate?: string; + agentVersion?: string; + readonly agentVersionStatus?: RegisteredServerAgentVersionStatus; + readonly agentVersionExpirationDate?: Date; + serverOSVersion?: string; + serverManagementErrorCode?: number; + lastHeartBeat?: string; + provisioningState?: string; + serverRole?: string; + clusterId?: string; + clusterName?: string; + serverId?: string; + storageSyncServiceUid?: string; + lastWorkflowId?: string; + lastOperationName?: string; + discoveryEndpointUri?: string; + resourceLocation?: string; + serviceLocation?: string; + friendlyName?: string; + managementEndpointUri?: string; + monitoringEndpointUri?: string; + monitoringConfiguration?: string; + readonly serverName?: string; +}; + +// @public +export type RegisteredServerAgentVersionStatus = string; + +// @public +export interface RegisteredServerArray { + value?: RegisteredServer[]; +} + +// @public +export type RegisteredServerCreateParameters = ProxyResource & { + serverCertificate?: string; + agentVersion?: string; + serverOSVersion?: string; + lastHeartBeat?: string; + serverRole?: string; + clusterId?: string; + clusterName?: string; + serverId?: string; + friendlyName?: string; +}; + +// @public +export interface RegisteredServers { + beginCreate(resourceGroupName: string, storageSyncServiceName: string, serverId: string, parameters: RegisteredServerCreateParameters, options?: RegisteredServersCreateOptionalParams): Promise, RegisteredServersCreateResponse>>; + beginCreateAndWait(resourceGroupName: string, storageSyncServiceName: string, serverId: string, parameters: RegisteredServerCreateParameters, options?: RegisteredServersCreateOptionalParams): Promise; + beginDelete(resourceGroupName: string, storageSyncServiceName: string, serverId: string, options?: RegisteredServersDeleteOptionalParams): Promise, RegisteredServersDeleteResponse>>; + beginDeleteAndWait(resourceGroupName: string, storageSyncServiceName: string, serverId: string, options?: RegisteredServersDeleteOptionalParams): Promise; + beginTriggerRollover(resourceGroupName: string, storageSyncServiceName: string, serverId: string, parameters: TriggerRolloverRequest, options?: RegisteredServersTriggerRolloverOptionalParams): Promise, RegisteredServersTriggerRolloverResponse>>; + beginTriggerRolloverAndWait(resourceGroupName: string, storageSyncServiceName: string, serverId: string, parameters: TriggerRolloverRequest, options?: RegisteredServersTriggerRolloverOptionalParams): Promise; + get(resourceGroupName: string, storageSyncServiceName: string, serverId: string, options?: RegisteredServersGetOptionalParams): Promise; + listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options?: RegisteredServersListByStorageSyncServiceOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface RegisteredServersCreateHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface RegisteredServersCreateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type RegisteredServersCreateResponse = RegisteredServersCreateHeaders & RegisteredServer; + +// @public +export interface RegisteredServersDeleteHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface RegisteredServersDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type RegisteredServersDeleteResponse = RegisteredServersDeleteHeaders; + +// @public +export interface RegisteredServersGetHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface RegisteredServersGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type RegisteredServersGetResponse = RegisteredServersGetHeaders & RegisteredServer; + +// @public +export interface RegisteredServersListByStorageSyncServiceHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface RegisteredServersListByStorageSyncServiceOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type RegisteredServersListByStorageSyncServiceResponse = RegisteredServersListByStorageSyncServiceHeaders & RegisteredServerArray; + +// @public +export interface RegisteredServersTriggerRolloverHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface RegisteredServersTriggerRolloverOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type RegisteredServersTriggerRolloverResponse = RegisteredServersTriggerRolloverHeaders; + +// @public +export interface Resource { + readonly id?: string; + readonly name?: string; + readonly type?: string; +} + +// @public +export interface ResourcesMoveInfo { + resources?: string[]; + targetResourceGroup?: string; +} + +// @public +export interface RestoreFileSpec { + isdir?: boolean; + path?: string; +} + +// @public +export type ServerEndpoint = ProxyResource & { + serverLocalPath?: string; + cloudTiering?: FeatureStatus; + volumeFreeSpacePercent?: number; + tierFilesOlderThanDays?: number; + friendlyName?: string; + serverResourceId?: string; + readonly provisioningState?: string; + readonly lastWorkflowId?: string; + readonly lastOperationName?: string; + readonly syncStatus?: ServerEndpointSyncStatus; + offlineDataTransfer?: FeatureStatus; + readonly offlineDataTransferStorageAccountResourceId?: string; + readonly offlineDataTransferStorageAccountTenantId?: string; + offlineDataTransferShareName?: string; + readonly cloudTieringStatus?: ServerEndpointCloudTieringStatus; + readonly recallStatus?: ServerEndpointRecallStatus; + initialDownloadPolicy?: InitialDownloadPolicy; + localCacheMode?: LocalCacheMode; + initialUploadPolicy?: InitialUploadPolicy; + readonly serverName?: string; +}; + +// @public +export interface ServerEndpointArray { + value?: ServerEndpoint[]; +} + +// @public +export interface ServerEndpointBackgroundDataDownloadActivity { + readonly downloadedBytes?: number; + readonly percentProgress?: number; + readonly startedTimestamp?: Date; + readonly timestamp?: Date; +} + +// @public +export interface ServerEndpointCloudTieringStatus { + readonly cachePerformance?: CloudTieringCachePerformance; + readonly datePolicyStatus?: CloudTieringDatePolicyStatus; + readonly filesNotTiering?: CloudTieringFilesNotTiering; + readonly health?: ServerEndpointHealthState; + readonly healthLastUpdatedTimestamp?: Date; + readonly lastCloudTieringResult?: number; + readonly lastSuccessTimestamp?: Date; + readonly lastUpdatedTimestamp?: Date; + readonly spaceSavings?: CloudTieringSpaceSavings; + readonly volumeFreeSpacePolicyStatus?: CloudTieringVolumeFreeSpacePolicyStatus; +} + +// @public +export type ServerEndpointCreateParameters = ProxyResource & { + serverLocalPath?: string; + cloudTiering?: FeatureStatus; + volumeFreeSpacePercent?: number; + tierFilesOlderThanDays?: number; + friendlyName?: string; + serverResourceId?: string; + offlineDataTransfer?: FeatureStatus; + offlineDataTransferShareName?: string; + initialDownloadPolicy?: InitialDownloadPolicy; + localCacheMode?: LocalCacheMode; + initialUploadPolicy?: InitialUploadPolicy; +}; + +// @public +export interface ServerEndpointFilesNotSyncingError { + readonly errorCode?: number; + readonly persistentCount?: number; + readonly transientCount?: number; +} + +// @public +export type ServerEndpointHealthState = string; + +// @public +export type ServerEndpointOfflineDataTransferState = string; + +// @public +export interface ServerEndpointRecallError { + readonly count?: number; + readonly errorCode?: number; +} + +// @public +export interface ServerEndpointRecallStatus { + readonly lastUpdatedTimestamp?: Date; + readonly recallErrors?: ServerEndpointRecallError[]; + readonly totalRecallErrorsCount?: number; +} + +// @public +export interface ServerEndpoints { + beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, parameters: ServerEndpointCreateParameters, options?: ServerEndpointsCreateOptionalParams): Promise, ServerEndpointsCreateResponse>>; + beginCreateAndWait(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, parameters: ServerEndpointCreateParameters, options?: ServerEndpointsCreateOptionalParams): Promise; + beginDelete(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: ServerEndpointsDeleteOptionalParams): Promise, ServerEndpointsDeleteResponse>>; + beginDeleteAndWait(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: ServerEndpointsDeleteOptionalParams): Promise; + beginRecallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, parameters: RecallActionParameters, options?: ServerEndpointsRecallActionOptionalParams): Promise, ServerEndpointsRecallActionResponse>>; + beginRecallActionAndWait(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, parameters: RecallActionParameters, options?: ServerEndpointsRecallActionOptionalParams): Promise; + beginUpdate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: ServerEndpointsUpdateOptionalParams): Promise, ServerEndpointsUpdateResponse>>; + beginUpdateAndWait(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: ServerEndpointsUpdateOptionalParams): Promise; + get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: ServerEndpointsGetOptionalParams): Promise; + listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: ServerEndpointsListBySyncGroupOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface ServerEndpointsCreateHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface ServerEndpointsCreateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ServerEndpointsCreateResponse = ServerEndpointsCreateHeaders & ServerEndpoint; + +// @public +export interface ServerEndpointsDeleteHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface ServerEndpointsDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ServerEndpointsDeleteResponse = ServerEndpointsDeleteHeaders; + +// @public +export interface ServerEndpointsGetHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface ServerEndpointsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ServerEndpointsGetResponse = ServerEndpointsGetHeaders & ServerEndpoint; + +// @public +export interface ServerEndpointsListBySyncGroupHeaders { + location?: string; + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface ServerEndpointsListBySyncGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type ServerEndpointsListBySyncGroupResponse = ServerEndpointsListBySyncGroupHeaders & ServerEndpointArray; + +// @public +export interface ServerEndpointsRecallActionHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface ServerEndpointsRecallActionOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ServerEndpointsRecallActionResponse = ServerEndpointsRecallActionHeaders; + +// @public +export interface ServerEndpointsUpdateHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface ServerEndpointsUpdateOptionalParams extends coreClient.OperationOptions { + parameters?: ServerEndpointUpdateParameters; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type ServerEndpointsUpdateResponse = ServerEndpointsUpdateHeaders & ServerEndpoint; + +// @public +export type ServerEndpointSyncActivityState = string; + +// @public +export interface ServerEndpointSyncActivityStatus { + readonly appliedBytes?: number; + readonly appliedItemCount?: number; + readonly perItemErrorCount?: number; + readonly sessionMinutesRemaining?: number; + readonly syncMode?: ServerEndpointSyncMode; + readonly timestamp?: Date; + readonly totalBytes?: number; + readonly totalItemCount?: number; +} + +// @public +export type ServerEndpointSyncMode = string; + +// @public +export interface ServerEndpointSyncSessionStatus { + readonly filesNotSyncingErrors?: ServerEndpointFilesNotSyncingError[]; + readonly lastSyncMode?: ServerEndpointSyncMode; + readonly lastSyncPerItemErrorCount?: number; + readonly lastSyncResult?: number; + readonly lastSyncSuccessTimestamp?: Date; + readonly lastSyncTimestamp?: Date; + readonly persistentFilesNotSyncingCount?: number; + readonly transientFilesNotSyncingCount?: number; +} + +// @public +export interface ServerEndpointSyncStatus { + readonly backgroundDataDownloadActivity?: ServerEndpointBackgroundDataDownloadActivity; + readonly combinedHealth?: ServerEndpointHealthState; + readonly downloadActivity?: ServerEndpointSyncActivityStatus; + readonly downloadHealth?: ServerEndpointHealthState; + readonly downloadStatus?: ServerEndpointSyncSessionStatus; + readonly lastUpdatedTimestamp?: Date; + readonly offlineDataTransferStatus?: ServerEndpointOfflineDataTransferState; + readonly syncActivity?: ServerEndpointSyncActivityState; + readonly totalPersistentFilesNotSyncingCount?: number; + readonly uploadActivity?: ServerEndpointSyncActivityStatus; + readonly uploadHealth?: ServerEndpointHealthState; + readonly uploadStatus?: ServerEndpointSyncSessionStatus; +} + +// @public +export interface ServerEndpointUpdateParameters { + cloudTiering?: FeatureStatus; + localCacheMode?: LocalCacheMode; + offlineDataTransfer?: FeatureStatus; + offlineDataTransferShareName?: string; + tierFilesOlderThanDays?: number; + volumeFreeSpacePercent?: number; +} + +// @public +export interface StorageSyncApiError { + code?: string; + details?: StorageSyncErrorDetails; + innerError?: StorageSyncInnerErrorDetails; + message?: string; + target?: string; +} + +// @public +export interface StorageSyncError { + error?: StorageSyncApiError; + innererror?: StorageSyncApiError; +} + +// @public +export interface StorageSyncErrorDetails { + code?: string; + exceptionType?: string; + hashedMessage?: string; + httpErrorCode?: string; + httpMethod?: string; + message?: string; + requestUri?: string; + target?: string; +} + +// @public +export interface StorageSyncInnerErrorDetails { + callStack?: string; + innerException?: string; + innerExceptionCallStack?: string; + message?: string; +} + +// @public +export type StorageSyncService = TrackedResource & { + incomingTrafficPolicy?: IncomingTrafficPolicy; + readonly storageSyncServiceStatus?: number; + readonly storageSyncServiceUid?: string; + readonly provisioningState?: string; + readonly lastWorkflowId?: string; + readonly lastOperationName?: string; + readonly privateEndpointConnections?: PrivateEndpointConnection[]; +}; + +// @public +export interface StorageSyncServiceArray { + value?: StorageSyncService[]; +} + +// @public +export interface StorageSyncServiceCreateParameters { + incomingTrafficPolicy?: IncomingTrafficPolicy; + location: string; + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export interface StorageSyncServices { + beginCreate(resourceGroupName: string, storageSyncServiceName: string, parameters: StorageSyncServiceCreateParameters, options?: StorageSyncServicesCreateOptionalParams): Promise, StorageSyncServicesCreateResponse>>; + beginCreateAndWait(resourceGroupName: string, storageSyncServiceName: string, parameters: StorageSyncServiceCreateParameters, options?: StorageSyncServicesCreateOptionalParams): Promise; + beginDelete(resourceGroupName: string, storageSyncServiceName: string, options?: StorageSyncServicesDeleteOptionalParams): Promise, StorageSyncServicesDeleteResponse>>; + beginDeleteAndWait(resourceGroupName: string, storageSyncServiceName: string, options?: StorageSyncServicesDeleteOptionalParams): Promise; + beginUpdate(resourceGroupName: string, storageSyncServiceName: string, options?: StorageSyncServicesUpdateOptionalParams): Promise, StorageSyncServicesUpdateResponse>>; + beginUpdateAndWait(resourceGroupName: string, storageSyncServiceName: string, options?: StorageSyncServicesUpdateOptionalParams): Promise; + checkNameAvailability(locationName: string, parameters: CheckNameAvailabilityParameters, options?: StorageSyncServicesCheckNameAvailabilityOptionalParams): Promise; + get(resourceGroupName: string, storageSyncServiceName: string, options?: StorageSyncServicesGetOptionalParams): Promise; + listByResourceGroup(resourceGroupName: string, options?: StorageSyncServicesListByResourceGroupOptionalParams): PagedAsyncIterableIterator; + listBySubscription(options?: StorageSyncServicesListBySubscriptionOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface StorageSyncServicesCheckNameAvailabilityOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageSyncServicesCheckNameAvailabilityResponse = CheckNameAvailabilityResult; + +// @public +export interface StorageSyncServicesCreateHeaders { + azureAsyncOperation?: string; + location?: string; + retryAfter?: string; + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface StorageSyncServicesCreateOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type StorageSyncServicesCreateResponse = StorageSyncService; + +// @public +export interface StorageSyncServicesDeleteHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface StorageSyncServicesDeleteOptionalParams extends coreClient.OperationOptions { + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type StorageSyncServicesDeleteResponse = StorageSyncServicesDeleteHeaders; + +// @public +export interface StorageSyncServicesGetHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface StorageSyncServicesGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageSyncServicesGetResponse = StorageSyncServicesGetHeaders & StorageSyncService; + +// @public +export interface StorageSyncServicesListByResourceGroupHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface StorageSyncServicesListByResourceGroupOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageSyncServicesListByResourceGroupResponse = StorageSyncServicesListByResourceGroupHeaders & StorageSyncServiceArray; + +// @public +export interface StorageSyncServicesListBySubscriptionHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface StorageSyncServicesListBySubscriptionOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type StorageSyncServicesListBySubscriptionResponse = StorageSyncServicesListBySubscriptionHeaders & StorageSyncServiceArray; + +// @public +export interface StorageSyncServicesUpdateHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface StorageSyncServicesUpdateOptionalParams extends coreClient.OperationOptions { + parameters?: StorageSyncServiceUpdateParameters; + resumeFrom?: string; + updateIntervalInMs?: number; +} + +// @public +export type StorageSyncServicesUpdateResponse = StorageSyncServicesUpdateHeaders & StorageSyncService; + +// @public +export interface StorageSyncServiceUpdateParameters { + incomingTrafficPolicy?: IncomingTrafficPolicy; + tags?: { + [propertyName: string]: string; + }; +} + +// @public +export interface SubscriptionState { + readonly istransitioning?: boolean; + properties?: Record; + state?: Reason; +} + +// @public +export type SyncGroup = ProxyResource & { + readonly uniqueId?: string; + readonly syncGroupStatus?: string; +}; + +// @public +export interface SyncGroupArray { + value?: SyncGroup[]; +} + +// @public +export type SyncGroupCreateParameters = ProxyResource & { + properties?: Record; +}; + +// @public +export interface SyncGroups { + create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, parameters: SyncGroupCreateParameters, options?: SyncGroupsCreateOptionalParams): Promise; + delete(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: SyncGroupsDeleteOptionalParams): Promise; + get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: SyncGroupsGetOptionalParams): Promise; + listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options?: SyncGroupsListByStorageSyncServiceOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface SyncGroupsCreateHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface SyncGroupsCreateOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SyncGroupsCreateResponse = SyncGroupsCreateHeaders & SyncGroup; + +// @public +export interface SyncGroupsDeleteHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface SyncGroupsDeleteOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SyncGroupsDeleteResponse = SyncGroupsDeleteHeaders; + +// @public +export interface SyncGroupsGetHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface SyncGroupsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SyncGroupsGetResponse = SyncGroupsGetHeaders & SyncGroup; + +// @public +export interface SyncGroupsListByStorageSyncServiceHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface SyncGroupsListByStorageSyncServiceOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type SyncGroupsListByStorageSyncServiceResponse = SyncGroupsListByStorageSyncServiceHeaders & SyncGroupArray; + +// @public +export type TrackedResource = Resource & { + tags?: { + [propertyName: string]: string; + }; + location: string; +}; + +// @public +export interface TriggerChangeDetectionParameters { + changeDetectionMode?: ChangeDetectionMode; + directoryPath?: string; + paths?: string[]; +} + +// @public +export interface TriggerRolloverRequest { + serverCertificate?: string; +} + +// @public +export type Workflow = ProxyResource & { + lastStepName?: string; + status?: WorkflowStatus; + operation?: OperationDirection; + steps?: string; + lastOperationId?: string; + readonly commandName?: string; + readonly createdTimestamp?: Date; + readonly lastStatusTimestamp?: Date; +}; + +// @public +export interface WorkflowArray { + value?: Workflow[]; +} + +// @public +export interface Workflows { + abort(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options?: WorkflowsAbortOptionalParams): Promise; + get(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options?: WorkflowsGetOptionalParams): Promise; + listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options?: WorkflowsListByStorageSyncServiceOptionalParams): PagedAsyncIterableIterator; +} + +// @public +export interface WorkflowsAbortHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface WorkflowsAbortOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WorkflowsAbortResponse = WorkflowsAbortHeaders; + +// @public +export interface WorkflowsGetHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface WorkflowsGetOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WorkflowsGetResponse = WorkflowsGetHeaders & Workflow; + +// @public +export interface WorkflowsListByStorageSyncServiceHeaders { + xMsCorrelationRequestId?: string; + xMsRequestId?: string; +} + +// @public +export interface WorkflowsListByStorageSyncServiceOptionalParams extends coreClient.OperationOptions { +} + +// @public +export type WorkflowsListByStorageSyncServiceResponse = WorkflowsListByStorageSyncServiceHeaders & WorkflowArray; + +// @public +export type WorkflowStatus = string; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/sdk/storagesync/arm-storagesync/rollup.config.js b/sdk/storagesync/arm-storagesync/rollup.config.js index 11130dc93fb..9be1955eb7f 100644 --- a/sdk/storagesync/arm-storagesync/rollup.config.js +++ b/sdk/storagesync/arm-storagesync/rollup.config.js @@ -1,37 +1,188 @@ -import rollup from "rollup"; -import nodeResolve from "rollup-plugin-node-resolve"; -import sourcemaps from "rollup-plugin-sourcemaps"; - -/** - * @type {rollup.RollupFileOptions} - */ -const config = { - input: "./esm/storageSyncManagementClient.js", - external: [ - "@azure/ms-rest-js", - "@azure/ms-rest-azure-js" - ], - output: { - file: "./dist/arm-storagesync.js", - format: "umd", - name: "Azure.ArmStoragesync", - sourcemap: true, - globals: { - "@azure/ms-rest-js": "msRest", - "@azure/ms-rest-azure-js": "msRestAzure" - }, - banner: `/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */` - }, - plugins: [ - nodeResolve({ mainFields: ['module', 'main'] }), - sourcemaps() - ] + */ + +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"; + +/** + * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api. + * + * NOTE: this manual configuration is only needed because OpenTelemetry uses an + * __exportStar downleveled helper function to declare its exports which confuses + * rollup's automatic discovery mechanism. + * + * @returns an object reference that can be `...`'d into your cjs() configuration. + */ +export function openTelemetryCommonJs() { + const namedExports = {}; + + for (const key of [ + "@opentelemetry/api", + "@azure/core-tracing/node_modules/@opentelemetry/api" + ]) { + namedExports[key] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "SpanStatusCode", + "getSpanContext", + "setSpanContext" + ]; + } + + const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"]; + + for (const version of releasedOpenTelemetryVersions) { + namedExports[ + // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path. + `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js` + ] = [ + "SpanKind", + "TraceFlags", + "getSpan", + "setSpan", + "StatusCode", + "CanonicalCode", + "getSpanContext", + "setSpanContext" + ]; + } + + return namedExports; +} + +// #region Warning Handler + +/** + * A function that can determine whether a rollupwarning should be ignored. If + * the function returns `true`, then the warning will not be displayed. + */ + +function ignoreNiseSinonEvalWarnings(warning) { + return ( + warning.code === "EVAL" && + warning.id && + (warning.id.includes("node_modules/nise") || + warning.id.includes("node_modules/sinon")) === true + ); +} + +function ignoreChaiCircularDependencyWarnings(warning) { + return ( + warning.code === "CIRCULAR_DEPENDENCY" && + warning.importer && warning.importer.includes("node_modules/chai") === true + ); +} + +const warningInhibitors = [ + ignoreChaiCircularDependencyWarnings, + ignoreNiseSinonEvalWarnings +]; + +/** + * 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({ + namedExports: { + // Chai's strange internal architecture makes it impossible to statically + // analyze its exports. + chai: [ + "version", + "use", + "util", + "config", + "expect", + "should", + "assert" + ], + ...openTelemetryCommonJs() + } + }), + 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 default config; +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(), cjs()] + }; + + const config = [baseConfig]; + + if (!options.disableBrowserBundle) { + config.push(makeBrowserTestConfig()); + } + + return config; +} + +export default makeConfig(require("./package.json")); diff --git a/sdk/storagesync/arm-storagesync/sample.env b/sdk/storagesync/arm-storagesync/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/storagesync/arm-storagesync/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsCreate.ts b/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsCreate.ts new file mode 100644 index 00000000000..5df183c052b --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsCreate.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create a new CloudEndpoint. + * + * @summary Create a new CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_Create.json + */ +import { + CloudEndpointCreateParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cloudEndpointsCreate() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const parameters: CloudEndpointCreateParameters = { + azureFileShareName: + "cvcloud-afscv-0719-058-a94a1354-a1fd-4e9a-9a50-919fad8c4ba4", + friendlyName: "ankushbsubscriptionmgmtmab", + storageAccountResourceId: + "/subscriptions/744f4d70-6d17-4921-8970-a765d14f763f/resourceGroups/tminienv59svc/providers/Microsoft.Storage/storageAccounts/tminienv59storage", + storageAccountTenantId: '"72f988bf-86f1-41af-91ab-2d7cd011db47"' + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.beginCreateAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters + ); + console.log(result); +} + +cloudEndpointsCreate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsDelete.ts b/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsDelete.ts new file mode 100644 index 00000000000..21582c8c1a9 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsDelete.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Delete a given CloudEndpoint. + * + * @summary Delete a given CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_Delete.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cloudEndpointsDelete() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.beginDeleteAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName + ); + console.log(result); +} + +cloudEndpointsDelete().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsGet.ts b/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsGet.ts new file mode 100644 index 00000000000..7b6d15570f6 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsGet.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a given CloudEndpoint. + * + * @summary Get a given CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_Get.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cloudEndpointsGet() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.get( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName + ); + console.log(result); +} + +cloudEndpointsGet().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsListBySyncGroup.ts b/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsListBySyncGroup.ts new file mode 100644 index 00000000000..5bd7ef9dbb2 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsListBySyncGroup.ts @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a CloudEndpoint List. + * + * @summary Get a CloudEndpoint List. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_ListBySyncGroup.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cloudEndpointsListBySyncGroup() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.cloudEndpoints.listBySyncGroup( + resourceGroupName, + storageSyncServiceName, + syncGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +cloudEndpointsListBySyncGroup().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsPostBackup.ts b/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsPostBackup.ts new file mode 100644 index 00000000000..0d49792e1fa --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsPostBackup.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Post Backup a given CloudEndpoint. + * + * @summary Post Backup a given CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PostBackup.json + */ +import { BackupRequest, MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cloudEndpointsPostBackup() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const parameters: BackupRequest = { + azureFileShare: + "https://sampleserver.file.core.test-cint.azure-test.net/sampleFileShare" + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.beginPostBackupAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters + ); + console.log(result); +} + +cloudEndpointsPostBackup().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsPostRestore.ts b/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsPostRestore.ts new file mode 100644 index 00000000000..7625e1493db --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsPostRestore.ts @@ -0,0 +1,54 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Post Restore a given CloudEndpoint. + * + * @summary Post Restore a given CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PostRestore.json + */ +import { + PostRestoreRequest, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cloudEndpointsPostRestore() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const parameters: PostRestoreRequest = { + azureFileShareUri: + "https://hfsazbackupdevintncus2.file.core.test-cint.azure-test.net/sampleFileShare", + restoreFileSpec: [ + { path: "text1.txt", isdir: false }, + { path: "MyDir", isdir: true }, + { path: "MyDir/SubDir", isdir: false }, + { path: "MyDir/SubDir/File1.pdf", isdir: false } + ], + sourceAzureFileShareUri: + "https://hfsazbackupdevintncus2.file.core.test-cint.azure-test.net/sampleFileShare", + status: "Succeeded" + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.beginPostRestoreAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters + ); + console.log(result); +} + +cloudEndpointsPostRestore().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsPreBackup.ts b/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsPreBackup.ts new file mode 100644 index 00000000000..78c7c720ae0 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsPreBackup.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Pre Backup a given CloudEndpoint. + * + * @summary Pre Backup a given CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PreBackup.json + */ +import { BackupRequest, MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cloudEndpointsPreBackup() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const parameters: BackupRequest = { + azureFileShare: + "https://sampleserver.file.core.test-cint.azure-test.net/sampleFileShare" + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.beginPreBackupAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters + ); + console.log(result); +} + +cloudEndpointsPreBackup().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsPreRestore.ts b/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsPreRestore.ts new file mode 100644 index 00000000000..34ba73127d7 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsPreRestore.ts @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Pre Restore a given CloudEndpoint. + * + * @summary Pre Restore a given CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PreRestore.json + */ +import { + PreRestoreRequest, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cloudEndpointsPreRestore() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const parameters: PreRestoreRequest = { + azureFileShareUri: + "https://hfsazbackupdevintncus2.file.core.test-cint.azure-test.net/sampleFileShare", + restoreFileSpec: [ + { path: "text1.txt", isdir: false }, + { path: "MyDir", isdir: true }, + { path: "MyDir/SubDir", isdir: false }, + { path: "MyDir/SubDir/File1.pdf", isdir: false } + ] + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.beginPreRestoreAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters + ); + console.log(result); +} + +cloudEndpointsPreRestore().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsRestoreheartbeat.ts b/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsRestoreheartbeat.ts new file mode 100644 index 00000000000..3cd2984bd1a --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsRestoreheartbeat.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Restore Heartbeat a given CloudEndpoint. + * + * @summary Restore Heartbeat a given CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_RestoreHeatbeat.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cloudEndpointsRestoreheartbeat() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.restoreheartbeat( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName + ); + console.log(result); +} + +cloudEndpointsRestoreheartbeat().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsTriggerChangeDetection.ts b/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsTriggerChangeDetection.ts new file mode 100644 index 00000000000..f5bb788d048 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/cloudEndpointsTriggerChangeDetection.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Triggers detection of changes performed on Azure File share connected to the specified Azure File Sync Cloud Endpoint. + * + * @summary Triggers detection of changes performed on Azure File share connected to the specified Azure File Sync Cloud Endpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_TriggerChangeDetection.json + */ +import { + TriggerChangeDetectionParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cloudEndpointsTriggerChangeDetection() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const parameters: TriggerChangeDetectionParameters = { + changeDetectionMode: "Recursive", + directoryPath: "NewDirectory" + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.beginTriggerChangeDetectionAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters + ); + console.log(result); +} + +cloudEndpointsTriggerChangeDetection().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/operationsList.ts b/sdk/storagesync/arm-storagesync/samples-dev/operationsList.ts new file mode 100644 index 00000000000..ee18429dc8c --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/operationsList.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Lists all of the available Storage Sync Rest API operations. + * + * @summary Lists all of the available Storage Sync Rest API operations. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/Operations_List.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function operationsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +operationsList().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/privateEndpointConnectionsCreate.ts b/sdk/storagesync/arm-storagesync/samples-dev/privateEndpointConnectionsCreate.ts new file mode 100644 index 00000000000..6fd603f1339 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/privateEndpointConnectionsCreate.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Update the state of specified private endpoint connection associated with the storage sync service. + * + * @summary Update the state of specified private endpoint connection associated with the storage sync service. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_Create.json + */ +import { + PrivateEndpointConnection, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function privateEndpointConnectionsCreate() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const storageSyncServiceName = "sss2527"; + const privateEndpointConnectionName = "{privateEndpointConnectionName}"; + const properties: PrivateEndpointConnection = { + privateLinkServiceConnectionState: { + description: "Auto-Approved", + status: "Approved" + } + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.privateEndpointConnections.beginCreateAndWait( + resourceGroupName, + storageSyncServiceName, + privateEndpointConnectionName, + properties + ); + console.log(result); +} + +privateEndpointConnectionsCreate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/privateEndpointConnectionsDelete.ts b/sdk/storagesync/arm-storagesync/samples-dev/privateEndpointConnectionsDelete.ts new file mode 100644 index 00000000000..ba8ac4c71a1 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/privateEndpointConnectionsDelete.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Deletes the specified private endpoint connection associated with the storage sync service. + * + * @summary Deletes the specified private endpoint connection associated with the storage sync service. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_Delete.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function privateEndpointConnectionsDelete() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const storageSyncServiceName = "sss2527"; + const privateEndpointConnectionName = "{privateEndpointConnectionName}"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.privateEndpointConnections.beginDeleteAndWait( + resourceGroupName, + storageSyncServiceName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionsDelete().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/privateEndpointConnectionsGet.ts b/sdk/storagesync/arm-storagesync/samples-dev/privateEndpointConnectionsGet.ts new file mode 100644 index 00000000000..20f2a900e95 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/privateEndpointConnectionsGet.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets the specified private endpoint connection associated with the storage sync service. + * + * @summary Gets the specified private endpoint connection associated with the storage sync service. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_Get.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function privateEndpointConnectionsGet() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const storageSyncServiceName = "sss2527"; + const privateEndpointConnectionName = "{privateEndpointConnectionName}"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.privateEndpointConnections.get( + resourceGroupName, + storageSyncServiceName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionsGet().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/privateEndpointConnectionsListByStorageSyncService.ts b/sdk/storagesync/arm-storagesync/samples-dev/privateEndpointConnectionsListByStorageSyncService.ts new file mode 100644 index 00000000000..aef5703b610 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/privateEndpointConnectionsListByStorageSyncService.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a PrivateEndpointConnection List. + * + * @summary Get a PrivateEndpointConnection List. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_ListByStorageSyncService.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function privateEndpointConnectionsListByStorageSyncService() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const storageSyncServiceName = "sss2527"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateEndpointConnections.listByStorageSyncService( + resourceGroupName, + storageSyncServiceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +privateEndpointConnectionsListByStorageSyncService().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/privateLinkResourcesList.ts b/sdk/storagesync/arm-storagesync/samples-dev/privateLinkResourcesList.ts new file mode 100644 index 00000000000..735fda0124c --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/privateLinkResourcesList.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets the private link resources that need to be created for a storage sync service. + * + * @summary Gets the private link resources that need to be created for a storage sync service. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateLinkResources_List.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function privateLinkResourcesList() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const storageSyncServiceName = "sss2527"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.privateLinkResources.listByStorageSyncService( + resourceGroupName, + storageSyncServiceName + ); + console.log(result); +} + +privateLinkResourcesList().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/registeredServersCreate.ts b/sdk/storagesync/arm-storagesync/samples-dev/registeredServersCreate.ts new file mode 100644 index 00000000000..e7b58b7d573 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/registeredServersCreate.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Add a new registered server. + * + * @summary Add a new registered server. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_Create.json + */ +import { + RegisteredServerCreateParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function registeredServersCreate() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const serverId = "080d4133-bdb5-40a0-96a0-71a6057bfe9a"; + const parameters: RegisteredServerCreateParameters = { + agentVersion: "1.0.277.0", + friendlyName: "afscv-2304-139", + serverCertificate: + "MIIDFjCCAf6gAwIBAgIQQS+DS8uhc4VNzUkTw7wbRjANBgkqhkiG9w0BAQ0FADAzMTEwLwYDVQQDEyhhbmt1c2hiLXByb2QzLnJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29tMB4XDTE3MDgwMzE3MDQyNFoXDTE4MDgwNDE3MDQyNFowMzExMC8GA1UEAxMoYW5rdXNoYi1wcm9kMy5yZWRtb25kLmNvcnAubWljcm9zb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALDRvV4gmsIy6jGDPiHsXmvgVP749NNP7DopdlbHaNhjFmYINHl0uWylyaZmgJrROt2mnxN/zEyJtGnqYHlzUr4xvGq/qV5pqgdB9tag/sw9i22gfe9PRZ0FmSOZnXMbLYgLiDFqLtut5gHcOuWMj03YnkfoBEKlFBxWbagvW2yxz/Sxi9OVSJOKCaXra0RpcIHrO/KFl6ho2eE1/7Ykmfa8hZvSdoPd5gHdLiQcMB/pxq+mWp1fI6c8vFZoDu7Atn+NXTzYPKUxKzaisF12TsaKpohUsJpbB3Wocb0F5frn614D2pg14ERB5otjAMWw1m65csQWPI6dP8KIYe0+QPkCAwEAAaMmMCQwIgYDVR0lAQH/BBgwFgYIKwYBBQUHAwIGCisGAQQBgjcKAwwwDQYJKoZIhvcNAQENBQADggEBAA4RhVIBkw34M1RwakJgHvtjsOFxF1tVQA941NtLokx1l2Z8+GFQkcG4xpZSt+UN6wLerdCbnNhtkCErWUDeaT0jxk4g71Ofex7iM04crT4iHJr8mi96/XnhnkTUs+GDk12VgdeeNEczMZz+8Mxw9dJ5NCnYgTwO0SzGlclRsDvjzkLo8rh2ZG6n/jKrEyNXXo+hOqhupij0QbRP2Tvexdfw201kgN1jdZify8XzJ8Oi0bTS0KpJf2pNPOlooK2bjMUei9ANtEdXwwfVZGWvVh6tJjdv6k14wWWJ1L7zhA1IIVb1J+sQUzJji5iX0DrezjTz1Fg+gAzITaA/WsuujlM=", + serverId: "080d4133-bdb5-40a0-96a0-71a6057bfe9a", + serverOSVersion: "10.0.14393.0", + serverRole: "Standalone" + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.registeredServers.beginCreateAndWait( + resourceGroupName, + storageSyncServiceName, + serverId, + parameters + ); + console.log(result); +} + +registeredServersCreate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/registeredServersDelete.ts b/sdk/storagesync/arm-storagesync/samples-dev/registeredServersDelete.ts new file mode 100644 index 00000000000..2bac1a0b56e --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/registeredServersDelete.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Delete the given registered server. + * + * @summary Delete the given registered server. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_Delete.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function registeredServersDelete() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const serverId = "41166691-ab03-43e9-ab3e-0330eda162ac"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.registeredServers.beginDeleteAndWait( + resourceGroupName, + storageSyncServiceName, + serverId + ); + console.log(result); +} + +registeredServersDelete().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/registeredServersGet.ts b/sdk/storagesync/arm-storagesync/samples-dev/registeredServersGet.ts new file mode 100644 index 00000000000..9bd199db1cc --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/registeredServersGet.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a given registered server. + * + * @summary Get a given registered server. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_Get.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function registeredServersGet() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const serverId = "080d4133-bdb5-40a0-96a0-71a6057bfe9a"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.registeredServers.get( + resourceGroupName, + storageSyncServiceName, + serverId + ); + console.log(result); +} + +registeredServersGet().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/registeredServersListByStorageSyncService.ts b/sdk/storagesync/arm-storagesync/samples-dev/registeredServersListByStorageSyncService.ts new file mode 100644 index 00000000000..389b865540d --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/registeredServersListByStorageSyncService.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a given registered server list. + * + * @summary Get a given registered server list. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_ListByStorageSyncService.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function registeredServersListByStorageSyncService() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.registeredServers.listByStorageSyncService( + resourceGroupName, + storageSyncServiceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +registeredServersListByStorageSyncService().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/registeredServersTriggerRollover.ts b/sdk/storagesync/arm-storagesync/samples-dev/registeredServersTriggerRollover.ts new file mode 100644 index 00000000000..a88270a38a7 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/registeredServersTriggerRollover.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Triggers Server certificate rollover. + * + * @summary Triggers Server certificate rollover. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_TriggerRollover.json + */ +import { + TriggerRolloverRequest, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function registeredServersTriggerRollover() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const serverId = "d166ca76-dad2-49df-b409-12345642d730"; + const parameters: TriggerRolloverRequest = { + serverCertificate: + '"MIIDFjCCAf6gAwIBAgIQQS+DS8uhc4VNzUkTw7wbRjANBgkqhkiG9w0BAQ0FADAzMTEwLwYDVQQDEyhhbmt1c2hiLXByb2QzLnJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29tMB4XDTE3MDgwMzE3MDQyNFoXDTE4MDgwNDE3MDQyNFowMzExMC8GA1UEAxMoYW5rdXNoYi1wcm9kMy5yZWRtb25kLmNvcnAubWljcm9zb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALDRvV4gmsIy6jGDPiHsXmvgVP749NNP7DopdlbHaNhjFmYINHl0uWylyaZmgJrROt2mnxN/zEyJtGnqYHlzUr4xvGq/qV5pqgdB9tag/sw9i22gfe9PRZ0FmSOZnXMbLYgLiDFqLtut5gHcOuWMj03YnkfoBEKlFBxWbagvW2yxz/Sxi9OVSJOKCaXra0RpcIHrO/KFl6ho2eE1/7Ykmfa8hZvSdoPd5gHdLiQcMB/pxq+mWp1fI6c8vFZoDu7Atn+NXTzYPKUxKzaisF12TsaKpohUsJpbB3Wocb0F5frn614D2pg14ERB5otjAMWw1m65csQWPI6dP8KIYe0+QPkCAwEAAaMmMCQwIgYDVR0lAQH/BBgwFgYIKwYBBQUHAwIGCisGAQQBgjcKAwwwDQYJKoZIhvcNAQENBQADggEBAA4RhVIBkw34M1RwakJgHvtjsOFxF1tVQA941NtLokx1l2Z8+GFQkcG4xpZSt+UN6wLerdCbnNhtkCErWUDeaT0jxk4g71Ofex7iM04crT4iHJr8mi96/XnhnkTUs+GDk12VgdeeNEczMZz+8Mxw9dJ5NCnYgTwO0SzGlclRsDvjzkLo8rh2ZG6n/jKrEyNXXo+hOqhupij0QbRP2Tvexdfw201kgN1jdZify8XzJ8Oi0bTS0KpJf2pNPOlooK2bjMUei9ANtEdXwwfVZGWvVh6tJjdv6k14wWWJ1L7zhA1IIVb1J+sQUzJji5iX0DrezjTz1Fg+gAzITaA/WsuujlM="' + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.registeredServers.beginTriggerRolloverAndWait( + resourceGroupName, + storageSyncServiceName, + serverId, + parameters + ); + console.log(result); +} + +registeredServersTriggerRollover().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsCreate.ts b/sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsCreate.ts new file mode 100644 index 00000000000..b837260d78f --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsCreate.ts @@ -0,0 +1,54 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create a new ServerEndpoint. + * + * @summary Create a new ServerEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Create.json + */ +import { + ServerEndpointCreateParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function serverEndpointsCreate() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const serverEndpointName = "SampleServerEndpoint_1"; + const parameters: ServerEndpointCreateParameters = { + cloudTiering: "off", + initialDownloadPolicy: "NamespaceThenModifiedFiles", + initialUploadPolicy: "ServerAuthoritative", + localCacheMode: "UpdateLocallyCachedFiles", + offlineDataTransfer: "on", + offlineDataTransferShareName: "myfileshare", + serverLocalPath: "D:SampleServerEndpoint_1", + serverResourceId: + "/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/registeredServers/080d4133-bdb5-40a0-96a0-71a6057bfe9a", + tierFilesOlderThanDays: 0, + volumeFreeSpacePercent: 100 + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.serverEndpoints.beginCreateAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName, + parameters + ); + console.log(result); +} + +serverEndpointsCreate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsDelete.ts b/sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsDelete.ts new file mode 100644 index 00000000000..2aa8df65bbb --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsDelete.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Delete a given ServerEndpoint. + * + * @summary Delete a given ServerEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Delete.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function serverEndpointsDelete() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const serverEndpointName = "SampleServerEndpoint_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.serverEndpoints.beginDeleteAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName + ); + console.log(result); +} + +serverEndpointsDelete().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsGet.ts b/sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsGet.ts new file mode 100644 index 00000000000..5d7ba180c2f --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsGet.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a ServerEndpoint. + * + * @summary Get a ServerEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Get.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function serverEndpointsGet() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const serverEndpointName = "SampleServerEndpoint_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.serverEndpoints.get( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName + ); + console.log(result); +} + +serverEndpointsGet().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsListBySyncGroup.ts b/sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsListBySyncGroup.ts new file mode 100644 index 00000000000..bee400e2421 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsListBySyncGroup.ts @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a ServerEndpoint list. + * + * @summary Get a ServerEndpoint list. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_ListBySyncGroup.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function serverEndpointsListBySyncGroup() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.serverEndpoints.listBySyncGroup( + resourceGroupName, + storageSyncServiceName, + syncGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +serverEndpointsListBySyncGroup().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsRecallAction.ts b/sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsRecallAction.ts new file mode 100644 index 00000000000..0450434cb45 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsRecallAction.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Recall a server endpoint. + * + * @summary Recall a server endpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Recall.json + */ +import { + RecallActionParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function serverEndpointsRecallAction() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const serverEndpointName = "SampleServerEndpoint_1"; + const parameters: RecallActionParameters = { pattern: "", recallPath: "" }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.serverEndpoints.beginRecallActionAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName, + parameters + ); + console.log(result); +} + +serverEndpointsRecallAction().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsUpdate.ts b/sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsUpdate.ts new file mode 100644 index 00000000000..a8f56fae86d --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/serverEndpointsUpdate.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Patch a given ServerEndpoint. + * + * @summary Patch a given ServerEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Update.json + */ +import { + ServerEndpointUpdateParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function serverEndpointsUpdate() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const serverEndpointName = "SampleServerEndpoint_1"; + const parameters: ServerEndpointUpdateParameters = { + cloudTiering: "off", + localCacheMode: "UpdateLocallyCachedFiles", + offlineDataTransfer: "off", + tierFilesOlderThanDays: 0, + volumeFreeSpacePercent: 100 + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.serverEndpoints.beginUpdateAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName, + options + ); + console.log(result); +} + +serverEndpointsUpdate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServiceCheckNameAvailabilityAlreadyExists.ts b/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServiceCheckNameAvailabilityAlreadyExists.ts new file mode 100644 index 00000000000..c0d880381ea --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServiceCheckNameAvailabilityAlreadyExists.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Check the give namespace name availability. + * + * @summary Check the give namespace name availability. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServiceCheckNameAvailability_AlreadyExists.json + */ +import { + CheckNameAvailabilityParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageSyncServiceCheckNameAvailabilityAlreadyExists() { + const subscriptionId = "5c6bc8e1-1eaf-4192-94d8-58ce463ac86c"; + const locationName = "westus"; + const parameters: CheckNameAvailabilityParameters = { + name: "newstoragesyncservicename", + type: "Microsoft.StorageSync/storageSyncServices" + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.storageSyncServices.checkNameAvailability( + locationName, + parameters + ); + console.log(result); +} + +storageSyncServiceCheckNameAvailabilityAlreadyExists().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServiceCheckNameAvailabilityAvailable.ts b/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServiceCheckNameAvailabilityAvailable.ts new file mode 100644 index 00000000000..f5db1e22dde --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServiceCheckNameAvailabilityAvailable.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Check the give namespace name availability. + * + * @summary Check the give namespace name availability. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServiceCheckNameAvailability_Available.json + */ +import { + CheckNameAvailabilityParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageSyncServiceCheckNameAvailabilityAvailable() { + const subscriptionId = "5c6bc8e1-1eaf-4192-94d8-58ce463ac86c"; + const locationName = "westus"; + const parameters: CheckNameAvailabilityParameters = { + name: "newstoragesyncservicename", + type: "Microsoft.StorageSync/storageSyncServices" + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.storageSyncServices.checkNameAvailability( + locationName, + parameters + ); + console.log(result); +} + +storageSyncServiceCheckNameAvailabilityAvailable().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesCreate.ts b/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesCreate.ts new file mode 100644 index 00000000000..50e30bbddfb --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesCreate.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create a new StorageSyncService. + * + * @summary Create a new StorageSyncService. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Create.json + */ +import { + StorageSyncServiceCreateParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageSyncServicesCreate() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const parameters: StorageSyncServiceCreateParameters = { + incomingTrafficPolicy: "AllowAllTraffic", + location: "WestUS", + tags: {} + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.storageSyncServices.beginCreateAndWait( + resourceGroupName, + storageSyncServiceName, + parameters + ); + console.log(result); +} + +storageSyncServicesCreate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesDelete.ts b/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesDelete.ts new file mode 100644 index 00000000000..bed48d4cf78 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesDelete.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Delete a given StorageSyncService. + * + * @summary Delete a given StorageSyncService. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Delete.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageSyncServicesDelete() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.storageSyncServices.beginDeleteAndWait( + resourceGroupName, + storageSyncServiceName + ); + console.log(result); +} + +storageSyncServicesDelete().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesGet.ts b/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesGet.ts new file mode 100644 index 00000000000..6d67097b800 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesGet.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a given StorageSyncService. + * + * @summary Get a given StorageSyncService. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Get.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageSyncServicesGet() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.storageSyncServices.get( + resourceGroupName, + storageSyncServiceName + ); + console.log(result); +} + +storageSyncServicesGet().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesListByResourceGroup.ts b/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesListByResourceGroup.ts new file mode 100644 index 00000000000..422f6d5e3c7 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesListByResourceGroup.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a StorageSyncService list by Resource group name. + * + * @summary Get a StorageSyncService list by Resource group name. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_ListByResourceGroup.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageSyncServicesListByResourceGroup() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageSyncServices.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +storageSyncServicesListByResourceGroup().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesListBySubscription.ts b/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesListBySubscription.ts new file mode 100644 index 00000000000..7ed699587bf --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesListBySubscription.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a StorageSyncService list by subscription. + * + * @summary Get a StorageSyncService list by subscription. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_ListBySubscription.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageSyncServicesListBySubscription() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageSyncServices.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +storageSyncServicesListBySubscription().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesUpdate.ts b/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesUpdate.ts new file mode 100644 index 00000000000..63c7c6902d2 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/storageSyncServicesUpdate.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Patch a given StorageSyncService. + * + * @summary Patch a given StorageSyncService. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Update.json + */ +import { + StorageSyncServiceUpdateParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageSyncServicesUpdate() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const parameters: StorageSyncServiceUpdateParameters = { + incomingTrafficPolicy: "AllowAllTraffic", + tags: { dept: "IT", environment: "Test" } + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.storageSyncServices.beginUpdateAndWait( + resourceGroupName, + storageSyncServiceName, + options + ); + console.log(result); +} + +storageSyncServicesUpdate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/syncGroupsCreate.ts b/sdk/storagesync/arm-storagesync/samples-dev/syncGroupsCreate.ts new file mode 100644 index 00000000000..aa219fc2f39 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/syncGroupsCreate.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create a new SyncGroup. + * + * @summary Create a new SyncGroup. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_Create.json + */ +import { + SyncGroupCreateParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function syncGroupsCreate() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const parameters: SyncGroupCreateParameters = { properties: {} }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.syncGroups.create( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + parameters + ); + console.log(result); +} + +syncGroupsCreate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/syncGroupsDelete.ts b/sdk/storagesync/arm-storagesync/samples-dev/syncGroupsDelete.ts new file mode 100644 index 00000000000..3c0a1e06b4b --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/syncGroupsDelete.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Delete a given SyncGroup. + * + * @summary Delete a given SyncGroup. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_Delete.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function syncGroupsDelete() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.syncGroups.delete( + resourceGroupName, + storageSyncServiceName, + syncGroupName + ); + console.log(result); +} + +syncGroupsDelete().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/syncGroupsGet.ts b/sdk/storagesync/arm-storagesync/samples-dev/syncGroupsGet.ts new file mode 100644 index 00000000000..9e93fb1468d --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/syncGroupsGet.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a given SyncGroup. + * + * @summary Get a given SyncGroup. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_Get.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function syncGroupsGet() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.syncGroups.get( + resourceGroupName, + storageSyncServiceName, + syncGroupName + ); + console.log(result); +} + +syncGroupsGet().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/syncGroupsListByStorageSyncService.ts b/sdk/storagesync/arm-storagesync/samples-dev/syncGroupsListByStorageSyncService.ts new file mode 100644 index 00000000000..d44c5cc8781 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/syncGroupsListByStorageSyncService.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a SyncGroup List. + * + * @summary Get a SyncGroup List. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_ListByStorageSyncService.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function syncGroupsListByStorageSyncService() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.syncGroups.listByStorageSyncService( + resourceGroupName, + storageSyncServiceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +syncGroupsListByStorageSyncService().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/workflowsAbort.ts b/sdk/storagesync/arm-storagesync/samples-dev/workflowsAbort.ts new file mode 100644 index 00000000000..374b3c1d9d7 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/workflowsAbort.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Abort the given workflow. + * + * @summary Abort the given workflow. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/Workflows_Abort.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function workflowsAbort() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const workflowId = "7ffd50b3-5574-478d-9ff2-9371bc42ce68"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.workflows.abort( + resourceGroupName, + storageSyncServiceName, + workflowId + ); + console.log(result); +} + +workflowsAbort().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/workflowsGet.ts b/sdk/storagesync/arm-storagesync/samples-dev/workflowsGet.ts new file mode 100644 index 00000000000..6cee5e64de3 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/workflowsGet.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get Operation status + * + * @summary Get Operation status + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/LocationOperationStatus_Get.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function workflowsGet() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const locationName = "westus"; + const operationId = + "eyJwYXJ0aXRpb25JZCI6ImE1ZDNiMDU4LTYwN2MtNDI0Ny05Y2FmLWJlZmU4NGQ0ZDU0NyIsIndvcmtmbG93SWQiOiJjYzg1MTY2YS0xMjI2LTQ4MGYtYWM5ZC1jMmRhNTVmY2M2ODYiLCJ3b3JrZmxvd09wZXJhdGlvbklkIjoiOTdmODU5ZTAtOGY1MC00ZTg4LWJkZDEtNWZlYzgwYTVlYzM0tui="; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.locationOperationStatus( + locationName, + operationId + ); + console.log(result); +} + +workflowsGet().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples-dev/workflowsListByStorageSyncService.ts b/sdk/storagesync/arm-storagesync/samples-dev/workflowsListByStorageSyncService.ts new file mode 100644 index 00000000000..8e750cf9b46 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples-dev/workflowsListByStorageSyncService.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a Workflow List + * + * @summary Get a Workflow List + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/Workflows_ListByStorageSyncService.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function workflowsListByStorageSyncService() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.workflows.listByStorageSyncService( + resourceGroupName, + storageSyncServiceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +workflowsListByStorageSyncService().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/README.md b/sdk/storagesync/arm-storagesync/samples/v9/javascript/README.md new file mode 100644 index 00000000000..44c27242259 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/README.md @@ -0,0 +1,132 @@ +# client library samples for JavaScript + +These sample programs show how to use the JavaScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [cloudEndpointsCreate.js][cloudendpointscreate] | Create a new CloudEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_Create.json | +| [cloudEndpointsDelete.js][cloudendpointsdelete] | Delete a given CloudEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_Delete.json | +| [cloudEndpointsGet.js][cloudendpointsget] | Get a given CloudEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_Get.json | +| [cloudEndpointsListBySyncGroup.js][cloudendpointslistbysyncgroup] | Get a CloudEndpoint List. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_ListBySyncGroup.json | +| [cloudEndpointsPostBackup.js][cloudendpointspostbackup] | Post Backup a given CloudEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PostBackup.json | +| [cloudEndpointsPostRestore.js][cloudendpointspostrestore] | Post Restore a given CloudEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PostRestore.json | +| [cloudEndpointsPreBackup.js][cloudendpointsprebackup] | Pre Backup a given CloudEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PreBackup.json | +| [cloudEndpointsPreRestore.js][cloudendpointsprerestore] | Pre Restore a given CloudEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PreRestore.json | +| [cloudEndpointsRestoreheartbeat.js][cloudendpointsrestoreheartbeat] | Restore Heartbeat a given CloudEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_RestoreHeatbeat.json | +| [cloudEndpointsTriggerChangeDetection.js][cloudendpointstriggerchangedetection] | Triggers detection of changes performed on Azure File share connected to the specified Azure File Sync Cloud Endpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_TriggerChangeDetection.json | +| [operationsList.js][operationslist] | Lists all of the available Storage Sync Rest API operations. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/Operations_List.json | +| [privateEndpointConnectionsCreate.js][privateendpointconnectionscreate] | Update the state of specified private endpoint connection associated with the storage sync service. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_Create.json | +| [privateEndpointConnectionsDelete.js][privateendpointconnectionsdelete] | Deletes the specified private endpoint connection associated with the storage sync service. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_Delete.json | +| [privateEndpointConnectionsGet.js][privateendpointconnectionsget] | Gets the specified private endpoint connection associated with the storage sync service. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_Get.json | +| [privateEndpointConnectionsListByStorageSyncService.js][privateendpointconnectionslistbystoragesyncservice] | Get a PrivateEndpointConnection List. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_ListByStorageSyncService.json | +| [privateLinkResourcesList.js][privatelinkresourceslist] | Gets the private link resources that need to be created for a storage sync service. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateLinkResources_List.json | +| [registeredServersCreate.js][registeredserverscreate] | Add a new registered server. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_Create.json | +| [registeredServersDelete.js][registeredserversdelete] | Delete the given registered server. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_Delete.json | +| [registeredServersGet.js][registeredserversget] | Get a given registered server. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_Get.json | +| [registeredServersListByStorageSyncService.js][registeredserverslistbystoragesyncservice] | Get a given registered server list. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_ListByStorageSyncService.json | +| [registeredServersTriggerRollover.js][registeredserverstriggerrollover] | Triggers Server certificate rollover. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_TriggerRollover.json | +| [serverEndpointsCreate.js][serverendpointscreate] | Create a new ServerEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Create.json | +| [serverEndpointsDelete.js][serverendpointsdelete] | Delete a given ServerEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Delete.json | +| [serverEndpointsGet.js][serverendpointsget] | Get a ServerEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Get.json | +| [serverEndpointsListBySyncGroup.js][serverendpointslistbysyncgroup] | Get a ServerEndpoint list. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_ListBySyncGroup.json | +| [serverEndpointsRecallAction.js][serverendpointsrecallaction] | Recall a server endpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Recall.json | +| [serverEndpointsUpdate.js][serverendpointsupdate] | Patch a given ServerEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Update.json | +| [storageSyncServiceCheckNameAvailabilityAlreadyExists.js][storagesyncservicechecknameavailabilityalreadyexists] | Check the give namespace name availability. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServiceCheckNameAvailability_AlreadyExists.json | +| [storageSyncServiceCheckNameAvailabilityAvailable.js][storagesyncservicechecknameavailabilityavailable] | Check the give namespace name availability. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServiceCheckNameAvailability_Available.json | +| [storageSyncServicesCreate.js][storagesyncservicescreate] | Create a new StorageSyncService. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Create.json | +| [storageSyncServicesDelete.js][storagesyncservicesdelete] | Delete a given StorageSyncService. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Delete.json | +| [storageSyncServicesGet.js][storagesyncservicesget] | Get a given StorageSyncService. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Get.json | +| [storageSyncServicesListByResourceGroup.js][storagesyncserviceslistbyresourcegroup] | Get a StorageSyncService list by Resource group name. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_ListByResourceGroup.json | +| [storageSyncServicesListBySubscription.js][storagesyncserviceslistbysubscription] | Get a StorageSyncService list by subscription. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_ListBySubscription.json | +| [storageSyncServicesUpdate.js][storagesyncservicesupdate] | Patch a given StorageSyncService. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Update.json | +| [syncGroupsCreate.js][syncgroupscreate] | Create a new SyncGroup. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_Create.json | +| [syncGroupsDelete.js][syncgroupsdelete] | Delete a given SyncGroup. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_Delete.json | +| [syncGroupsGet.js][syncgroupsget] | Get a given SyncGroup. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_Get.json | +| [syncGroupsListByStorageSyncService.js][syncgroupslistbystoragesyncservice] | Get a SyncGroup List. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_ListByStorageSyncService.json | +| [workflowsAbort.js][workflowsabort] | Abort the given workflow. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/Workflows_Abort.json | +| [workflowsGet.js][workflowsget] | Get Operation status x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/LocationOperationStatus_Get.json | +| [workflowsListByStorageSyncService.js][workflowslistbystoragesyncservice] | Get a Workflow List x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/Workflows_ListByStorageSyncService.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +3. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node cloudEndpointsCreate.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node cloudEndpointsCreate.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[cloudendpointscreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsCreate.js +[cloudendpointsdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsDelete.js +[cloudendpointsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsGet.js +[cloudendpointslistbysyncgroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsListBySyncGroup.js +[cloudendpointspostbackup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsPostBackup.js +[cloudendpointspostrestore]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsPostRestore.js +[cloudendpointsprebackup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsPreBackup.js +[cloudendpointsprerestore]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsPreRestore.js +[cloudendpointsrestoreheartbeat]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsRestoreheartbeat.js +[cloudendpointstriggerchangedetection]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsTriggerChangeDetection.js +[operationslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/operationsList.js +[privateendpointconnectionscreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/privateEndpointConnectionsCreate.js +[privateendpointconnectionsdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/privateEndpointConnectionsDelete.js +[privateendpointconnectionsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/privateEndpointConnectionsGet.js +[privateendpointconnectionslistbystoragesyncservice]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/privateEndpointConnectionsListByStorageSyncService.js +[privatelinkresourceslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/privateLinkResourcesList.js +[registeredserverscreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersCreate.js +[registeredserversdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersDelete.js +[registeredserversget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersGet.js +[registeredserverslistbystoragesyncservice]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersListByStorageSyncService.js +[registeredserverstriggerrollover]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersTriggerRollover.js +[serverendpointscreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsCreate.js +[serverendpointsdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsDelete.js +[serverendpointsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsGet.js +[serverendpointslistbysyncgroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsListBySyncGroup.js +[serverendpointsrecallaction]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsRecallAction.js +[serverendpointsupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsUpdate.js +[storagesyncservicechecknameavailabilityalreadyexists]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServiceCheckNameAvailabilityAlreadyExists.js +[storagesyncservicechecknameavailabilityavailable]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServiceCheckNameAvailabilityAvailable.js +[storagesyncservicescreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesCreate.js +[storagesyncservicesdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesDelete.js +[storagesyncservicesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesGet.js +[storagesyncserviceslistbyresourcegroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesListByResourceGroup.js +[storagesyncserviceslistbysubscription]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesListBySubscription.js +[storagesyncservicesupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesUpdate.js +[syncgroupscreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/syncGroupsCreate.js +[syncgroupsdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/syncGroupsDelete.js +[syncgroupsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/syncGroupsGet.js +[syncgroupslistbystoragesyncservice]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/syncGroupsListByStorageSyncService.js +[workflowsabort]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/workflowsAbort.js +[workflowsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/workflowsGet.js +[workflowslistbystoragesyncservice]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/javascript/workflowsListByStorageSyncService.js +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-storagesync?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storagesync/arm-storagesync/README.md diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsCreate.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsCreate.js new file mode 100644 index 00000000000..96060292c43 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsCreate.js @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create a new CloudEndpoint. + * + * @summary Create a new CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_Create.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cloudEndpointsCreate() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const parameters = { + azureFileShareName: "cvcloud-afscv-0719-058-a94a1354-a1fd-4e9a-9a50-919fad8c4ba4", + friendlyName: "ankushbsubscriptionmgmtmab", + storageAccountResourceId: + "/subscriptions/744f4d70-6d17-4921-8970-a765d14f763f/resourceGroups/tminienv59svc/providers/Microsoft.Storage/storageAccounts/tminienv59storage", + storageAccountTenantId: '"72f988bf-86f1-41af-91ab-2d7cd011db47"', + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.beginCreateAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters + ); + console.log(result); +} + +cloudEndpointsCreate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsDelete.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsDelete.js new file mode 100644 index 00000000000..0a70cd3f978 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsDelete.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Delete a given CloudEndpoint. + * + * @summary Delete a given CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_Delete.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cloudEndpointsDelete() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.beginDeleteAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName + ); + console.log(result); +} + +cloudEndpointsDelete().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsGet.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsGet.js new file mode 100644 index 00000000000..1c6deb2a265 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsGet.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a given CloudEndpoint. + * + * @summary Get a given CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_Get.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cloudEndpointsGet() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.get( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName + ); + console.log(result); +} + +cloudEndpointsGet().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsListBySyncGroup.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsListBySyncGroup.js new file mode 100644 index 00000000000..6f3d18fb717 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsListBySyncGroup.js @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a CloudEndpoint List. + * + * @summary Get a CloudEndpoint List. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_ListBySyncGroup.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cloudEndpointsListBySyncGroup() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.cloudEndpoints.listBySyncGroup( + resourceGroupName, + storageSyncServiceName, + syncGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +cloudEndpointsListBySyncGroup().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsPostBackup.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsPostBackup.js new file mode 100644 index 00000000000..afcf3c6f14f --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsPostBackup.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Post Backup a given CloudEndpoint. + * + * @summary Post Backup a given CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PostBackup.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cloudEndpointsPostBackup() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const parameters = { + azureFileShare: "https://sampleserver.file.core.test-cint.azure-test.net/sampleFileShare", + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.beginPostBackupAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters + ); + console.log(result); +} + +cloudEndpointsPostBackup().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsPostRestore.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsPostRestore.js new file mode 100644 index 00000000000..5c7f0793b1d --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsPostRestore.js @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Post Restore a given CloudEndpoint. + * + * @summary Post Restore a given CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PostRestore.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cloudEndpointsPostRestore() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const parameters = { + azureFileShareUri: + "https://hfsazbackupdevintncus2.file.core.test-cint.azure-test.net/sampleFileShare", + restoreFileSpec: [ + { path: "text1.txt", isdir: false }, + { path: "MyDir", isdir: true }, + { path: "MyDir/SubDir", isdir: false }, + { path: "MyDir/SubDir/File1.pdf", isdir: false }, + ], + sourceAzureFileShareUri: + "https://hfsazbackupdevintncus2.file.core.test-cint.azure-test.net/sampleFileShare", + status: "Succeeded", + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.beginPostRestoreAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters + ); + console.log(result); +} + +cloudEndpointsPostRestore().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsPreBackup.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsPreBackup.js new file mode 100644 index 00000000000..f39a7ec25ba --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsPreBackup.js @@ -0,0 +1,41 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Pre Backup a given CloudEndpoint. + * + * @summary Pre Backup a given CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PreBackup.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cloudEndpointsPreBackup() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const parameters = { + azureFileShare: "https://sampleserver.file.core.test-cint.azure-test.net/sampleFileShare", + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.beginPreBackupAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters + ); + console.log(result); +} + +cloudEndpointsPreBackup().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsPreRestore.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsPreRestore.js new file mode 100644 index 00000000000..741ffaea70f --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsPreRestore.js @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Pre Restore a given CloudEndpoint. + * + * @summary Pre Restore a given CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PreRestore.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cloudEndpointsPreRestore() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const parameters = { + azureFileShareUri: + "https://hfsazbackupdevintncus2.file.core.test-cint.azure-test.net/sampleFileShare", + restoreFileSpec: [ + { path: "text1.txt", isdir: false }, + { path: "MyDir", isdir: true }, + { path: "MyDir/SubDir", isdir: false }, + { path: "MyDir/SubDir/File1.pdf", isdir: false }, + ], + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.beginPreRestoreAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters + ); + console.log(result); +} + +cloudEndpointsPreRestore().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsRestoreheartbeat.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsRestoreheartbeat.js new file mode 100644 index 00000000000..04d49f6fe8b --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsRestoreheartbeat.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Restore Heartbeat a given CloudEndpoint. + * + * @summary Restore Heartbeat a given CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_RestoreHeatbeat.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cloudEndpointsRestoreheartbeat() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.restoreheartbeat( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName + ); + console.log(result); +} + +cloudEndpointsRestoreheartbeat().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsTriggerChangeDetection.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsTriggerChangeDetection.js new file mode 100644 index 00000000000..f0e5c33c8df --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/cloudEndpointsTriggerChangeDetection.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Triggers detection of changes performed on Azure File share connected to the specified Azure File Sync Cloud Endpoint. + * + * @summary Triggers detection of changes performed on Azure File share connected to the specified Azure File Sync Cloud Endpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_TriggerChangeDetection.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function cloudEndpointsTriggerChangeDetection() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const parameters = { + changeDetectionMode: "Recursive", + directoryPath: "NewDirectory", + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.beginTriggerChangeDetectionAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters + ); + console.log(result); +} + +cloudEndpointsTriggerChangeDetection().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/operationsList.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/operationsList.js new file mode 100644 index 00000000000..3695a8e36ad --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/operationsList.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Lists all of the available Storage Sync Rest API operations. + * + * @summary Lists all of the available Storage Sync Rest API operations. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/Operations_List.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function operationsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +operationsList().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/package.json b/sdk/storagesync/arm-storagesync/samples/v9/javascript/package.json new file mode 100644 index 00000000000..57ac7c5a7aa --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/package.json @@ -0,0 +1,32 @@ +{ + "name": "azure-arm-storagesync-samples-js", + "private": true, + "version": "1.0.0", + "description": " client library samples for JavaScript", + "engines": { + "node": ">=12.0.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/storagesync/arm-storagesync" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storagesync/arm-storagesync", + "dependencies": { + "@azure/arm-storagesync": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + } +} diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/privateEndpointConnectionsCreate.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/privateEndpointConnectionsCreate.js new file mode 100644 index 00000000000..425d44f8a6c --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/privateEndpointConnectionsCreate.js @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Update the state of specified private endpoint connection associated with the storage sync service. + * + * @summary Update the state of specified private endpoint connection associated with the storage sync service. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_Create.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function privateEndpointConnectionsCreate() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const storageSyncServiceName = "sss2527"; + const privateEndpointConnectionName = "{privateEndpointConnectionName}"; + const properties = { + privateLinkServiceConnectionState: { + description: "Auto-Approved", + status: "Approved", + }, + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.privateEndpointConnections.beginCreateAndWait( + resourceGroupName, + storageSyncServiceName, + privateEndpointConnectionName, + properties + ); + console.log(result); +} + +privateEndpointConnectionsCreate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/privateEndpointConnectionsDelete.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/privateEndpointConnectionsDelete.js new file mode 100644 index 00000000000..9f9ed178f75 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/privateEndpointConnectionsDelete.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Deletes the specified private endpoint connection associated with the storage sync service. + * + * @summary Deletes the specified private endpoint connection associated with the storage sync service. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_Delete.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function privateEndpointConnectionsDelete() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const storageSyncServiceName = "sss2527"; + const privateEndpointConnectionName = "{privateEndpointConnectionName}"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.privateEndpointConnections.beginDeleteAndWait( + resourceGroupName, + storageSyncServiceName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionsDelete().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/privateEndpointConnectionsGet.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/privateEndpointConnectionsGet.js new file mode 100644 index 00000000000..986d6e520d5 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/privateEndpointConnectionsGet.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets the specified private endpoint connection associated with the storage sync service. + * + * @summary Gets the specified private endpoint connection associated with the storage sync service. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_Get.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function privateEndpointConnectionsGet() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const storageSyncServiceName = "sss2527"; + const privateEndpointConnectionName = "{privateEndpointConnectionName}"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.privateEndpointConnections.get( + resourceGroupName, + storageSyncServiceName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionsGet().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/privateEndpointConnectionsListByStorageSyncService.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/privateEndpointConnectionsListByStorageSyncService.js new file mode 100644 index 00000000000..b7c880662a8 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/privateEndpointConnectionsListByStorageSyncService.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a PrivateEndpointConnection List. + * + * @summary Get a PrivateEndpointConnection List. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_ListByStorageSyncService.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function privateEndpointConnectionsListByStorageSyncService() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const storageSyncServiceName = "sss2527"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateEndpointConnections.listByStorageSyncService( + resourceGroupName, + storageSyncServiceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +privateEndpointConnectionsListByStorageSyncService().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/privateLinkResourcesList.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/privateLinkResourcesList.js new file mode 100644 index 00000000000..d4052b4e42d --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/privateLinkResourcesList.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets the private link resources that need to be created for a storage sync service. + * + * @summary Gets the private link resources that need to be created for a storage sync service. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateLinkResources_List.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function privateLinkResourcesList() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const storageSyncServiceName = "sss2527"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.privateLinkResources.listByStorageSyncService( + resourceGroupName, + storageSyncServiceName + ); + console.log(result); +} + +privateLinkResourcesList().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersCreate.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersCreate.js new file mode 100644 index 00000000000..83f4ff8847f --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersCreate.js @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Add a new registered server. + * + * @summary Add a new registered server. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_Create.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function registeredServersCreate() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const serverId = "080d4133-bdb5-40a0-96a0-71a6057bfe9a"; + const parameters = { + agentVersion: "1.0.277.0", + friendlyName: "afscv-2304-139", + serverCertificate: + "MIIDFjCCAf6gAwIBAgIQQS+DS8uhc4VNzUkTw7wbRjANBgkqhkiG9w0BAQ0FADAzMTEwLwYDVQQDEyhhbmt1c2hiLXByb2QzLnJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29tMB4XDTE3MDgwMzE3MDQyNFoXDTE4MDgwNDE3MDQyNFowMzExMC8GA1UEAxMoYW5rdXNoYi1wcm9kMy5yZWRtb25kLmNvcnAubWljcm9zb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALDRvV4gmsIy6jGDPiHsXmvgVP749NNP7DopdlbHaNhjFmYINHl0uWylyaZmgJrROt2mnxN/zEyJtGnqYHlzUr4xvGq/qV5pqgdB9tag/sw9i22gfe9PRZ0FmSOZnXMbLYgLiDFqLtut5gHcOuWMj03YnkfoBEKlFBxWbagvW2yxz/Sxi9OVSJOKCaXra0RpcIHrO/KFl6ho2eE1/7Ykmfa8hZvSdoPd5gHdLiQcMB/pxq+mWp1fI6c8vFZoDu7Atn+NXTzYPKUxKzaisF12TsaKpohUsJpbB3Wocb0F5frn614D2pg14ERB5otjAMWw1m65csQWPI6dP8KIYe0+QPkCAwEAAaMmMCQwIgYDVR0lAQH/BBgwFgYIKwYBBQUHAwIGCisGAQQBgjcKAwwwDQYJKoZIhvcNAQENBQADggEBAA4RhVIBkw34M1RwakJgHvtjsOFxF1tVQA941NtLokx1l2Z8+GFQkcG4xpZSt+UN6wLerdCbnNhtkCErWUDeaT0jxk4g71Ofex7iM04crT4iHJr8mi96/XnhnkTUs+GDk12VgdeeNEczMZz+8Mxw9dJ5NCnYgTwO0SzGlclRsDvjzkLo8rh2ZG6n/jKrEyNXXo+hOqhupij0QbRP2Tvexdfw201kgN1jdZify8XzJ8Oi0bTS0KpJf2pNPOlooK2bjMUei9ANtEdXwwfVZGWvVh6tJjdv6k14wWWJ1L7zhA1IIVb1J+sQUzJji5iX0DrezjTz1Fg+gAzITaA/WsuujlM=", + serverId: "080d4133-bdb5-40a0-96a0-71a6057bfe9a", + serverOSVersion: "10.0.14393.0", + serverRole: "Standalone", + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.registeredServers.beginCreateAndWait( + resourceGroupName, + storageSyncServiceName, + serverId, + parameters + ); + console.log(result); +} + +registeredServersCreate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersDelete.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersDelete.js new file mode 100644 index 00000000000..b29a5275719 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersDelete.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Delete the given registered server. + * + * @summary Delete the given registered server. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_Delete.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function registeredServersDelete() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const serverId = "41166691-ab03-43e9-ab3e-0330eda162ac"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.registeredServers.beginDeleteAndWait( + resourceGroupName, + storageSyncServiceName, + serverId + ); + console.log(result); +} + +registeredServersDelete().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersGet.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersGet.js new file mode 100644 index 00000000000..1d8b53b2e2b --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersGet.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a given registered server. + * + * @summary Get a given registered server. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_Get.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function registeredServersGet() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const serverId = "080d4133-bdb5-40a0-96a0-71a6057bfe9a"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.registeredServers.get( + resourceGroupName, + storageSyncServiceName, + serverId + ); + console.log(result); +} + +registeredServersGet().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersListByStorageSyncService.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersListByStorageSyncService.js new file mode 100644 index 00000000000..11064c16c57 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersListByStorageSyncService.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a given registered server list. + * + * @summary Get a given registered server list. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_ListByStorageSyncService.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function registeredServersListByStorageSyncService() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.registeredServers.listByStorageSyncService( + resourceGroupName, + storageSyncServiceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +registeredServersListByStorageSyncService().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersTriggerRollover.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersTriggerRollover.js new file mode 100644 index 00000000000..9764ab9fe84 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/registeredServersTriggerRollover.js @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Triggers Server certificate rollover. + * + * @summary Triggers Server certificate rollover. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_TriggerRollover.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function registeredServersTriggerRollover() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const serverId = "d166ca76-dad2-49df-b409-12345642d730"; + const parameters = { + serverCertificate: + '"MIIDFjCCAf6gAwIBAgIQQS+DS8uhc4VNzUkTw7wbRjANBgkqhkiG9w0BAQ0FADAzMTEwLwYDVQQDEyhhbmt1c2hiLXByb2QzLnJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29tMB4XDTE3MDgwMzE3MDQyNFoXDTE4MDgwNDE3MDQyNFowMzExMC8GA1UEAxMoYW5rdXNoYi1wcm9kMy5yZWRtb25kLmNvcnAubWljcm9zb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALDRvV4gmsIy6jGDPiHsXmvgVP749NNP7DopdlbHaNhjFmYINHl0uWylyaZmgJrROt2mnxN/zEyJtGnqYHlzUr4xvGq/qV5pqgdB9tag/sw9i22gfe9PRZ0FmSOZnXMbLYgLiDFqLtut5gHcOuWMj03YnkfoBEKlFBxWbagvW2yxz/Sxi9OVSJOKCaXra0RpcIHrO/KFl6ho2eE1/7Ykmfa8hZvSdoPd5gHdLiQcMB/pxq+mWp1fI6c8vFZoDu7Atn+NXTzYPKUxKzaisF12TsaKpohUsJpbB3Wocb0F5frn614D2pg14ERB5otjAMWw1m65csQWPI6dP8KIYe0+QPkCAwEAAaMmMCQwIgYDVR0lAQH/BBgwFgYIKwYBBQUHAwIGCisGAQQBgjcKAwwwDQYJKoZIhvcNAQENBQADggEBAA4RhVIBkw34M1RwakJgHvtjsOFxF1tVQA941NtLokx1l2Z8+GFQkcG4xpZSt+UN6wLerdCbnNhtkCErWUDeaT0jxk4g71Ofex7iM04crT4iHJr8mi96/XnhnkTUs+GDk12VgdeeNEczMZz+8Mxw9dJ5NCnYgTwO0SzGlclRsDvjzkLo8rh2ZG6n/jKrEyNXXo+hOqhupij0QbRP2Tvexdfw201kgN1jdZify8XzJ8Oi0bTS0KpJf2pNPOlooK2bjMUei9ANtEdXwwfVZGWvVh6tJjdv6k14wWWJ1L7zhA1IIVb1J+sQUzJji5iX0DrezjTz1Fg+gAzITaA/WsuujlM="', + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.registeredServers.beginTriggerRolloverAndWait( + resourceGroupName, + storageSyncServiceName, + serverId, + parameters + ); + console.log(result); +} + +registeredServersTriggerRollover().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/sample.env b/sdk/storagesync/arm-storagesync/samples/v9/javascript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsCreate.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsCreate.js new file mode 100644 index 00000000000..bb227991157 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsCreate.js @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create a new ServerEndpoint. + * + * @summary Create a new ServerEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Create.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function serverEndpointsCreate() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const serverEndpointName = "SampleServerEndpoint_1"; + const parameters = { + cloudTiering: "off", + initialDownloadPolicy: "NamespaceThenModifiedFiles", + initialUploadPolicy: "ServerAuthoritative", + localCacheMode: "UpdateLocallyCachedFiles", + offlineDataTransfer: "on", + offlineDataTransferShareName: "myfileshare", + serverLocalPath: "D:SampleServerEndpoint_1", + serverResourceId: + "/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/registeredServers/080d4133-bdb5-40a0-96a0-71a6057bfe9a", + tierFilesOlderThanDays: 0, + volumeFreeSpacePercent: 100, + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.serverEndpoints.beginCreateAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName, + parameters + ); + console.log(result); +} + +serverEndpointsCreate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsDelete.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsDelete.js new file mode 100644 index 00000000000..7891696f87c --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsDelete.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Delete a given ServerEndpoint. + * + * @summary Delete a given ServerEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Delete.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function serverEndpointsDelete() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const serverEndpointName = "SampleServerEndpoint_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.serverEndpoints.beginDeleteAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName + ); + console.log(result); +} + +serverEndpointsDelete().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsGet.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsGet.js new file mode 100644 index 00000000000..a4063829e29 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsGet.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a ServerEndpoint. + * + * @summary Get a ServerEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Get.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function serverEndpointsGet() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const serverEndpointName = "SampleServerEndpoint_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.serverEndpoints.get( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName + ); + console.log(result); +} + +serverEndpointsGet().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsListBySyncGroup.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsListBySyncGroup.js new file mode 100644 index 00000000000..ad01b5ed0f1 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsListBySyncGroup.js @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a ServerEndpoint list. + * + * @summary Get a ServerEndpoint list. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_ListBySyncGroup.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function serverEndpointsListBySyncGroup() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.serverEndpoints.listBySyncGroup( + resourceGroupName, + storageSyncServiceName, + syncGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +serverEndpointsListBySyncGroup().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsRecallAction.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsRecallAction.js new file mode 100644 index 00000000000..5ec83b69c0e --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsRecallAction.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Recall a server endpoint. + * + * @summary Recall a server endpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Recall.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function serverEndpointsRecallAction() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const serverEndpointName = "SampleServerEndpoint_1"; + const parameters = { pattern: "", recallPath: "" }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.serverEndpoints.beginRecallActionAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName, + parameters + ); + console.log(result); +} + +serverEndpointsRecallAction().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsUpdate.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsUpdate.js new file mode 100644 index 00000000000..29f1077a142 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/serverEndpointsUpdate.js @@ -0,0 +1,46 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Patch a given ServerEndpoint. + * + * @summary Patch a given ServerEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Update.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function serverEndpointsUpdate() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const serverEndpointName = "SampleServerEndpoint_1"; + const parameters = { + cloudTiering: "off", + localCacheMode: "UpdateLocallyCachedFiles", + offlineDataTransfer: "off", + tierFilesOlderThanDays: 0, + volumeFreeSpacePercent: 100, + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.serverEndpoints.beginUpdateAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName, + options + ); + console.log(result); +} + +serverEndpointsUpdate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServiceCheckNameAvailabilityAlreadyExists.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServiceCheckNameAvailabilityAlreadyExists.js new file mode 100644 index 00000000000..3cf8d58f903 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServiceCheckNameAvailabilityAlreadyExists.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Check the give namespace name availability. + * + * @summary Check the give namespace name availability. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServiceCheckNameAvailability_AlreadyExists.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageSyncServiceCheckNameAvailabilityAlreadyExists() { + const subscriptionId = "5c6bc8e1-1eaf-4192-94d8-58ce463ac86c"; + const locationName = "westus"; + const parameters = { + name: "newstoragesyncservicename", + type: "Microsoft.StorageSync/storageSyncServices", + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.storageSyncServices.checkNameAvailability(locationName, parameters); + console.log(result); +} + +storageSyncServiceCheckNameAvailabilityAlreadyExists().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServiceCheckNameAvailabilityAvailable.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServiceCheckNameAvailabilityAvailable.js new file mode 100644 index 00000000000..7faa351579d --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServiceCheckNameAvailabilityAvailable.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Check the give namespace name availability. + * + * @summary Check the give namespace name availability. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServiceCheckNameAvailability_Available.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageSyncServiceCheckNameAvailabilityAvailable() { + const subscriptionId = "5c6bc8e1-1eaf-4192-94d8-58ce463ac86c"; + const locationName = "westus"; + const parameters = { + name: "newstoragesyncservicename", + type: "Microsoft.StorageSync/storageSyncServices", + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.storageSyncServices.checkNameAvailability(locationName, parameters); + console.log(result); +} + +storageSyncServiceCheckNameAvailabilityAvailable().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesCreate.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesCreate.js new file mode 100644 index 00000000000..5ac7deab615 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesCreate.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create a new StorageSyncService. + * + * @summary Create a new StorageSyncService. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Create.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageSyncServicesCreate() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const parameters = { + incomingTrafficPolicy: "AllowAllTraffic", + location: "WestUS", + tags: {}, + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.storageSyncServices.beginCreateAndWait( + resourceGroupName, + storageSyncServiceName, + parameters + ); + console.log(result); +} + +storageSyncServicesCreate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesDelete.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesDelete.js new file mode 100644 index 00000000000..b3c50a77087 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesDelete.js @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Delete a given StorageSyncService. + * + * @summary Delete a given StorageSyncService. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Delete.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageSyncServicesDelete() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.storageSyncServices.beginDeleteAndWait( + resourceGroupName, + storageSyncServiceName + ); + console.log(result); +} + +storageSyncServicesDelete().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesGet.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesGet.js new file mode 100644 index 00000000000..d12aa03ed23 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesGet.js @@ -0,0 +1,30 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a given StorageSyncService. + * + * @summary Get a given StorageSyncService. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Get.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageSyncServicesGet() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.storageSyncServices.get(resourceGroupName, storageSyncServiceName); + console.log(result); +} + +storageSyncServicesGet().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesListByResourceGroup.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesListByResourceGroup.js new file mode 100644 index 00000000000..ceb9c5ee989 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesListByResourceGroup.js @@ -0,0 +1,32 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a StorageSyncService list by Resource group name. + * + * @summary Get a StorageSyncService list by Resource group name. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_ListByResourceGroup.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageSyncServicesListByResourceGroup() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageSyncServices.listByResourceGroup(resourceGroupName)) { + resArray.push(item); + } + console.log(resArray); +} + +storageSyncServicesListByResourceGroup().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesListBySubscription.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesListBySubscription.js new file mode 100644 index 00000000000..f250435fc1e --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesListBySubscription.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a StorageSyncService list by subscription. + * + * @summary Get a StorageSyncService list by subscription. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_ListBySubscription.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageSyncServicesListBySubscription() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageSyncServices.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +storageSyncServicesListBySubscription().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesUpdate.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesUpdate.js new file mode 100644 index 00000000000..b9b2a23e1f0 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/storageSyncServicesUpdate.js @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Patch a given StorageSyncService. + * + * @summary Patch a given StorageSyncService. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Update.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function storageSyncServicesUpdate() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const parameters = { + incomingTrafficPolicy: "AllowAllTraffic", + tags: { dept: "IT", environment: "Test" }, + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.storageSyncServices.beginUpdateAndWait( + resourceGroupName, + storageSyncServiceName, + options + ); + console.log(result); +} + +storageSyncServicesUpdate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/syncGroupsCreate.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/syncGroupsCreate.js new file mode 100644 index 00000000000..c7f6dc1e757 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/syncGroupsCreate.js @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create a new SyncGroup. + * + * @summary Create a new SyncGroup. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_Create.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function syncGroupsCreate() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const parameters = { properties: {} }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.syncGroups.create( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + parameters + ); + console.log(result); +} + +syncGroupsCreate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/syncGroupsDelete.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/syncGroupsDelete.js new file mode 100644 index 00000000000..f56d4caa0a7 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/syncGroupsDelete.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Delete a given SyncGroup. + * + * @summary Delete a given SyncGroup. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_Delete.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function syncGroupsDelete() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.syncGroups.delete( + resourceGroupName, + storageSyncServiceName, + syncGroupName + ); + console.log(result); +} + +syncGroupsDelete().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/syncGroupsGet.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/syncGroupsGet.js new file mode 100644 index 00000000000..94490704dcb --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/syncGroupsGet.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a given SyncGroup. + * + * @summary Get a given SyncGroup. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_Get.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function syncGroupsGet() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.syncGroups.get( + resourceGroupName, + storageSyncServiceName, + syncGroupName + ); + console.log(result); +} + +syncGroupsGet().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/syncGroupsListByStorageSyncService.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/syncGroupsListByStorageSyncService.js new file mode 100644 index 00000000000..54000132e61 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/syncGroupsListByStorageSyncService.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a SyncGroup List. + * + * @summary Get a SyncGroup List. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_ListByStorageSyncService.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function syncGroupsListByStorageSyncService() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.syncGroups.listByStorageSyncService( + resourceGroupName, + storageSyncServiceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +syncGroupsListByStorageSyncService().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/workflowsAbort.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/workflowsAbort.js new file mode 100644 index 00000000000..1f43b8e401c --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/workflowsAbort.js @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Abort the given workflow. + * + * @summary Abort the given workflow. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/Workflows_Abort.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function workflowsAbort() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const workflowId = "7ffd50b3-5574-478d-9ff2-9371bc42ce68"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.workflows.abort( + resourceGroupName, + storageSyncServiceName, + workflowId + ); + console.log(result); +} + +workflowsAbort().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/workflowsGet.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/workflowsGet.js new file mode 100644 index 00000000000..914afb988ca --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/workflowsGet.js @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get Operation status + * + * @summary Get Operation status + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/LocationOperationStatus_Get.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function workflowsGet() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const locationName = "westus"; + const operationId = + "eyJwYXJ0aXRpb25JZCI6ImE1ZDNiMDU4LTYwN2MtNDI0Ny05Y2FmLWJlZmU4NGQ0ZDU0NyIsIndvcmtmbG93SWQiOiJjYzg1MTY2YS0xMjI2LTQ4MGYtYWM5ZC1jMmRhNTVmY2M2ODYiLCJ3b3JrZmxvd09wZXJhdGlvbklkIjoiOTdmODU5ZTAtOGY1MC00ZTg4LWJkZDEtNWZlYzgwYTVlYzM0tui="; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.locationOperationStatus(locationName, operationId); + console.log(result); +} + +workflowsGet().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/javascript/workflowsListByStorageSyncService.js b/sdk/storagesync/arm-storagesync/samples/v9/javascript/workflowsListByStorageSyncService.js new file mode 100644 index 00000000000..8d0454341ba --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/javascript/workflowsListByStorageSyncService.js @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a Workflow List + * + * @summary Get a Workflow List + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/Workflows_ListByStorageSyncService.json + */ +const { MicrosoftStorageSync } = require("@azure/arm-storagesync"); +const { DefaultAzureCredential } = require("@azure/identity"); + +async function workflowsListByStorageSyncService() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.workflows.listByStorageSyncService( + resourceGroupName, + storageSyncServiceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +workflowsListByStorageSyncService().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/README.md b/sdk/storagesync/arm-storagesync/samples/v9/typescript/README.md new file mode 100644 index 00000000000..9fac4f50e61 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/README.md @@ -0,0 +1,145 @@ +# client library samples for TypeScript + +These sample programs show how to use the TypeScript client libraries for in some common scenarios. + +| **File Name** | **Description** | +| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [cloudEndpointsCreate.ts][cloudendpointscreate] | Create a new CloudEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_Create.json | +| [cloudEndpointsDelete.ts][cloudendpointsdelete] | Delete a given CloudEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_Delete.json | +| [cloudEndpointsGet.ts][cloudendpointsget] | Get a given CloudEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_Get.json | +| [cloudEndpointsListBySyncGroup.ts][cloudendpointslistbysyncgroup] | Get a CloudEndpoint List. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_ListBySyncGroup.json | +| [cloudEndpointsPostBackup.ts][cloudendpointspostbackup] | Post Backup a given CloudEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PostBackup.json | +| [cloudEndpointsPostRestore.ts][cloudendpointspostrestore] | Post Restore a given CloudEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PostRestore.json | +| [cloudEndpointsPreBackup.ts][cloudendpointsprebackup] | Pre Backup a given CloudEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PreBackup.json | +| [cloudEndpointsPreRestore.ts][cloudendpointsprerestore] | Pre Restore a given CloudEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PreRestore.json | +| [cloudEndpointsRestoreheartbeat.ts][cloudendpointsrestoreheartbeat] | Restore Heartbeat a given CloudEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_RestoreHeatbeat.json | +| [cloudEndpointsTriggerChangeDetection.ts][cloudendpointstriggerchangedetection] | Triggers detection of changes performed on Azure File share connected to the specified Azure File Sync Cloud Endpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_TriggerChangeDetection.json | +| [operationsList.ts][operationslist] | Lists all of the available Storage Sync Rest API operations. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/Operations_List.json | +| [privateEndpointConnectionsCreate.ts][privateendpointconnectionscreate] | Update the state of specified private endpoint connection associated with the storage sync service. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_Create.json | +| [privateEndpointConnectionsDelete.ts][privateendpointconnectionsdelete] | Deletes the specified private endpoint connection associated with the storage sync service. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_Delete.json | +| [privateEndpointConnectionsGet.ts][privateendpointconnectionsget] | Gets the specified private endpoint connection associated with the storage sync service. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_Get.json | +| [privateEndpointConnectionsListByStorageSyncService.ts][privateendpointconnectionslistbystoragesyncservice] | Get a PrivateEndpointConnection List. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_ListByStorageSyncService.json | +| [privateLinkResourcesList.ts][privatelinkresourceslist] | Gets the private link resources that need to be created for a storage sync service. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateLinkResources_List.json | +| [registeredServersCreate.ts][registeredserverscreate] | Add a new registered server. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_Create.json | +| [registeredServersDelete.ts][registeredserversdelete] | Delete the given registered server. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_Delete.json | +| [registeredServersGet.ts][registeredserversget] | Get a given registered server. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_Get.json | +| [registeredServersListByStorageSyncService.ts][registeredserverslistbystoragesyncservice] | Get a given registered server list. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_ListByStorageSyncService.json | +| [registeredServersTriggerRollover.ts][registeredserverstriggerrollover] | Triggers Server certificate rollover. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_TriggerRollover.json | +| [serverEndpointsCreate.ts][serverendpointscreate] | Create a new ServerEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Create.json | +| [serverEndpointsDelete.ts][serverendpointsdelete] | Delete a given ServerEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Delete.json | +| [serverEndpointsGet.ts][serverendpointsget] | Get a ServerEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Get.json | +| [serverEndpointsListBySyncGroup.ts][serverendpointslistbysyncgroup] | Get a ServerEndpoint list. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_ListBySyncGroup.json | +| [serverEndpointsRecallAction.ts][serverendpointsrecallaction] | Recall a server endpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Recall.json | +| [serverEndpointsUpdate.ts][serverendpointsupdate] | Patch a given ServerEndpoint. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Update.json | +| [storageSyncServiceCheckNameAvailabilityAlreadyExists.ts][storagesyncservicechecknameavailabilityalreadyexists] | Check the give namespace name availability. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServiceCheckNameAvailability_AlreadyExists.json | +| [storageSyncServiceCheckNameAvailabilityAvailable.ts][storagesyncservicechecknameavailabilityavailable] | Check the give namespace name availability. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServiceCheckNameAvailability_Available.json | +| [storageSyncServicesCreate.ts][storagesyncservicescreate] | Create a new StorageSyncService. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Create.json | +| [storageSyncServicesDelete.ts][storagesyncservicesdelete] | Delete a given StorageSyncService. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Delete.json | +| [storageSyncServicesGet.ts][storagesyncservicesget] | Get a given StorageSyncService. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Get.json | +| [storageSyncServicesListByResourceGroup.ts][storagesyncserviceslistbyresourcegroup] | Get a StorageSyncService list by Resource group name. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_ListByResourceGroup.json | +| [storageSyncServicesListBySubscription.ts][storagesyncserviceslistbysubscription] | Get a StorageSyncService list by subscription. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_ListBySubscription.json | +| [storageSyncServicesUpdate.ts][storagesyncservicesupdate] | Patch a given StorageSyncService. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Update.json | +| [syncGroupsCreate.ts][syncgroupscreate] | Create a new SyncGroup. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_Create.json | +| [syncGroupsDelete.ts][syncgroupsdelete] | Delete a given SyncGroup. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_Delete.json | +| [syncGroupsGet.ts][syncgroupsget] | Get a given SyncGroup. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_Get.json | +| [syncGroupsListByStorageSyncService.ts][syncgroupslistbystoragesyncservice] | Get a SyncGroup List. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_ListByStorageSyncService.json | +| [workflowsAbort.ts][workflowsabort] | Abort the given workflow. x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/Workflows_Abort.json | +| [workflowsGet.ts][workflowsget] | Get Operation status x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/LocationOperationStatus_Get.json | +| [workflowsListByStorageSyncService.ts][workflowslistbystoragesyncservice] | Get a Workflow List x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/Workflows_ListByStorageSyncService.json | + +## Prerequisites + +The sample programs are compatible with [LTS versions of Node.js](https://nodejs.org/about/releases/). + +Before running the samples in Node, they must be compiled to JavaScript using the TypeScript compiler. For more information on TypeScript, see the [TypeScript documentation][typescript]. Install the TypeScript compiler using: + +```bash +npm install -g typescript +``` + +You need [an Azure subscription][freesub] to run these sample programs. + +Samples retrieve credentials to access the service endpoint from environment variables. Alternatively, edit the source code to include the appropriate credentials. See each individual sample for details on which environment variables/credentials it requires to function. + +Adapting the samples to run in the browser may require some additional consideration. For details, please see the [package README][package]. + +## Setup + +To run the samples using the published version of the package: + +1. Install the dependencies using `npm`: + +```bash +npm install +``` + +2. Compile the samples: + +```bash +npm run build +``` + +3. Edit the file `sample.env`, adding the correct credentials to access the Azure service and run the samples. Then rename the file from `sample.env` to just `.env`. The sample programs will read this file automatically. + +4. Run whichever samples you like (note that some samples may require additional setup, see the table above): + +```bash +node dist/cloudEndpointsCreate.js +``` + +Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform): + +```bash +npx cross-env node dist/cloudEndpointsCreate.js +``` + +## Next Steps + +Take a look at our [API Documentation][apiref] for more information about the APIs that are available in the clients. + +[cloudendpointscreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsCreate.ts +[cloudendpointsdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsDelete.ts +[cloudendpointsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsGet.ts +[cloudendpointslistbysyncgroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsListBySyncGroup.ts +[cloudendpointspostbackup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsPostBackup.ts +[cloudendpointspostrestore]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsPostRestore.ts +[cloudendpointsprebackup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsPreBackup.ts +[cloudendpointsprerestore]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsPreRestore.ts +[cloudendpointsrestoreheartbeat]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsRestoreheartbeat.ts +[cloudendpointstriggerchangedetection]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsTriggerChangeDetection.ts +[operationslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/operationsList.ts +[privateendpointconnectionscreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateEndpointConnectionsCreate.ts +[privateendpointconnectionsdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateEndpointConnectionsDelete.ts +[privateendpointconnectionsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateEndpointConnectionsGet.ts +[privateendpointconnectionslistbystoragesyncservice]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateEndpointConnectionsListByStorageSyncService.ts +[privatelinkresourceslist]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateLinkResourcesList.ts +[registeredserverscreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersCreate.ts +[registeredserversdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersDelete.ts +[registeredserversget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersGet.ts +[registeredserverslistbystoragesyncservice]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersListByStorageSyncService.ts +[registeredserverstriggerrollover]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersTriggerRollover.ts +[serverendpointscreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsCreate.ts +[serverendpointsdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsDelete.ts +[serverendpointsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsGet.ts +[serverendpointslistbysyncgroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsListBySyncGroup.ts +[serverendpointsrecallaction]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsRecallAction.ts +[serverendpointsupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsUpdate.ts +[storagesyncservicechecknameavailabilityalreadyexists]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServiceCheckNameAvailabilityAlreadyExists.ts +[storagesyncservicechecknameavailabilityavailable]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServiceCheckNameAvailabilityAvailable.ts +[storagesyncservicescreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesCreate.ts +[storagesyncservicesdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesDelete.ts +[storagesyncservicesget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesGet.ts +[storagesyncserviceslistbyresourcegroup]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesListByResourceGroup.ts +[storagesyncserviceslistbysubscription]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesListBySubscription.ts +[storagesyncservicesupdate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesUpdate.ts +[syncgroupscreate]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/syncGroupsCreate.ts +[syncgroupsdelete]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/syncGroupsDelete.ts +[syncgroupsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/syncGroupsGet.ts +[syncgroupslistbystoragesyncservice]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/syncGroupsListByStorageSyncService.ts +[workflowsabort]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/workflowsAbort.ts +[workflowsget]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/workflowsGet.ts +[workflowslistbystoragesyncservice]: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/workflowsListByStorageSyncService.ts +[apiref]: https://docs.microsoft.com/javascript/api/@azure/arm-storagesync?view=azure-node-preview +[freesub]: https://azure.microsoft.com/free/ +[package]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storagesync/arm-storagesync/README.md +[typescript]: https://www.typescriptlang.org/docs/home.html diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/package.json b/sdk/storagesync/arm-storagesync/samples/v9/typescript/package.json new file mode 100644 index 00000000000..ed0f23a05a6 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/package.json @@ -0,0 +1,41 @@ +{ + "name": "azure-arm-storagesync-samples-ts", + "private": true, + "version": "1.0.0", + "description": " client library samples for TypeScript", + "engines": { + "node": ">=12.0.0" + }, + "scripts": { + "build": "tsc", + "prebuild": "rimraf dist/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Azure/azure-sdk-for-js.git", + "directory": "sdk/storagesync/arm-storagesync" + }, + "keywords": [ + "node", + "azure", + "typescript", + "browser", + "isomorphic" + ], + "author": "Microsoft Corporation", + "license": "MIT", + "bugs": { + "url": "https://github.com/Azure/azure-sdk-for-js/issues" + }, + "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storagesync/arm-storagesync", + "dependencies": { + "@azure/arm-storagesync": "latest", + "dotenv": "latest", + "@azure/identity": "^2.0.1" + }, + "devDependencies": { + "@types/node": "^12.0.0", + "typescript": "~4.4.0", + "rimraf": "latest" + } +} diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/sample.env b/sdk/storagesync/arm-storagesync/samples/v9/typescript/sample.env new file mode 100644 index 00000000000..672847a3fea --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/sample.env @@ -0,0 +1,4 @@ +# App registration secret for AAD authentication +AZURE_CLIENT_SECRET= +AZURE_CLIENT_ID= +AZURE_TENANT_ID= \ No newline at end of file diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsCreate.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsCreate.ts new file mode 100644 index 00000000000..5df183c052b --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsCreate.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create a new CloudEndpoint. + * + * @summary Create a new CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_Create.json + */ +import { + CloudEndpointCreateParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cloudEndpointsCreate() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const parameters: CloudEndpointCreateParameters = { + azureFileShareName: + "cvcloud-afscv-0719-058-a94a1354-a1fd-4e9a-9a50-919fad8c4ba4", + friendlyName: "ankushbsubscriptionmgmtmab", + storageAccountResourceId: + "/subscriptions/744f4d70-6d17-4921-8970-a765d14f763f/resourceGroups/tminienv59svc/providers/Microsoft.Storage/storageAccounts/tminienv59storage", + storageAccountTenantId: '"72f988bf-86f1-41af-91ab-2d7cd011db47"' + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.beginCreateAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters + ); + console.log(result); +} + +cloudEndpointsCreate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsDelete.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsDelete.ts new file mode 100644 index 00000000000..21582c8c1a9 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsDelete.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Delete a given CloudEndpoint. + * + * @summary Delete a given CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_Delete.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cloudEndpointsDelete() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.beginDeleteAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName + ); + console.log(result); +} + +cloudEndpointsDelete().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsGet.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsGet.ts new file mode 100644 index 00000000000..7b6d15570f6 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsGet.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a given CloudEndpoint. + * + * @summary Get a given CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_Get.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cloudEndpointsGet() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.get( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName + ); + console.log(result); +} + +cloudEndpointsGet().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsListBySyncGroup.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsListBySyncGroup.ts new file mode 100644 index 00000000000..5bd7ef9dbb2 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsListBySyncGroup.ts @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a CloudEndpoint List. + * + * @summary Get a CloudEndpoint List. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_ListBySyncGroup.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cloudEndpointsListBySyncGroup() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.cloudEndpoints.listBySyncGroup( + resourceGroupName, + storageSyncServiceName, + syncGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +cloudEndpointsListBySyncGroup().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsPostBackup.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsPostBackup.ts new file mode 100644 index 00000000000..0d49792e1fa --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsPostBackup.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Post Backup a given CloudEndpoint. + * + * @summary Post Backup a given CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PostBackup.json + */ +import { BackupRequest, MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cloudEndpointsPostBackup() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const parameters: BackupRequest = { + azureFileShare: + "https://sampleserver.file.core.test-cint.azure-test.net/sampleFileShare" + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.beginPostBackupAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters + ); + console.log(result); +} + +cloudEndpointsPostBackup().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsPostRestore.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsPostRestore.ts new file mode 100644 index 00000000000..7625e1493db --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsPostRestore.ts @@ -0,0 +1,54 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Post Restore a given CloudEndpoint. + * + * @summary Post Restore a given CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PostRestore.json + */ +import { + PostRestoreRequest, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cloudEndpointsPostRestore() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const parameters: PostRestoreRequest = { + azureFileShareUri: + "https://hfsazbackupdevintncus2.file.core.test-cint.azure-test.net/sampleFileShare", + restoreFileSpec: [ + { path: "text1.txt", isdir: false }, + { path: "MyDir", isdir: true }, + { path: "MyDir/SubDir", isdir: false }, + { path: "MyDir/SubDir/File1.pdf", isdir: false } + ], + sourceAzureFileShareUri: + "https://hfsazbackupdevintncus2.file.core.test-cint.azure-test.net/sampleFileShare", + status: "Succeeded" + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.beginPostRestoreAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters + ); + console.log(result); +} + +cloudEndpointsPostRestore().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsPreBackup.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsPreBackup.ts new file mode 100644 index 00000000000..78c7c720ae0 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsPreBackup.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Pre Backup a given CloudEndpoint. + * + * @summary Pre Backup a given CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PreBackup.json + */ +import { BackupRequest, MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cloudEndpointsPreBackup() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const parameters: BackupRequest = { + azureFileShare: + "https://sampleserver.file.core.test-cint.azure-test.net/sampleFileShare" + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.beginPreBackupAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters + ); + console.log(result); +} + +cloudEndpointsPreBackup().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsPreRestore.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsPreRestore.ts new file mode 100644 index 00000000000..34ba73127d7 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsPreRestore.ts @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Pre Restore a given CloudEndpoint. + * + * @summary Pre Restore a given CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_PreRestore.json + */ +import { + PreRestoreRequest, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cloudEndpointsPreRestore() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const parameters: PreRestoreRequest = { + azureFileShareUri: + "https://hfsazbackupdevintncus2.file.core.test-cint.azure-test.net/sampleFileShare", + restoreFileSpec: [ + { path: "text1.txt", isdir: false }, + { path: "MyDir", isdir: true }, + { path: "MyDir/SubDir", isdir: false }, + { path: "MyDir/SubDir/File1.pdf", isdir: false } + ] + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.beginPreRestoreAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters + ); + console.log(result); +} + +cloudEndpointsPreRestore().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsRestoreheartbeat.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsRestoreheartbeat.ts new file mode 100644 index 00000000000..3cd2984bd1a --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsRestoreheartbeat.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Restore Heartbeat a given CloudEndpoint. + * + * @summary Restore Heartbeat a given CloudEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_RestoreHeatbeat.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cloudEndpointsRestoreheartbeat() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.restoreheartbeat( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName + ); + console.log(result); +} + +cloudEndpointsRestoreheartbeat().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsTriggerChangeDetection.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsTriggerChangeDetection.ts new file mode 100644 index 00000000000..f5bb788d048 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/cloudEndpointsTriggerChangeDetection.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Triggers detection of changes performed on Azure File share connected to the specified Azure File Sync Cloud Endpoint. + * + * @summary Triggers detection of changes performed on Azure File share connected to the specified Azure File Sync Cloud Endpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/CloudEndpoints_TriggerChangeDetection.json + */ +import { + TriggerChangeDetectionParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function cloudEndpointsTriggerChangeDetection() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const cloudEndpointName = "SampleCloudEndpoint_1"; + const parameters: TriggerChangeDetectionParameters = { + changeDetectionMode: "Recursive", + directoryPath: "NewDirectory" + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.cloudEndpoints.beginTriggerChangeDetectionAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters + ); + console.log(result); +} + +cloudEndpointsTriggerChangeDetection().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/operationsList.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/operationsList.ts new file mode 100644 index 00000000000..ee18429dc8c --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/operationsList.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Lists all of the available Storage Sync Rest API operations. + * + * @summary Lists all of the available Storage Sync Rest API operations. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/Operations_List.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function operationsList() { + const subscriptionId = "00000000-0000-0000-0000-000000000000"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.operations.list()) { + resArray.push(item); + } + console.log(resArray); +} + +operationsList().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateEndpointConnectionsCreate.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateEndpointConnectionsCreate.ts new file mode 100644 index 00000000000..6fd603f1339 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateEndpointConnectionsCreate.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Update the state of specified private endpoint connection associated with the storage sync service. + * + * @summary Update the state of specified private endpoint connection associated with the storage sync service. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_Create.json + */ +import { + PrivateEndpointConnection, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function privateEndpointConnectionsCreate() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res7687"; + const storageSyncServiceName = "sss2527"; + const privateEndpointConnectionName = "{privateEndpointConnectionName}"; + const properties: PrivateEndpointConnection = { + privateLinkServiceConnectionState: { + description: "Auto-Approved", + status: "Approved" + } + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.privateEndpointConnections.beginCreateAndWait( + resourceGroupName, + storageSyncServiceName, + privateEndpointConnectionName, + properties + ); + console.log(result); +} + +privateEndpointConnectionsCreate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateEndpointConnectionsDelete.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateEndpointConnectionsDelete.ts new file mode 100644 index 00000000000..ba8ac4c71a1 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateEndpointConnectionsDelete.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Deletes the specified private endpoint connection associated with the storage sync service. + * + * @summary Deletes the specified private endpoint connection associated with the storage sync service. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_Delete.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function privateEndpointConnectionsDelete() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const storageSyncServiceName = "sss2527"; + const privateEndpointConnectionName = "{privateEndpointConnectionName}"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.privateEndpointConnections.beginDeleteAndWait( + resourceGroupName, + storageSyncServiceName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionsDelete().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateEndpointConnectionsGet.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateEndpointConnectionsGet.ts new file mode 100644 index 00000000000..20f2a900e95 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateEndpointConnectionsGet.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets the specified private endpoint connection associated with the storage sync service. + * + * @summary Gets the specified private endpoint connection associated with the storage sync service. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_Get.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function privateEndpointConnectionsGet() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const storageSyncServiceName = "sss2527"; + const privateEndpointConnectionName = "{privateEndpointConnectionName}"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.privateEndpointConnections.get( + resourceGroupName, + storageSyncServiceName, + privateEndpointConnectionName + ); + console.log(result); +} + +privateEndpointConnectionsGet().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateEndpointConnectionsListByStorageSyncService.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateEndpointConnectionsListByStorageSyncService.ts new file mode 100644 index 00000000000..aef5703b610 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateEndpointConnectionsListByStorageSyncService.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a PrivateEndpointConnection List. + * + * @summary Get a PrivateEndpointConnection List. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateEndpointConnections_ListByStorageSyncService.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function privateEndpointConnectionsListByStorageSyncService() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const storageSyncServiceName = "sss2527"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.privateEndpointConnections.listByStorageSyncService( + resourceGroupName, + storageSyncServiceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +privateEndpointConnectionsListByStorageSyncService().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateLinkResourcesList.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateLinkResourcesList.ts new file mode 100644 index 00000000000..735fda0124c --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/privateLinkResourcesList.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Gets the private link resources that need to be created for a storage sync service. + * + * @summary Gets the private link resources that need to be created for a storage sync service. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/PrivateLinkResources_List.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function privateLinkResourcesList() { + const subscriptionId = "{subscription-id}"; + const resourceGroupName = "res6977"; + const storageSyncServiceName = "sss2527"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.privateLinkResources.listByStorageSyncService( + resourceGroupName, + storageSyncServiceName + ); + console.log(result); +} + +privateLinkResourcesList().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersCreate.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersCreate.ts new file mode 100644 index 00000000000..e7b58b7d573 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersCreate.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Add a new registered server. + * + * @summary Add a new registered server. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_Create.json + */ +import { + RegisteredServerCreateParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function registeredServersCreate() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const serverId = "080d4133-bdb5-40a0-96a0-71a6057bfe9a"; + const parameters: RegisteredServerCreateParameters = { + agentVersion: "1.0.277.0", + friendlyName: "afscv-2304-139", + serverCertificate: + "MIIDFjCCAf6gAwIBAgIQQS+DS8uhc4VNzUkTw7wbRjANBgkqhkiG9w0BAQ0FADAzMTEwLwYDVQQDEyhhbmt1c2hiLXByb2QzLnJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29tMB4XDTE3MDgwMzE3MDQyNFoXDTE4MDgwNDE3MDQyNFowMzExMC8GA1UEAxMoYW5rdXNoYi1wcm9kMy5yZWRtb25kLmNvcnAubWljcm9zb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALDRvV4gmsIy6jGDPiHsXmvgVP749NNP7DopdlbHaNhjFmYINHl0uWylyaZmgJrROt2mnxN/zEyJtGnqYHlzUr4xvGq/qV5pqgdB9tag/sw9i22gfe9PRZ0FmSOZnXMbLYgLiDFqLtut5gHcOuWMj03YnkfoBEKlFBxWbagvW2yxz/Sxi9OVSJOKCaXra0RpcIHrO/KFl6ho2eE1/7Ykmfa8hZvSdoPd5gHdLiQcMB/pxq+mWp1fI6c8vFZoDu7Atn+NXTzYPKUxKzaisF12TsaKpohUsJpbB3Wocb0F5frn614D2pg14ERB5otjAMWw1m65csQWPI6dP8KIYe0+QPkCAwEAAaMmMCQwIgYDVR0lAQH/BBgwFgYIKwYBBQUHAwIGCisGAQQBgjcKAwwwDQYJKoZIhvcNAQENBQADggEBAA4RhVIBkw34M1RwakJgHvtjsOFxF1tVQA941NtLokx1l2Z8+GFQkcG4xpZSt+UN6wLerdCbnNhtkCErWUDeaT0jxk4g71Ofex7iM04crT4iHJr8mi96/XnhnkTUs+GDk12VgdeeNEczMZz+8Mxw9dJ5NCnYgTwO0SzGlclRsDvjzkLo8rh2ZG6n/jKrEyNXXo+hOqhupij0QbRP2Tvexdfw201kgN1jdZify8XzJ8Oi0bTS0KpJf2pNPOlooK2bjMUei9ANtEdXwwfVZGWvVh6tJjdv6k14wWWJ1L7zhA1IIVb1J+sQUzJji5iX0DrezjTz1Fg+gAzITaA/WsuujlM=", + serverId: "080d4133-bdb5-40a0-96a0-71a6057bfe9a", + serverOSVersion: "10.0.14393.0", + serverRole: "Standalone" + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.registeredServers.beginCreateAndWait( + resourceGroupName, + storageSyncServiceName, + serverId, + parameters + ); + console.log(result); +} + +registeredServersCreate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersDelete.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersDelete.ts new file mode 100644 index 00000000000..2bac1a0b56e --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersDelete.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Delete the given registered server. + * + * @summary Delete the given registered server. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_Delete.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function registeredServersDelete() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const serverId = "41166691-ab03-43e9-ab3e-0330eda162ac"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.registeredServers.beginDeleteAndWait( + resourceGroupName, + storageSyncServiceName, + serverId + ); + console.log(result); +} + +registeredServersDelete().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersGet.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersGet.ts new file mode 100644 index 00000000000..9bd199db1cc --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersGet.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a given registered server. + * + * @summary Get a given registered server. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_Get.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function registeredServersGet() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const serverId = "080d4133-bdb5-40a0-96a0-71a6057bfe9a"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.registeredServers.get( + resourceGroupName, + storageSyncServiceName, + serverId + ); + console.log(result); +} + +registeredServersGet().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersListByStorageSyncService.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersListByStorageSyncService.ts new file mode 100644 index 00000000000..389b865540d --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersListByStorageSyncService.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a given registered server list. + * + * @summary Get a given registered server list. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_ListByStorageSyncService.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function registeredServersListByStorageSyncService() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.registeredServers.listByStorageSyncService( + resourceGroupName, + storageSyncServiceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +registeredServersListByStorageSyncService().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersTriggerRollover.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersTriggerRollover.ts new file mode 100644 index 00000000000..a88270a38a7 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/registeredServersTriggerRollover.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Triggers Server certificate rollover. + * + * @summary Triggers Server certificate rollover. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/RegisteredServers_TriggerRollover.json + */ +import { + TriggerRolloverRequest, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function registeredServersTriggerRollover() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const serverId = "d166ca76-dad2-49df-b409-12345642d730"; + const parameters: TriggerRolloverRequest = { + serverCertificate: + '"MIIDFjCCAf6gAwIBAgIQQS+DS8uhc4VNzUkTw7wbRjANBgkqhkiG9w0BAQ0FADAzMTEwLwYDVQQDEyhhbmt1c2hiLXByb2QzLnJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29tMB4XDTE3MDgwMzE3MDQyNFoXDTE4MDgwNDE3MDQyNFowMzExMC8GA1UEAxMoYW5rdXNoYi1wcm9kMy5yZWRtb25kLmNvcnAubWljcm9zb2Z0LmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALDRvV4gmsIy6jGDPiHsXmvgVP749NNP7DopdlbHaNhjFmYINHl0uWylyaZmgJrROt2mnxN/zEyJtGnqYHlzUr4xvGq/qV5pqgdB9tag/sw9i22gfe9PRZ0FmSOZnXMbLYgLiDFqLtut5gHcOuWMj03YnkfoBEKlFBxWbagvW2yxz/Sxi9OVSJOKCaXra0RpcIHrO/KFl6ho2eE1/7Ykmfa8hZvSdoPd5gHdLiQcMB/pxq+mWp1fI6c8vFZoDu7Atn+NXTzYPKUxKzaisF12TsaKpohUsJpbB3Wocb0F5frn614D2pg14ERB5otjAMWw1m65csQWPI6dP8KIYe0+QPkCAwEAAaMmMCQwIgYDVR0lAQH/BBgwFgYIKwYBBQUHAwIGCisGAQQBgjcKAwwwDQYJKoZIhvcNAQENBQADggEBAA4RhVIBkw34M1RwakJgHvtjsOFxF1tVQA941NtLokx1l2Z8+GFQkcG4xpZSt+UN6wLerdCbnNhtkCErWUDeaT0jxk4g71Ofex7iM04crT4iHJr8mi96/XnhnkTUs+GDk12VgdeeNEczMZz+8Mxw9dJ5NCnYgTwO0SzGlclRsDvjzkLo8rh2ZG6n/jKrEyNXXo+hOqhupij0QbRP2Tvexdfw201kgN1jdZify8XzJ8Oi0bTS0KpJf2pNPOlooK2bjMUei9ANtEdXwwfVZGWvVh6tJjdv6k14wWWJ1L7zhA1IIVb1J+sQUzJji5iX0DrezjTz1Fg+gAzITaA/WsuujlM="' + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.registeredServers.beginTriggerRolloverAndWait( + resourceGroupName, + storageSyncServiceName, + serverId, + parameters + ); + console.log(result); +} + +registeredServersTriggerRollover().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsCreate.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsCreate.ts new file mode 100644 index 00000000000..b837260d78f --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsCreate.ts @@ -0,0 +1,54 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create a new ServerEndpoint. + * + * @summary Create a new ServerEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Create.json + */ +import { + ServerEndpointCreateParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function serverEndpointsCreate() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const serverEndpointName = "SampleServerEndpoint_1"; + const parameters: ServerEndpointCreateParameters = { + cloudTiering: "off", + initialDownloadPolicy: "NamespaceThenModifiedFiles", + initialUploadPolicy: "ServerAuthoritative", + localCacheMode: "UpdateLocallyCachedFiles", + offlineDataTransfer: "on", + offlineDataTransferShareName: "myfileshare", + serverLocalPath: "D:SampleServerEndpoint_1", + serverResourceId: + "/subscriptions/52b8da2f-61e0-4a1f-8dde-336911f367fb/resourceGroups/SampleResourceGroup_1/providers/Microsoft.StorageSync/storageSyncServices/SampleStorageSyncService_1/registeredServers/080d4133-bdb5-40a0-96a0-71a6057bfe9a", + tierFilesOlderThanDays: 0, + volumeFreeSpacePercent: 100 + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.serverEndpoints.beginCreateAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName, + parameters + ); + console.log(result); +} + +serverEndpointsCreate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsDelete.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsDelete.ts new file mode 100644 index 00000000000..2aa8df65bbb --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsDelete.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Delete a given ServerEndpoint. + * + * @summary Delete a given ServerEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Delete.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function serverEndpointsDelete() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const serverEndpointName = "SampleServerEndpoint_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.serverEndpoints.beginDeleteAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName + ); + console.log(result); +} + +serverEndpointsDelete().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsGet.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsGet.ts new file mode 100644 index 00000000000..5d7ba180c2f --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsGet.ts @@ -0,0 +1,37 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a ServerEndpoint. + * + * @summary Get a ServerEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Get.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function serverEndpointsGet() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const serverEndpointName = "SampleServerEndpoint_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.serverEndpoints.get( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName + ); + console.log(result); +} + +serverEndpointsGet().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsListBySyncGroup.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsListBySyncGroup.ts new file mode 100644 index 00000000000..bee400e2421 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsListBySyncGroup.ts @@ -0,0 +1,38 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a ServerEndpoint list. + * + * @summary Get a ServerEndpoint list. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_ListBySyncGroup.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function serverEndpointsListBySyncGroup() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.serverEndpoints.listBySyncGroup( + resourceGroupName, + storageSyncServiceName, + syncGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +serverEndpointsListBySyncGroup().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsRecallAction.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsRecallAction.ts new file mode 100644 index 00000000000..0450434cb45 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsRecallAction.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Recall a server endpoint. + * + * @summary Recall a server endpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Recall.json + */ +import { + RecallActionParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function serverEndpointsRecallAction() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const serverEndpointName = "SampleServerEndpoint_1"; + const parameters: RecallActionParameters = { pattern: "", recallPath: "" }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.serverEndpoints.beginRecallActionAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName, + parameters + ); + console.log(result); +} + +serverEndpointsRecallAction().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsUpdate.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsUpdate.ts new file mode 100644 index 00000000000..a8f56fae86d --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/serverEndpointsUpdate.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Patch a given ServerEndpoint. + * + * @summary Patch a given ServerEndpoint. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/ServerEndpoints_Update.json + */ +import { + ServerEndpointUpdateParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function serverEndpointsUpdate() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const serverEndpointName = "SampleServerEndpoint_1"; + const parameters: ServerEndpointUpdateParameters = { + cloudTiering: "off", + localCacheMode: "UpdateLocallyCachedFiles", + offlineDataTransfer: "off", + tierFilesOlderThanDays: 0, + volumeFreeSpacePercent: 100 + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.serverEndpoints.beginUpdateAndWait( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName, + options + ); + console.log(result); +} + +serverEndpointsUpdate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServiceCheckNameAvailabilityAlreadyExists.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServiceCheckNameAvailabilityAlreadyExists.ts new file mode 100644 index 00000000000..c0d880381ea --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServiceCheckNameAvailabilityAlreadyExists.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Check the give namespace name availability. + * + * @summary Check the give namespace name availability. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServiceCheckNameAvailability_AlreadyExists.json + */ +import { + CheckNameAvailabilityParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageSyncServiceCheckNameAvailabilityAlreadyExists() { + const subscriptionId = "5c6bc8e1-1eaf-4192-94d8-58ce463ac86c"; + const locationName = "westus"; + const parameters: CheckNameAvailabilityParameters = { + name: "newstoragesyncservicename", + type: "Microsoft.StorageSync/storageSyncServices" + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.storageSyncServices.checkNameAvailability( + locationName, + parameters + ); + console.log(result); +} + +storageSyncServiceCheckNameAvailabilityAlreadyExists().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServiceCheckNameAvailabilityAvailable.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServiceCheckNameAvailabilityAvailable.ts new file mode 100644 index 00000000000..f5db1e22dde --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServiceCheckNameAvailabilityAvailable.ts @@ -0,0 +1,39 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Check the give namespace name availability. + * + * @summary Check the give namespace name availability. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServiceCheckNameAvailability_Available.json + */ +import { + CheckNameAvailabilityParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageSyncServiceCheckNameAvailabilityAvailable() { + const subscriptionId = "5c6bc8e1-1eaf-4192-94d8-58ce463ac86c"; + const locationName = "westus"; + const parameters: CheckNameAvailabilityParameters = { + name: "newstoragesyncservicename", + type: "Microsoft.StorageSync/storageSyncServices" + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.storageSyncServices.checkNameAvailability( + locationName, + parameters + ); + console.log(result); +} + +storageSyncServiceCheckNameAvailabilityAvailable().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesCreate.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesCreate.ts new file mode 100644 index 00000000000..50e30bbddfb --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesCreate.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create a new StorageSyncService. + * + * @summary Create a new StorageSyncService. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Create.json + */ +import { + StorageSyncServiceCreateParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageSyncServicesCreate() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const parameters: StorageSyncServiceCreateParameters = { + incomingTrafficPolicy: "AllowAllTraffic", + location: "WestUS", + tags: {} + }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.storageSyncServices.beginCreateAndWait( + resourceGroupName, + storageSyncServiceName, + parameters + ); + console.log(result); +} + +storageSyncServicesCreate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesDelete.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesDelete.ts new file mode 100644 index 00000000000..bed48d4cf78 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesDelete.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Delete a given StorageSyncService. + * + * @summary Delete a given StorageSyncService. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Delete.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageSyncServicesDelete() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.storageSyncServices.beginDeleteAndWait( + resourceGroupName, + storageSyncServiceName + ); + console.log(result); +} + +storageSyncServicesDelete().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesGet.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesGet.ts new file mode 100644 index 00000000000..6d67097b800 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesGet.ts @@ -0,0 +1,33 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a given StorageSyncService. + * + * @summary Get a given StorageSyncService. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Get.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageSyncServicesGet() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.storageSyncServices.get( + resourceGroupName, + storageSyncServiceName + ); + console.log(result); +} + +storageSyncServicesGet().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesListByResourceGroup.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesListByResourceGroup.ts new file mode 100644 index 00000000000..422f6d5e3c7 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesListByResourceGroup.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a StorageSyncService list by Resource group name. + * + * @summary Get a StorageSyncService list by Resource group name. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_ListByResourceGroup.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageSyncServicesListByResourceGroup() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageSyncServices.listByResourceGroup( + resourceGroupName + )) { + resArray.push(item); + } + console.log(resArray); +} + +storageSyncServicesListByResourceGroup().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesListBySubscription.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesListBySubscription.ts new file mode 100644 index 00000000000..7ed699587bf --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesListBySubscription.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a StorageSyncService list by subscription. + * + * @summary Get a StorageSyncService list by subscription. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_ListBySubscription.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageSyncServicesListBySubscription() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.storageSyncServices.listBySubscription()) { + resArray.push(item); + } + console.log(resArray); +} + +storageSyncServicesListBySubscription().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesUpdate.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesUpdate.ts new file mode 100644 index 00000000000..63c7c6902d2 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/storageSyncServicesUpdate.ts @@ -0,0 +1,42 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Patch a given StorageSyncService. + * + * @summary Patch a given StorageSyncService. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/StorageSyncServices_Update.json + */ +import { + StorageSyncServiceUpdateParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function storageSyncServicesUpdate() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const parameters: StorageSyncServiceUpdateParameters = { + incomingTrafficPolicy: "AllowAllTraffic", + tags: { dept: "IT", environment: "Test" } + }; + const options = { parameters: parameters }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.storageSyncServices.beginUpdateAndWait( + resourceGroupName, + storageSyncServiceName, + options + ); + console.log(result); +} + +storageSyncServicesUpdate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/syncGroupsCreate.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/syncGroupsCreate.ts new file mode 100644 index 00000000000..aa219fc2f39 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/syncGroupsCreate.ts @@ -0,0 +1,40 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Create a new SyncGroup. + * + * @summary Create a new SyncGroup. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_Create.json + */ +import { + SyncGroupCreateParameters, + MicrosoftStorageSync +} from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function syncGroupsCreate() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const parameters: SyncGroupCreateParameters = { properties: {} }; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.syncGroups.create( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + parameters + ); + console.log(result); +} + +syncGroupsCreate().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/syncGroupsDelete.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/syncGroupsDelete.ts new file mode 100644 index 00000000000..3c0a1e06b4b --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/syncGroupsDelete.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Delete a given SyncGroup. + * + * @summary Delete a given SyncGroup. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_Delete.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function syncGroupsDelete() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.syncGroups.delete( + resourceGroupName, + storageSyncServiceName, + syncGroupName + ); + console.log(result); +} + +syncGroupsDelete().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/syncGroupsGet.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/syncGroupsGet.ts new file mode 100644 index 00000000000..9e93fb1468d --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/syncGroupsGet.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a given SyncGroup. + * + * @summary Get a given SyncGroup. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_Get.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function syncGroupsGet() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const syncGroupName = "SampleSyncGroup_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.syncGroups.get( + resourceGroupName, + storageSyncServiceName, + syncGroupName + ); + console.log(result); +} + +syncGroupsGet().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/syncGroupsListByStorageSyncService.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/syncGroupsListByStorageSyncService.ts new file mode 100644 index 00000000000..d44c5cc8781 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/syncGroupsListByStorageSyncService.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a SyncGroup List. + * + * @summary Get a SyncGroup List. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/SyncGroups_ListByStorageSyncService.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function syncGroupsListByStorageSyncService() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.syncGroups.listByStorageSyncService( + resourceGroupName, + storageSyncServiceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +syncGroupsListByStorageSyncService().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/workflowsAbort.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/workflowsAbort.ts new file mode 100644 index 00000000000..374b3c1d9d7 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/workflowsAbort.ts @@ -0,0 +1,35 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Abort the given workflow. + * + * @summary Abort the given workflow. + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/Workflows_Abort.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function workflowsAbort() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const workflowId = "7ffd50b3-5574-478d-9ff2-9371bc42ce68"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.workflows.abort( + resourceGroupName, + storageSyncServiceName, + workflowId + ); + console.log(result); +} + +workflowsAbort().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/workflowsGet.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/workflowsGet.ts new file mode 100644 index 00000000000..6cee5e64de3 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/workflowsGet.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get Operation status + * + * @summary Get Operation status + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/LocationOperationStatus_Get.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function workflowsGet() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const locationName = "westus"; + const operationId = + "eyJwYXJ0aXRpb25JZCI6ImE1ZDNiMDU4LTYwN2MtNDI0Ny05Y2FmLWJlZmU4NGQ0ZDU0NyIsIndvcmtmbG93SWQiOiJjYzg1MTY2YS0xMjI2LTQ4MGYtYWM5ZC1jMmRhNTVmY2M2ODYiLCJ3b3JrZmxvd09wZXJhdGlvbklkIjoiOTdmODU5ZTAtOGY1MC00ZTg4LWJkZDEtNWZlYzgwYTVlYzM0tui="; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const result = await client.locationOperationStatus( + locationName, + operationId + ); + console.log(result); +} + +workflowsGet().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/workflowsListByStorageSyncService.ts b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/workflowsListByStorageSyncService.ts new file mode 100644 index 00000000000..8e750cf9b46 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/src/workflowsListByStorageSyncService.ts @@ -0,0 +1,36 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * This sample demonstrates how to Get a Workflow List + * + * @summary Get a Workflow List + * x-ms-original-file: specification/storagesync/resource-manager/Microsoft.StorageSync/stable/2020-09-01/examples/Workflows_ListByStorageSyncService.json + */ +import { MicrosoftStorageSync } from "@azure/arm-storagesync"; +import { DefaultAzureCredential } from "@azure/identity"; + +async function workflowsListByStorageSyncService() { + const subscriptionId = "52b8da2f-61e0-4a1f-8dde-336911f367fb"; + const resourceGroupName = "SampleResourceGroup_1"; + const storageSyncServiceName = "SampleStorageSyncService_1"; + const credential = new DefaultAzureCredential(); + const client = new MicrosoftStorageSync(credential, subscriptionId); + const resArray = new Array(); + for await (let item of client.workflows.listByStorageSyncService( + resourceGroupName, + storageSyncServiceName + )) { + resArray.push(item); + } + console.log(resArray); +} + +workflowsListByStorageSyncService().catch(console.error); diff --git a/sdk/storagesync/arm-storagesync/samples/v9/typescript/tsconfig.json b/sdk/storagesync/arm-storagesync/samples/v9/typescript/tsconfig.json new file mode 100644 index 00000000000..416c2dd82e0 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/samples/v9/typescript/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "target": "ES2018", + "module": "commonjs", + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strict": true, + "alwaysStrict": true, + "outDir": "dist", + "rootDir": "src" + }, + "include": [ + "src/**.ts" + ] +} diff --git a/sdk/storagesync/arm-storagesync/src/index.ts b/sdk/storagesync/arm-storagesync/src/index.ts new file mode 100644 index 00000000000..a1f87ce2018 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/src/index.ts @@ -0,0 +1,12 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +/// +export * from "./models"; +export { MicrosoftStorageSync } from "./microsoftStorageSync"; +export * from "./operationsInterfaces"; diff --git a/sdk/storagesync/arm-storagesync/src/lroImpl.ts b/sdk/storagesync/arm-storagesync/src/lroImpl.ts new file mode 100644 index 00000000000..518d5f053b4 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/src/lroImpl.ts @@ -0,0 +1,34 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { LongRunningOperation, LroResponse } from "@azure/core-lro"; + +export class LroImpl implements LongRunningOperation { + constructor( + private sendOperationFn: (args: any, spec: any) => Promise>, + private args: Record, + private spec: { + readonly requestBody?: unknown; + readonly path?: string; + readonly httpMethod: string; + } & Record, + public requestPath: string = spec.path!, + public requestMethod: string = spec.httpMethod + ) {} + public async sendInitialRequest(): Promise> { + return this.sendOperationFn(this.args, this.spec); + } + public async sendPollRequest(path: string): Promise> { + const { requestBody, ...restSpec } = this.spec; + return this.sendOperationFn(this.args, { + ...restSpec, + path, + httpMethod: "GET" + }); + } +} diff --git a/sdk/storagesync/arm-storagesync/src/microsoftStorageSync.ts b/sdk/storagesync/arm-storagesync/src/microsoftStorageSync.ts new file mode 100644 index 00000000000..9d9400ab30a --- /dev/null +++ b/sdk/storagesync/arm-storagesync/src/microsoftStorageSync.ts @@ -0,0 +1,164 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import * as coreClient from "@azure/core-client"; +import * as coreAuth from "@azure/core-auth"; +import { + OperationsImpl, + StorageSyncServicesImpl, + PrivateLinkResourcesImpl, + PrivateEndpointConnectionsImpl, + SyncGroupsImpl, + CloudEndpointsImpl, + ServerEndpointsImpl, + RegisteredServersImpl, + WorkflowsImpl, + OperationStatusOperationsImpl +} from "./operations"; +import { + Operations, + StorageSyncServices, + PrivateLinkResources, + PrivateEndpointConnections, + SyncGroups, + CloudEndpoints, + ServerEndpoints, + RegisteredServers, + Workflows, + OperationStatusOperations +} from "./operationsInterfaces"; +import * as Parameters from "./models/parameters"; +import * as Mappers from "./models/mappers"; +import { + MicrosoftStorageSyncOptionalParams, + LocationOperationStatusOptionalParams, + LocationOperationStatusResponse +} from "./models"; + +export class MicrosoftStorageSync extends coreClient.ServiceClient { + $host: string; + apiVersion: string; + subscriptionId: string; + + /** + * Initializes a new instance of the MicrosoftStorageSync class. + * @param credentials Subscription credentials which uniquely identify client subscription. + * @param subscriptionId The ID of the target subscription. + * @param options The parameter options + */ + constructor( + credentials: coreAuth.TokenCredential, + subscriptionId: string, + options?: MicrosoftStorageSyncOptionalParams + ) { + if (credentials === undefined) { + throw new Error("'credentials' cannot be null"); + } + if (subscriptionId === undefined) { + throw new Error("'subscriptionId' cannot be null"); + } + + // Initializing default values for options + if (!options) { + options = {}; + } + const defaults: MicrosoftStorageSyncOptionalParams = { + requestContentType: "application/json; charset=utf-8", + credential: credentials + }; + + const packageDetails = `azsdk-js-arm-storagesync/9.0.0`; + const userAgentPrefix = + options.userAgentOptions && options.userAgentOptions.userAgentPrefix + ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}` + : `${packageDetails}`; + + if (!options.credentialScopes) { + options.credentialScopes = ["https://management.azure.com/.default"]; + } + const optionsWithDefaults = { + ...defaults, + ...options, + userAgentOptions: { + userAgentPrefix + }, + baseUri: options.endpoint || "https://management.azure.com" + }; + super(optionsWithDefaults); + // Parameter assignments + this.subscriptionId = subscriptionId; + + // Assigning values to Constant parameters + this.$host = options.$host || "https://management.azure.com"; + this.apiVersion = options.apiVersion || "2020-09-01"; + this.operations = new OperationsImpl(this); + this.storageSyncServices = new StorageSyncServicesImpl(this); + this.privateLinkResources = new PrivateLinkResourcesImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsImpl(this); + this.syncGroups = new SyncGroupsImpl(this); + this.cloudEndpoints = new CloudEndpointsImpl(this); + this.serverEndpoints = new ServerEndpointsImpl(this); + this.registeredServers = new RegisteredServersImpl(this); + this.workflows = new WorkflowsImpl(this); + this.operationStatusOperations = new OperationStatusOperationsImpl(this); + } + + /** + * Get Operation status + * @param locationName The desired region to obtain information from. + * @param operationId operation Id + * @param options The options parameters. + */ + locationOperationStatus( + locationName: string, + operationId: string, + options?: LocationOperationStatusOptionalParams + ): Promise { + return this.sendOperationRequest( + { locationName, operationId, options }, + locationOperationStatusOperationSpec + ); + } + + operations: Operations; + storageSyncServices: StorageSyncServices; + privateLinkResources: PrivateLinkResources; + privateEndpointConnections: PrivateEndpointConnections; + syncGroups: SyncGroups; + cloudEndpoints: CloudEndpoints; + serverEndpoints: ServerEndpoints; + registeredServers: RegisteredServers; + workflows: Workflows; + operationStatusOperations: OperationStatusOperations; +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const locationOperationStatusOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/operations/{operationId}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.LocationOperationStatus, + headersMapper: Mappers.MicrosoftStorageSyncLocationOperationStatusHeaders + }, + default: { + bodyMapper: Mappers.StorageSyncError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.locationName, + Parameters.subscriptionId, + Parameters.operationId + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/storagesync/arm-storagesync/src/models/cloudEndpointsMappers.ts b/sdk/storagesync/arm-storagesync/src/models/cloudEndpointsMappers.ts deleted file mode 100644 index aad2b506cb6..00000000000 --- a/sdk/storagesync/arm-storagesync/src/models/cloudEndpointsMappers.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - AzureEntityResource, - BackupRequest, - BaseResource, - CloudEndpoint, - CloudEndpointArray, - CloudEndpointCreateParameters, - CloudEndpointsCreateHeaders, - CloudEndpointsDeleteHeaders, - CloudEndpointsGetHeaders, - CloudEndpointsListBySyncGroupHeaders, - CloudEndpointsPostBackupHeaders, - CloudEndpointsPostRestoreHeaders, - CloudEndpointsPreBackupHeaders, - CloudEndpointsPreRestoreHeaders, - CloudEndpointsRestoreheartbeatHeaders, - CloudEndpointsTriggerChangeDetectionHeaders, - PostBackupResponse, - PostRestoreRequest, - PreRestoreRequest, - ProxyResource, - RegisteredServer, - RegisteredServerCreateParameters, - Resource, - RestoreFileSpec, - ServerEndpoint, - ServerEndpointCloudTieringStatus, - ServerEndpointCreateParameters, - ServerEndpointFilesNotSyncingError, - ServerEndpointRecallError, - ServerEndpointRecallStatus, - ServerEndpointSyncActivityStatus, - ServerEndpointSyncSessionStatus, - ServerEndpointSyncStatus, - StorageSyncApiError, - StorageSyncError, - StorageSyncErrorDetails, - StorageSyncService, - SyncGroup, - SyncGroupCreateParameters, - TrackedResource, - TriggerChangeDetectionParameters, - Workflow -} from "../models/mappers"; diff --git a/sdk/storagesync/arm-storagesync/src/models/index.ts b/sdk/storagesync/arm-storagesync/src/models/index.ts index b58aba1f343..2034b7be0e7 100644 --- a/sdk/storagesync/arm-storagesync/src/models/index.ts +++ b/sdk/storagesync/arm-storagesync/src/models/index.ts @@ -1,2700 +1,2483 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { BaseResource, CloudError, AzureServiceClientOptions } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export { BaseResource, CloudError }; - -/** - * Error Details object. - */ -export interface StorageSyncErrorDetails { - /** - * Error code of the given entry. - */ - code?: string; - /** - * Error message of the given entry. - */ - message?: string; - /** - * Target of the given entry. - */ - target?: string; +/** The list of storage sync operations. */ +export interface OperationEntityListResult { + /** The link used to get the next page of operations. */ + nextLink?: string; + /** The list of operations. */ + value?: OperationEntity[]; } -/** - * Error type - */ -export interface StorageSyncApiError { - /** - * Error code of the given entry. - */ - code?: string; - /** - * Error message of the given entry. - */ - message?: string; - /** - * Target of the given error entry. - */ - target?: string; - /** - * Error details of the given entry. - */ - details?: StorageSyncErrorDetails; +/** The operation supported by storage sync. */ +export interface OperationEntity { + /** Operation name: {provider}/{resource}/{operation}. */ + name?: string; + /** The operation supported by storage sync. */ + display?: OperationDisplayInfo; + /** The origin. */ + origin?: string; + /** Properties of the operations resource. */ + properties?: OperationProperties; } -/** - * Error type - */ +/** The operation supported by storage sync. */ +export interface OperationDisplayInfo { + /** The description of the operation. */ + description?: string; + /** The action that users can perform, based on their permission level. */ + operation?: string; + /** Service provider: Microsoft StorageSync. */ + provider?: string; + /** Resource on which the operation is performed. */ + resource?: string; +} + +/** Properties of the operations resource. */ +export interface OperationProperties { + /** Service specification for the operations resource. */ + serviceSpecification?: OperationResourceServiceSpecification; +} + +/** Service specification. */ +export interface OperationResourceServiceSpecification { + /** List of metric specifications. */ + metricSpecifications?: OperationResourceMetricSpecification[]; +} + +/** Operation Display Resource object. */ +export interface OperationResourceMetricSpecification { + /** Name of the metric. */ + name?: string; + /** Display name for the metric. */ + displayName?: string; + /** Display description for the metric. */ + displayDescription?: string; + /** Unit for the metric. */ + unit?: string; + /** Aggregation type for the metric. */ + aggregationType?: string; + /** Fill gaps in the metric with zero. */ + fillGapWithZero?: boolean; + /** Dimensions for the metric specification. */ + dimensions?: OperationResourceMetricSpecificationDimension[]; +} + +/** OperationResourceMetricSpecificationDimension object. */ +export interface OperationResourceMetricSpecificationDimension { + /** Name of the dimension. */ + name?: string; + /** Display name of the dimensions. */ + displayName?: string; + /** Indicates metric should be exported for Shoebox. */ + toBeExportedForShoebox?: boolean; +} + +/** Error type */ export interface StorageSyncError { - /** - * Error details of the given entry. - */ + /** Error details of the given entry. */ error?: StorageSyncApiError; - /** - * Error details of the given entry. - */ + /** Error details of the given entry. */ innererror?: StorageSyncApiError; } -/** - * Subscription State object. - */ -export interface SubscriptionState { - /** - * State of Azure Subscription. Possible values include: 'Registered', 'Unregistered', 'Warned', - * 'Suspended', 'Deleted' - */ - state?: Reason; - /** - * Is Transitioning - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly istransitioning?: boolean; - /** - * Subscription state properties. - */ - properties?: any; +/** Error type */ +export interface StorageSyncApiError { + /** Error code of the given entry. */ + code?: string; + /** Error message of the given entry. */ + message?: string; + /** Target of the given error entry. */ + target?: string; + /** Error details of the given entry. */ + details?: StorageSyncErrorDetails; + /** Inner error details of the given entry. */ + innerError?: StorageSyncInnerErrorDetails; } -/** - * An interface representing Resource. - */ -export interface Resource extends BaseResource { - /** - * Fully qualified resource Id for the resource. Ex - - * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly id?: string; - /** - * The name of the resource - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly name?: string; - /** - * The type of the resource. Ex- Microsoft.Compute/virtualMachines or - * Microsoft.Storage/storageAccounts. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly type?: string; +/** Error Details object. */ +export interface StorageSyncErrorDetails { + /** Error code of the given entry. */ + code?: string; + /** Error message of the given entry. */ + message?: string; + /** Target of the given entry. */ + target?: string; + /** Request URI of the given entry. */ + requestUri?: string; + /** Exception type of the given entry. */ + exceptionType?: string; + /** HTTP method of the given entry. */ + httpMethod?: string; + /** Hashed message of the given entry. */ + hashedMessage?: string; + /** HTTP error code of the given entry. */ + httpErrorCode?: string; } -/** - * The resource model definition for a ARM tracked top level resource - */ -export interface TrackedResource extends Resource { - /** - * Resource tags. - */ - tags?: { [propertyName: string]: string }; - /** - * The geo-location where the resource lives - */ - location: string; +/** Error Details object. */ +export interface StorageSyncInnerErrorDetails { + /** Call stack of the error. */ + callStack?: string; + /** Error message of the error. */ + message?: string; + /** Exception of the inner error. */ + innerException?: string; + /** Call stack of the inner error. */ + innerExceptionCallStack?: string; } -/** - * Storage Sync Service object. - */ -export interface StorageSyncService extends TrackedResource { - /** - * Storage Sync service status. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly storageSyncServiceStatus?: number; - /** - * Storage Sync service Uid - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly storageSyncServiceUid?: string; -} - -/** - * The resource model definition for a ARM proxy resource. It will have everything other than - * required location and tags - */ -export interface ProxyResource extends Resource { -} - -/** - * Sync Group object. - */ -export interface SyncGroup extends ProxyResource { - /** - * Unique Id - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly uniqueId?: string; - /** - * Sync group status - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly syncGroupStatus?: string; -} - -/** - * Cloud Endpoint object. - */ -export interface CloudEndpoint extends ProxyResource { - /** - * Storage Account Resource Id - */ - storageAccountResourceId?: string; - /** - * Azure file share name - */ - azureFileShareName?: string; - /** - * Storage Account Tenant Id - */ - storageAccountTenantId?: string; - /** - * Partnership Id - */ - partnershipId?: string; - /** - * Friendly Name - */ - friendlyName?: string; - /** - * Backup Enabled - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly backupEnabled?: string; - /** - * CloudEndpoint Provisioning State - */ - provisioningState?: string; - /** - * CloudEndpoint lastWorkflowId - */ - lastWorkflowId?: string; - /** - * Resource Last Operation Name - */ - lastOperationName?: string; -} - -/** - * The parameters used when calling trigger change detection action on cloud endpoint. - */ -export interface TriggerChangeDetectionParameters { - /** - * Relative path to a directory Azure File share for which change detection is to be performed. - */ - directoryPath?: string; - /** - * Change Detection Mode. Applies to a directory specified in directoryPath parameter. Possible - * values include: 'Default', 'Recursive' - */ - changeDetectionMode?: ChangeDetectionMode; - /** - * Array of relative paths on the Azure File share to be included in the change detection. Can be - * files and directories. - */ - paths?: string[]; -} - -/** - * The parameters used when calling recall action on server endpoint. - */ -export interface RecallActionParameters { - /** - * Pattern of the files. - */ - pattern?: string; - /** - * Recall path. - */ - recallPath?: string; -} - -/** - * The parameters used when creating a storage sync service. - */ -export interface StorageSyncServiceCreateParameters { - /** - * Required. Gets or sets the location of the resource. This will be one of the supported and - * registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of - * a resource cannot be changed once it is created, but if an identical geo region is specified - * on update, the request will succeed. - */ - location: string; - /** - * Gets or sets a list of key value pairs that describe the resource. These tags can be used for - * viewing and grouping this resource (across resource groups). A maximum of 15 tags can be - * provided for a resource. Each tag must have a key with a length no greater than 128 characters - * and a value with a length no greater than 256 characters. - */ - tags?: { [propertyName: string]: string }; - properties?: any; -} - -/** - * The parameters used when creating a sync group. - */ -export interface SyncGroupCreateParameters extends ProxyResource { - /** - * The parameters used to create the sync group - */ - properties?: any; -} - -/** - * The parameters used when creating a cloud endpoint. - */ -export interface CloudEndpointCreateParameters extends ProxyResource { - /** - * Storage Account Resource Id - */ - storageAccountResourceId?: string; - /** - * Azure file share name - */ - azureFileShareName?: string; - /** - * Storage Account Tenant Id - */ - storageAccountTenantId?: string; - /** - * Friendly Name - */ - friendlyName?: string; -} - -/** - * The parameters used when creating a server endpoint. - */ -export interface ServerEndpointCreateParameters extends ProxyResource { - /** - * Server Local path. - */ - serverLocalPath?: string; - /** - * Cloud Tiering. Possible values include: 'on', 'off' - */ - cloudTiering?: CloudTiering; - /** - * Level of free space to be maintained by Cloud Tiering if it is enabled. - */ - volumeFreeSpacePercent?: number; - /** - * Tier files older than days. - */ - tierFilesOlderThanDays?: number; - /** - * Friendly Name - */ - friendlyName?: string; - /** - * Server Resource Id. - */ - serverResourceId?: string; - /** - * Offline data transfer. Possible values include: 'on', 'off' - */ - offlineDataTransfer?: OfflineDataTransfer; - /** - * Offline data transfer share name - */ - offlineDataTransferShareName?: string; -} - -/** - * Trigger Rollover Request. - */ -export interface TriggerRolloverRequest { - /** - * Certificate Data - */ - serverCertificate?: string; -} - -/** - * The parameters used when creating a registered server. - */ -export interface RegisteredServerCreateParameters extends ProxyResource { - /** - * Registered Server Certificate - */ - serverCertificate?: string; - /** - * Registered Server Agent Version - */ - agentVersion?: string; - /** - * Registered Server OS Version - */ - serverOSVersion?: string; - /** - * Registered Server last heart beat - */ - lastHeartBeat?: string; - /** - * Registered Server serverRole - */ - serverRole?: string; - /** - * Registered Server clusterId - */ - clusterId?: string; - /** - * Registered Server clusterName - */ - clusterName?: string; - /** - * Registered Server serverId - */ - serverId?: string; - /** - * Friendly Name - */ - friendlyName?: string; -} - -/** - * Parameters for updating an Server Endpoint. - */ -export interface ServerEndpointUpdateParameters { - /** - * Cloud Tiering. Possible values include: 'on', 'off' - */ - cloudTiering?: CloudTiering1; - /** - * Level of free space to be maintained by Cloud Tiering if it is enabled. - */ - volumeFreeSpacePercent?: number; - /** - * Tier files older than days. - */ - tierFilesOlderThanDays?: number; - /** - * Offline data transfer. Possible values include: 'on', 'off' - */ - offlineDataTransfer?: OfflineDataTransfer1; - /** - * Offline data transfer share name - */ - offlineDataTransferShareName?: string; -} - -/** - * Files not syncing error object - */ -export interface ServerEndpointFilesNotSyncingError { - /** - * Error code (HResult) - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly errorCode?: number; - /** - * Count of persistent files not syncing with the specified error code - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly persistentCount?: number; - /** - * Count of transient files not syncing with the specified error code - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly transientCount?: number; -} - -/** - * Sync Session status object. - */ -export interface ServerEndpointSyncSessionStatus { - /** - * Last sync result (HResult) - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly lastSyncResult?: number; - /** - * Last sync timestamp - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly lastSyncTimestamp?: Date; - /** - * Last sync success timestamp - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly lastSyncSuccessTimestamp?: Date; - /** - * Last sync per item error count. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly lastSyncPerItemErrorCount?: number; - /** - * Count of persistent files not syncing. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly persistentFilesNotSyncingCount?: number; - /** - * Count of transient files not syncing. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly transientFilesNotSyncingCount?: number; - /** - * Array of per-item errors coming from the last sync session. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly filesNotSyncingErrors?: ServerEndpointFilesNotSyncingError[]; -} - -/** - * Sync Session status object. - */ -export interface ServerEndpointSyncActivityStatus { - /** - * Timestamp when properties were updated - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly timestamp?: Date; - /** - * Per item error count - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly perItemErrorCount?: number; - /** - * Applied item count. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly appliedItemCount?: number; - /** - * Total item count (if available) - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly totalItemCount?: number; - /** - * Applied bytes - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly appliedBytes?: number; - /** - * Total bytes (if available) - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly totalBytes?: number; -} - -/** - * Server Endpoint sync status - */ -export interface ServerEndpointSyncStatus { - /** - * Download Health Status. Possible values include: 'Healthy', 'Error', 'SyncBlockedForRestore', - * 'SyncBlockedForChangeDetectionPostRestore', 'NoActivity' - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly downloadHealth?: DownloadHealth; - /** - * Upload Health Status. Possible values include: 'Healthy', 'Error', 'SyncBlockedForRestore', - * 'SyncBlockedForChangeDetectionPostRestore', 'NoActivity' - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly uploadHealth?: UploadHealth; - /** - * Combined Health Status. Possible values include: 'Healthy', 'Error', 'SyncBlockedForRestore', - * 'SyncBlockedForChangeDetectionPostRestore', 'NoActivity' - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly combinedHealth?: CombinedHealth; - /** - * Sync activity. Possible values include: 'Upload', 'Download', 'UploadAndDownload' - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly syncActivity?: SyncActivity; - /** - * Total count of persistent files not syncing (combined upload + download). - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly totalPersistentFilesNotSyncingCount?: number; - /** - * Last Updated Timestamp - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly lastUpdatedTimestamp?: Date; - /** - * Upload Status - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly uploadStatus?: ServerEndpointSyncSessionStatus; - /** - * Download Status - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly downloadStatus?: ServerEndpointSyncSessionStatus; - /** - * Upload sync activity - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly uploadActivity?: ServerEndpointSyncActivityStatus; - /** - * Download sync activity - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly downloadActivity?: ServerEndpointSyncActivityStatus; - /** - * Offline Data Transfer State. Possible values include: 'InProgress', 'Stopping', 'NotRunning', - * 'Complete' - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly offlineDataTransferStatus?: OfflineDataTransferStatus; -} - -/** - * Server endpoint cloud tiering status object. - */ -export interface ServerEndpointCloudTieringStatus { - /** - * Cloud tiering health state. Possible values include: 'Healthy', 'Error' - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly health?: Health; - /** - * Last updated timestamp - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly lastUpdatedTimestamp?: Date; - /** - * Last cloud tiering result (HResult) - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly lastCloudTieringResult?: number; - /** - * Last cloud tiering success timestamp - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly lastSuccessTimestamp?: Date; -} - -/** - * Server endpoint recall error object - */ -export interface ServerEndpointRecallError { - /** - * Error code (HResult) - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly errorCode?: number; - /** - * Count of occurences of the error - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly count?: number; -} - -/** - * Server endpoint recall status object. - */ -export interface ServerEndpointRecallStatus { - /** - * Last updated timestamp - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly lastUpdatedTimestamp?: Date; - /** - * Total count of recall errors. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly totalRecallErrorsCount?: number; - /** - * Array of recall errors - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly recallErrors?: ServerEndpointRecallError[]; -} - -/** - * Server Endpoint object. - */ -export interface ServerEndpoint extends ProxyResource { - /** - * Server Local path. - */ - serverLocalPath?: string; - /** - * Cloud Tiering. Possible values include: 'on', 'off' - */ - cloudTiering?: CloudTiering2; - /** - * Level of free space to be maintained by Cloud Tiering if it is enabled. - */ - volumeFreeSpacePercent?: number; - /** - * Tier files older than days. - */ - tierFilesOlderThanDays?: number; - /** - * Friendly Name - */ - friendlyName?: string; - /** - * Server Resource Id. - */ - serverResourceId?: string; - /** - * ServerEndpoint Provisioning State - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly provisioningState?: string; - /** - * ServerEndpoint lastWorkflowId - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly lastWorkflowId?: string; - /** - * Resource Last Operation Name - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly lastOperationName?: string; - /** - * Server Endpoint sync status - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly syncStatus?: ServerEndpointSyncStatus; - /** - * Offline data transfer. Possible values include: 'on', 'off' - */ - offlineDataTransfer?: OfflineDataTransfer2; - /** - * Offline data transfer storage account resource ID - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly offlineDataTransferStorageAccountResourceId?: string; - /** - * Offline data transfer storage account tenant ID - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly offlineDataTransferStorageAccountTenantId?: string; - /** - * Offline data transfer share name - */ - offlineDataTransferShareName?: string; - /** - * Cloud tiering status. Only populated if cloud tiering is enabled. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly cloudTieringStatus?: ServerEndpointCloudTieringStatus; - /** - * Recall status. Only populated if cloud tiering is enabled. - * **NOTE: This property will not be serialized. It can only be populated by the server.** - */ - readonly recallStatus?: ServerEndpointRecallStatus; -} - -/** - * Registered Server resource. - */ -export interface RegisteredServer extends ProxyResource { - /** - * Registered Server Certificate - */ - serverCertificate?: string; - /** - * Registered Server Agent Version - */ - agentVersion?: string; - /** - * Registered Server OS Version - */ - serverOSVersion?: string; - /** - * Registered Server Management Error Code - */ - serverManagementErrorCode?: number; - /** - * Registered Server last heart beat - */ - lastHeartBeat?: string; - /** - * Registered Server Provisioning State - */ - provisioningState?: string; - /** - * Registered Server serverRole - */ - serverRole?: string; - /** - * Registered Server clusterId - */ - clusterId?: string; - /** - * Registered Server clusterName - */ - clusterName?: string; - /** - * Registered Server serverId - */ - serverId?: string; - /** - * Registered Server storageSyncServiceUid - */ - storageSyncServiceUid?: string; - /** - * Registered Server lastWorkflowId - */ - lastWorkflowId?: string; - /** - * Resource Last Operation Name - */ - lastOperationName?: string; - /** - * Resource discoveryEndpointUri - */ - discoveryEndpointUri?: string; - /** - * Resource Location - */ - resourceLocation?: string; - /** - * Service Location - */ - serviceLocation?: string; - /** - * Friendly Name - */ - friendlyName?: string; - /** - * Management Endpoint Uri - */ - managementEndpointUri?: string; - /** - * Monitoring Configuration - */ - monitoringConfiguration?: string; -} - -/** - * Resource Move Info. - */ -export interface ResourcesMoveInfo { - /** - * Target resource group. - */ - targetResourceGroup?: string; - /** - * Collection of Resources. - */ - resources?: string[]; -} - -/** - * Workflow resource. - */ -export interface Workflow extends ProxyResource { - /** - * last step name - */ - lastStepName?: string; - /** - * workflow status. Possible values include: 'active', 'expired', 'succeeded', 'aborted', - * 'failed' - */ - status?: Status; - /** - * operation direction. Possible values include: 'do', 'undo', 'cancel' - */ - operation?: Operation; - /** - * workflow steps - */ - steps?: string; - /** - * workflow last operation identifier. - */ - lastOperationId?: string; -} - -/** - * The operation supported by storage sync. - */ -export interface OperationDisplayInfo { - /** - * The description of the operation. - */ - description?: string; - /** - * The action that users can perform, based on their permission level. - */ - operation?: string; - /** - * Service provider: Microsoft StorageSync. - */ - provider?: string; - /** - * Resource on which the operation is performed. - */ - resource?: string; -} - -/** - * The operation supported by storage sync. - */ -export interface OperationEntity { - /** - * Operation name: {provider}/{resource}/{operation}. - */ - name?: string; - /** - * The operation supported by storage sync. - */ - display?: OperationDisplayInfo; - /** - * The origin. - */ - origin?: string; -} - -/** - * Operation Display Resource object. - */ -export interface OperationDisplayResource { - /** - * Operation Display Resource Provider. - */ - provider?: string; - /** - * Operation Display Resource. - */ - resource?: string; - /** - * Operation Display Resource Operation. - */ - operation?: string; - /** - * Operation Display Resource Description. - */ - description?: string; -} - -/** - * Parameters for a check name availability request. - */ +/** Parameters for a check name availability request. */ export interface CheckNameAvailabilityParameters { - /** - * The name to check for availability - */ + /** The name to check for availability */ name: string; + /** The resource type. Must be set to Microsoft.StorageSync/storageSyncServices */ + type: "Microsoft.StorageSync/storageSyncServices"; } -/** - * The CheckNameAvailability operation response. - */ +/** The CheckNameAvailability operation response. */ export interface CheckNameAvailabilityResult { /** - * Gets a boolean value that indicates whether the name is available for you to use. If true, the - * name is available. If false, the name has already been taken or invalid and cannot be used. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * Gets a boolean value that indicates whether the name is available for you to use. If true, the name is available. If false, the name has already been taken or invalid and cannot be used. + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly nameAvailable?: boolean; /** - * Gets the reason that a Storage Sync Service name could not be used. The Reason element is only - * returned if NameAvailable is false. Possible values include: 'Invalid', 'AlreadyExists' - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * Gets the reason that a Storage Sync Service name could not be used. The Reason element is only returned if NameAvailable is false. + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly reason?: NameAvailabilityReason; /** * Gets an error message explaining the Reason value in more detail. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly message?: string; } -/** - * Restore file spec. - */ -export interface RestoreFileSpec { - /** - * Restore file spec path - */ - path?: string; - /** - * Restore file spec isdir - */ - isdir?: boolean; +/** The parameters used when creating a storage sync service. */ +export interface StorageSyncServiceCreateParameters { + /** Required. Gets or sets the location of the resource. This will be one of the supported and registered Azure Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The geo region of a resource cannot be changed once it is created, but if an identical geo region is specified on update, the request will succeed. */ + location: string; + /** Gets or sets a list of key value pairs that describe the resource. These tags can be used for viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key with a length no greater than 128 characters and a value with a length no greater than 256 characters. */ + tags?: { [propertyName: string]: string }; + /** Incoming Traffic Policy */ + incomingTrafficPolicy?: IncomingTrafficPolicy; } -/** - * Post Restore Request - */ -export interface PostRestoreRequest { +/** The Private Endpoint resource. */ +export interface PrivateEndpoint { /** - * Post Restore partition. + * The ARM identifier for Private Endpoint + * NOTE: This property will not be serialized. It can only be populated by the server. */ - partition?: string; - /** - * Post Restore replica group. - */ - replicaGroup?: string; - /** - * Post Restore request id. - */ - requestId?: string; - /** - * Post Restore Azure file share uri. - */ - azureFileShareUri?: string; - /** - * Post Restore Azure status. - */ - status?: string; - /** - * Post Restore Azure source azure file share uri. - */ - sourceAzureFileShareUri?: string; - /** - * Post Restore Azure failed file list. - */ - failedFileList?: string; - /** - * Post Restore restore file spec array. - */ - restoreFileSpec?: RestoreFileSpec[]; + readonly id?: string; } -/** - * Pre Restore request object. - */ -export interface PreRestoreRequest { - /** - * Pre Restore partition. - */ - partition?: string; - /** - * Pre Restore replica group. - */ - replicaGroup?: string; - /** - * Pre Restore request id. - */ - requestId?: string; - /** - * Pre Restore Azure file share uri. - */ - azureFileShareUri?: string; - /** - * Pre Restore Azure status. - */ - status?: string; - /** - * Pre Restore Azure source azure file share uri. - */ - sourceAzureFileShareUri?: string; - /** - * Pre Restore backup metadata property bag. - */ - backupMetadataPropertyBag?: string; - /** - * Pre Restore restore file spec array. - */ - restoreFileSpec?: RestoreFileSpec[]; - /** - * Pre Restore pause wait for sync drain time period in seconds. - */ - pauseWaitForSyncDrainTimePeriodInSeconds?: number; +/** A collection of information about the state of the connection between service consumer and provider. */ +export interface PrivateLinkServiceConnectionState { + /** Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. */ + status?: PrivateEndpointServiceConnectionStatus; + /** The reason for approval/rejection of the connection. */ + description?: string; + /** A message indicating if changes on the service provider require any updates on the consumer. */ + actionsRequired?: string; } -/** - * Backup request - */ +/** 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} + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly id?: string; + /** + * The name of the resource + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly name?: string; + /** + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly type?: string; +} + +/** Parameters for updating an Storage sync service. */ +export interface StorageSyncServiceUpdateParameters { + /** The user-specified tags associated with the storage sync service. */ + tags?: { [propertyName: string]: string }; + /** Incoming Traffic Policy */ + incomingTrafficPolicy?: IncomingTrafficPolicy; +} + +/** Array of StorageSyncServices */ +export interface StorageSyncServiceArray { + /** Collection of StorageSyncServices. */ + value?: StorageSyncService[]; +} + +/** A list of private link resources */ +export interface PrivateLinkResourceListResult { + /** Array of private link resources */ + value?: PrivateLinkResource[]; +} + +/** List of private endpoint connection associated with the specified storage account */ +export interface PrivateEndpointConnectionListResult { + /** Array of private endpoint connections */ + value?: PrivateEndpointConnection[]; +} + +/** Array of SyncGroup */ +export interface SyncGroupArray { + /** Collection of SyncGroup. */ + value?: SyncGroup[]; +} + +/** Cloud endpoint change enumeration status object */ +export interface CloudEndpointChangeEnumerationStatus { + /** + * Last updated timestamp + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastUpdatedTimestamp?: Date; + /** + * Status of last completed change enumeration + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastEnumerationStatus?: CloudEndpointLastChangeEnumerationStatus; + /** + * Change enumeration activity + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly activity?: CloudEndpointChangeEnumerationActivity; +} + +/** Cloud endpoint change enumeration status object */ +export interface CloudEndpointLastChangeEnumerationStatus { + /** + * Timestamp when change enumeration started + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly startedTimestamp?: Date; + /** + * Timestamp when change enumeration completed + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly completedTimestamp?: Date; + /** + * Count of files in the namespace + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly namespaceFilesCount?: number; + /** + * Count of directories in the namespace + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly namespaceDirectoriesCount?: number; + /** + * Namespace size in bytes + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly namespaceSizeBytes?: number; + /** + * Timestamp of when change enumeration is expected to run again + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly nextRunTimestamp?: Date; +} + +/** Cloud endpoint change enumeration activity object */ +export interface CloudEndpointChangeEnumerationActivity { + /** + * Last updated timestamp + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastUpdatedTimestamp?: Date; + /** + * Change enumeration operation state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly operationState?: CloudEndpointChangeEnumerationActivityState; + /** + * When non-zero, indicates an issue that is delaying change enumeration + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly statusCode?: number; + /** + * Timestamp when change enumeration started + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly startedTimestamp?: Date; + /** + * Count of files processed + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly processedFilesCount?: number; + /** + * Count of directories processed + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly processedDirectoriesCount?: number; + /** + * Total count of files enumerated + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly totalFilesCount?: number; + /** + * Total count of directories enumerated + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly totalDirectoriesCount?: number; + /** + * Total enumerated size in bytes + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly totalSizeBytes?: number; + /** + * Progress percentage for change enumeration run, excluding processing of deletes + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly progressPercent?: number; + /** + * Estimate of time remaining for the enumeration run + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly minutesRemaining?: number; + /** + * Change enumeration total counts state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly totalCountsState?: CloudEndpointChangeEnumerationTotalCountsState; + /** + * Progress percentage for processing deletes. This is done separately from the rest of the enumeration run + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly deletesProgressPercent?: number; +} + +/** Array of CloudEndpoint */ +export interface CloudEndpointArray { + /** Collection of CloudEndpoint. */ + value?: CloudEndpoint[]; +} + +/** Backup request */ export interface BackupRequest { - /** - * Azure File Share. - */ + /** Azure File Share. */ azureFileShare?: string; } -/** - * Post Backup Response - */ +/** Post Backup Response */ export interface PostBackupResponse { /** * cloud endpoint Name. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly cloudEndpointName?: string; } -/** - * Parameters for updating an Storage sync service. - */ -export interface StorageSyncServiceUpdateParameters { - /** - * The user-specified tags associated with the storage sync service. - */ - tags?: { [propertyName: string]: string }; - /** - * The properties of the storage sync service. - */ - properties?: any; +/** Pre Restore request object. */ +export interface PreRestoreRequest { + /** Pre Restore partition. */ + partition?: string; + /** Pre Restore replica group. */ + replicaGroup?: string; + /** Pre Restore request id. */ + requestId?: string; + /** Pre Restore Azure file share uri. */ + azureFileShareUri?: string; + /** Pre Restore Azure status. */ + status?: string; + /** Pre Restore Azure source azure file share uri. */ + sourceAzureFileShareUri?: string; + /** Pre Restore backup metadata property bag. */ + backupMetadataPropertyBag?: string; + /** Pre Restore restore file spec array. */ + restoreFileSpec?: RestoreFileSpec[]; + /** Pre Restore pause wait for sync drain time period in seconds. */ + pauseWaitForSyncDrainTimePeriodInSeconds?: number; } -/** - * Operation status object - */ +/** Restore file spec. */ +export interface RestoreFileSpec { + /** Restore file spec path */ + path?: string; + /** Restore file spec isdir */ + isdir?: boolean; +} + +/** Post Restore Request */ +export interface PostRestoreRequest { + /** Post Restore partition. */ + partition?: string; + /** Post Restore replica group. */ + replicaGroup?: string; + /** Post Restore request id. */ + requestId?: string; + /** Post Restore Azure file share uri. */ + azureFileShareUri?: string; + /** Post Restore Azure status. */ + status?: string; + /** Post Restore Azure source azure file share uri. */ + sourceAzureFileShareUri?: string; + /** Post Restore Azure failed file list. */ + failedFileList?: string; + /** Post Restore restore file spec array. */ + restoreFileSpec?: RestoreFileSpec[]; +} + +/** The parameters used when calling trigger change detection action on cloud endpoint. */ +export interface TriggerChangeDetectionParameters { + /** Relative path to a directory Azure File share for which change detection is to be performed. */ + directoryPath?: string; + /** Change Detection Mode. Applies to a directory specified in directoryPath parameter. */ + changeDetectionMode?: ChangeDetectionMode; + /** Array of relative paths on the Azure File share to be included in the change detection. Can be files and directories. */ + paths?: string[]; +} + +/** Server Endpoint sync status */ +export interface ServerEndpointSyncStatus { + /** + * Download Health Status. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly downloadHealth?: ServerEndpointHealthState; + /** + * Upload Health Status. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly uploadHealth?: ServerEndpointHealthState; + /** + * Combined Health Status. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly combinedHealth?: ServerEndpointHealthState; + /** + * Sync activity + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly syncActivity?: ServerEndpointSyncActivityState; + /** + * Total count of persistent files not syncing (combined upload + download). + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly totalPersistentFilesNotSyncingCount?: number; + /** + * Last Updated Timestamp + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastUpdatedTimestamp?: Date; + /** + * Upload Status + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly uploadStatus?: ServerEndpointSyncSessionStatus; + /** + * Download Status + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly downloadStatus?: ServerEndpointSyncSessionStatus; + /** + * Upload sync activity + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly uploadActivity?: ServerEndpointSyncActivityStatus; + /** + * Download sync activity + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly downloadActivity?: ServerEndpointSyncActivityStatus; + /** + * Offline Data Transfer State + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly offlineDataTransferStatus?: ServerEndpointOfflineDataTransferState; + /** + * Background data download activity + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly backgroundDataDownloadActivity?: ServerEndpointBackgroundDataDownloadActivity; +} + +/** Sync Session status object. */ +export interface ServerEndpointSyncSessionStatus { + /** + * Last sync result (HResult) + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastSyncResult?: number; + /** + * Last sync timestamp + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastSyncTimestamp?: Date; + /** + * Last sync success timestamp + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastSyncSuccessTimestamp?: Date; + /** + * Last sync per item error count. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastSyncPerItemErrorCount?: number; + /** + * Count of persistent files not syncing. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly persistentFilesNotSyncingCount?: number; + /** + * Count of transient files not syncing. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly transientFilesNotSyncingCount?: number; + /** + * Array of per-item errors coming from the last sync session. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly filesNotSyncingErrors?: ServerEndpointFilesNotSyncingError[]; + /** + * Sync mode + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastSyncMode?: ServerEndpointSyncMode; +} + +/** Files not syncing error object */ +export interface ServerEndpointFilesNotSyncingError { + /** + * Error code (HResult) + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly errorCode?: number; + /** + * Count of persistent files not syncing with the specified error code + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly persistentCount?: number; + /** + * Count of transient files not syncing with the specified error code + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly transientCount?: number; +} + +/** Sync Session status object. */ +export interface ServerEndpointSyncActivityStatus { + /** + * Timestamp when properties were updated + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly timestamp?: Date; + /** + * Per item error count + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly perItemErrorCount?: number; + /** + * Applied item count. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly appliedItemCount?: number; + /** + * Total item count (if available) + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly totalItemCount?: number; + /** + * Applied bytes + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly appliedBytes?: number; + /** + * Total bytes (if available) + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly totalBytes?: number; + /** + * Sync mode + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly syncMode?: ServerEndpointSyncMode; + /** + * Session minutes remaining (if available) + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly sessionMinutesRemaining?: number; +} + +/** Background data download activity object */ +export interface ServerEndpointBackgroundDataDownloadActivity { + /** + * Timestamp when properties were updated + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly timestamp?: Date; + /** + * Timestamp when the operation started + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly startedTimestamp?: Date; + /** + * Progress percentage + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly percentProgress?: number; + /** + * Running count of bytes downloaded + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly downloadedBytes?: number; +} + +/** Server endpoint cloud tiering status object. */ +export interface ServerEndpointCloudTieringStatus { + /** + * Last updated timestamp + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastUpdatedTimestamp?: Date; + /** + * Cloud tiering health state. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly health?: ServerEndpointHealthState; + /** + * The last updated timestamp of health state + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly healthLastUpdatedTimestamp?: Date; + /** + * Last cloud tiering result (HResult) + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastCloudTieringResult?: number; + /** + * Last cloud tiering success timestamp + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastSuccessTimestamp?: Date; + /** + * Information regarding how much local space cloud tiering is saving. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly spaceSavings?: CloudTieringSpaceSavings; + /** + * Information regarding how well the local cache on the server is performing. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly cachePerformance?: CloudTieringCachePerformance; + /** + * Information regarding files that failed to be tiered + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly filesNotTiering?: CloudTieringFilesNotTiering; + /** + * Status of the volume free space policy + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly volumeFreeSpacePolicyStatus?: CloudTieringVolumeFreeSpacePolicyStatus; + /** + * Status of the date policy + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly datePolicyStatus?: CloudTieringDatePolicyStatus; +} + +/** Server endpoint cloud tiering status object. */ +export interface CloudTieringSpaceSavings { + /** + * Last updated timestamp + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastUpdatedTimestamp?: Date; + /** + * Volume size + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly volumeSizeBytes?: number; + /** + * Total size of content in the azure file share + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly totalSizeCloudBytes?: number; + /** + * Cached content size on the server + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly cachedSizeBytes?: number; + /** + * Percentage of cached size over total size + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly spaceSavingsPercent?: number; + /** + * Count of bytes saved on the server + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly spaceSavingsBytes?: number; +} + +/** Server endpoint cloud tiering status object. */ +export interface CloudTieringCachePerformance { + /** + * Last updated timestamp + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastUpdatedTimestamp?: Date; + /** + * Count of bytes that were served from the local server + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly cacheHitBytes?: number; + /** + * Count of bytes that were served from the cloud + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly cacheMissBytes?: number; + /** + * Percentage of total bytes (hit + miss) that were served from the local server + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly cacheHitBytesPercent?: number; +} + +/** Server endpoint cloud tiering status object. */ +export interface CloudTieringFilesNotTiering { + /** + * Last updated timestamp + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastUpdatedTimestamp?: Date; + /** + * Last cloud tiering result (HResult) + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly totalFileCount?: number; + /** + * Array of tiering errors + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly errors?: FilesNotTieringError[]; +} + +/** Files not tiering error object */ +export interface FilesNotTieringError { + /** + * Error code (HResult) + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly errorCode?: number; + /** + * Count of files with this error + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly fileCount?: number; +} + +/** Status of the volume free space policy */ +export interface CloudTieringVolumeFreeSpacePolicyStatus { + /** + * Last updated timestamp + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastUpdatedTimestamp?: Date; + /** + * In the case where multiple server endpoints are present in a volume, an effective free space policy is applied. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly effectiveVolumeFreeSpacePolicy?: number; + /** + * Current volume free space percentage. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly currentVolumeFreeSpacePercent?: number; +} + +/** Status of the date policy */ +export interface CloudTieringDatePolicyStatus { + /** + * Last updated timestamp + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastUpdatedTimestamp?: Date; + /** + * Most recent access time of tiered files + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly tieredFilesMostRecentAccessTimestamp?: Date; +} + +/** Server endpoint recall status object. */ +export interface ServerEndpointRecallStatus { + /** + * Last updated timestamp + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastUpdatedTimestamp?: Date; + /** + * Total count of recall errors. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly totalRecallErrorsCount?: number; + /** + * Array of recall errors + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly recallErrors?: ServerEndpointRecallError[]; +} + +/** Server endpoint recall error object */ +export interface ServerEndpointRecallError { + /** + * Error code (HResult) + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly errorCode?: number; + /** + * Count of occurences of the error + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly count?: number; +} + +/** Parameters for updating an Server Endpoint. */ +export interface ServerEndpointUpdateParameters { + /** Cloud Tiering. */ + cloudTiering?: FeatureStatus; + /** Level of free space to be maintained by Cloud Tiering if it is enabled. */ + volumeFreeSpacePercent?: number; + /** Tier files older than days. */ + tierFilesOlderThanDays?: number; + /** Offline data transfer */ + offlineDataTransfer?: FeatureStatus; + /** Offline data transfer share name */ + offlineDataTransferShareName?: string; + /** Policy for enabling follow-the-sun business models: link local cache to cloud behavior to pre-populate before local access. */ + localCacheMode?: LocalCacheMode; +} + +/** Array of ServerEndpoint */ +export interface ServerEndpointArray { + /** Collection of ServerEndpoint. */ + value?: ServerEndpoint[]; +} + +/** The parameters used when calling recall action on server endpoint. */ +export interface RecallActionParameters { + /** Pattern of the files. */ + pattern?: string; + /** Recall path. */ + recallPath?: string; +} + +/** Array of RegisteredServer */ +export interface RegisteredServerArray { + /** Collection of Registered Server. */ + value?: RegisteredServer[]; +} + +/** Trigger Rollover Request. */ +export interface TriggerRolloverRequest { + /** Certificate Data */ + serverCertificate?: string; +} + +/** Array of Workflow */ +export interface WorkflowArray { + /** Collection of workflow items. */ + value?: Workflow[]; +} + +/** Operation status object */ export interface OperationStatus { /** * Operation Id - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly name?: string; /** * Operation status - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly status?: string; /** * Start time of the operation - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly startTime?: Date; /** * End time of the operation - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly endTime?: Date; /** * Error details. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * NOTE: This property will not be serialized. It can only be populated by the server. */ readonly error?: StorageSyncApiError; } -/** - * The resource model definition for a Azure Resource Manager resource with an etag. - */ -export interface AzureEntityResource extends Resource { +/** Operation status object */ +export interface LocationOperationStatus { /** - * Resource Etag. - * **NOTE: This property will not be serialized. It can only be populated by the server.** + * Operation resource Id + * NOTE: This property will not be serialized. It can only be populated by the server. */ - readonly etag?: string; -} - -/** - * Optional Parameters. - */ -export interface StorageSyncServicesUpdateOptionalParams extends msRest.RequestOptionsBase { + readonly id?: string; /** - * Storage Sync Service resource. + * Operation Id + * NOTE: This property will not be serialized. It can only be populated by the server. */ - parameters?: StorageSyncServiceUpdateParameters; -} - -/** - * Optional Parameters. - */ -export interface ServerEndpointsUpdateOptionalParams extends msRest.RequestOptionsBase { + readonly name?: string; /** - * Any of the properties applicable in PUT request. + * Operation status + * NOTE: This property will not be serialized. It can only be populated by the server. */ - parameters?: ServerEndpointUpdateParameters; -} - -/** - * Optional Parameters. - */ -export interface ServerEndpointsBeginUpdateOptionalParams extends msRest.RequestOptionsBase { + readonly status?: string; /** - * Any of the properties applicable in PUT request. + * Start time of the operation + * NOTE: This property will not be serialized. It can only be populated by the server. */ - parameters?: ServerEndpointUpdateParameters; + readonly startTime?: Date; + /** + * End time of the operation + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly endTime?: Date; + /** + * Error details. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly error?: StorageSyncApiError; + /** + * Percent complete. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly percentComplete?: number; } -/** - * An interface representing StorageSyncManagementClientOptions. - */ -export interface StorageSyncManagementClientOptions extends AzureServiceClientOptions { - baseUri?: string; +/** Subscription State object. */ +export interface SubscriptionState { + /** State of Azure Subscription */ + state?: Reason; + /** + * Is Transitioning + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly istransitioning?: boolean; + /** Subscription state properties. */ + properties?: Record; } -/** - * Defines headers for List operation. - */ +/** Resource Move Info. */ +export interface ResourcesMoveInfo { + /** Target resource group. */ + targetResourceGroup?: string; + /** Collection of Resources. */ + resources?: string[]; +} + +/** Operation Display Resource object. */ +export interface OperationDisplayResource { + /** Operation Display Resource Provider. */ + provider?: string; + /** Operation Display Resource. */ + resource?: string; + /** Operation Display Resource Operation. */ + operation?: string; + /** Operation Display Resource Description. */ + description?: string; +} + +/** The Private Endpoint Connection resource. */ +export type PrivateEndpointConnection = Resource & { + /** The resource of private end point. */ + privateEndpoint?: PrivateEndpoint; + /** A collection of information about the state of the connection between service consumer and provider. */ + privateLinkServiceConnectionState?: PrivateLinkServiceConnectionState; + /** + * The provisioning state of the private endpoint connection resource. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: PrivateEndpointConnectionProvisioningState; +}; + +/** The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location' */ +export type TrackedResource = Resource & { + /** Resource tags. */ + tags?: { [propertyName: string]: string }; + /** The geo-location where the resource lives */ + location: string; +}; + +/** A private link resource */ +export type PrivateLinkResource = Resource & { + /** + * The private link resource group id. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly groupId?: string; + /** + * The private link resource required member names. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly requiredMembers?: string[]; + /** The private link resource Private link DNS zone name. */ + requiredZoneNames?: string[]; +}; + +/** The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location */ +export type ProxyResource = Resource & {}; + +/** Storage Sync Service object. */ +export type StorageSyncService = TrackedResource & { + /** Incoming Traffic Policy */ + incomingTrafficPolicy?: IncomingTrafficPolicy; + /** + * Storage Sync service status. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly storageSyncServiceStatus?: number; + /** + * Storage Sync service Uid + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly storageSyncServiceUid?: string; + /** + * StorageSyncService Provisioning State + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: string; + /** + * StorageSyncService lastWorkflowId + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastWorkflowId?: string; + /** + * Resource Last Operation Name + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastOperationName?: string; + /** + * List of private endpoint connection associated with the specified storage sync service + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly privateEndpointConnections?: PrivateEndpointConnection[]; +}; + +/** Sync Group object. */ +export type SyncGroup = ProxyResource & { + /** + * Unique Id + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly uniqueId?: string; + /** + * Sync group status + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly syncGroupStatus?: string; +}; + +/** The parameters used when creating a sync group. */ +export type SyncGroupCreateParameters = ProxyResource & { + /** The parameters used to create the sync group */ + properties?: Record; +}; + +/** The parameters used when creating a cloud endpoint. */ +export type CloudEndpointCreateParameters = ProxyResource & { + /** Storage Account Resource Id */ + storageAccountResourceId?: string; + /** Azure file share name */ + azureFileShareName?: string; + /** Storage Account Tenant Id */ + storageAccountTenantId?: string; + /** Friendly Name */ + friendlyName?: string; +}; + +/** Cloud Endpoint object. */ +export type CloudEndpoint = ProxyResource & { + /** Storage Account Resource Id */ + storageAccountResourceId?: string; + /** Azure file share name */ + azureFileShareName?: string; + /** Storage Account Tenant Id */ + storageAccountTenantId?: string; + /** Partnership Id */ + partnershipId?: string; + /** Friendly Name */ + friendlyName?: string; + /** + * Backup Enabled + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly backupEnabled?: string; + /** CloudEndpoint Provisioning State */ + provisioningState?: string; + /** CloudEndpoint lastWorkflowId */ + lastWorkflowId?: string; + /** Resource Last Operation Name */ + lastOperationName?: string; + /** + * Cloud endpoint change enumeration status + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly changeEnumerationStatus?: CloudEndpointChangeEnumerationStatus; +}; + +/** The parameters used when creating a server endpoint. */ +export type ServerEndpointCreateParameters = ProxyResource & { + /** Server Local path. */ + serverLocalPath?: string; + /** Cloud Tiering. */ + cloudTiering?: FeatureStatus; + /** Level of free space to be maintained by Cloud Tiering if it is enabled. */ + volumeFreeSpacePercent?: number; + /** Tier files older than days. */ + tierFilesOlderThanDays?: number; + /** Friendly Name */ + friendlyName?: string; + /** Server Resource Id. */ + serverResourceId?: string; + /** Offline data transfer */ + offlineDataTransfer?: FeatureStatus; + /** Offline data transfer share name */ + offlineDataTransferShareName?: string; + /** Policy for how namespace and files are recalled during FastDr. */ + initialDownloadPolicy?: InitialDownloadPolicy; + /** Policy for enabling follow-the-sun business models: link local cache to cloud behavior to pre-populate before local access. */ + localCacheMode?: LocalCacheMode; + /** Policy for how the initial upload sync session is performed. */ + initialUploadPolicy?: InitialUploadPolicy; +}; + +/** Server Endpoint object. */ +export type ServerEndpoint = ProxyResource & { + /** Server Local path. */ + serverLocalPath?: string; + /** Cloud Tiering. */ + cloudTiering?: FeatureStatus; + /** Level of free space to be maintained by Cloud Tiering if it is enabled. */ + volumeFreeSpacePercent?: number; + /** Tier files older than days. */ + tierFilesOlderThanDays?: number; + /** Friendly Name */ + friendlyName?: string; + /** Server Resource Id. */ + serverResourceId?: string; + /** + * ServerEndpoint Provisioning State + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly provisioningState?: string; + /** + * ServerEndpoint lastWorkflowId + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastWorkflowId?: string; + /** + * Resource Last Operation Name + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastOperationName?: string; + /** + * Server Endpoint sync status + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly syncStatus?: ServerEndpointSyncStatus; + /** Offline data transfer */ + offlineDataTransfer?: FeatureStatus; + /** + * Offline data transfer storage account resource ID + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly offlineDataTransferStorageAccountResourceId?: string; + /** + * Offline data transfer storage account tenant ID + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly offlineDataTransferStorageAccountTenantId?: string; + /** Offline data transfer share name */ + offlineDataTransferShareName?: string; + /** + * Cloud tiering status. Only populated if cloud tiering is enabled. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly cloudTieringStatus?: ServerEndpointCloudTieringStatus; + /** + * Recall status. Only populated if cloud tiering is enabled. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly recallStatus?: ServerEndpointRecallStatus; + /** Policy for how namespace and files are recalled during FastDr. */ + initialDownloadPolicy?: InitialDownloadPolicy; + /** Policy for enabling follow-the-sun business models: link local cache to cloud behavior to pre-populate before local access. */ + localCacheMode?: LocalCacheMode; + /** Policy for how the initial upload sync session is performed. */ + initialUploadPolicy?: InitialUploadPolicy; + /** + * Server name + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly serverName?: string; +}; + +/** Registered Server resource. */ +export type RegisteredServer = ProxyResource & { + /** Registered Server Certificate */ + serverCertificate?: string; + /** Registered Server Agent Version */ + agentVersion?: string; + /** + * Registered Server Agent Version Status + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly agentVersionStatus?: RegisteredServerAgentVersionStatus; + /** + * Registered Server Agent Version Expiration Date + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly agentVersionExpirationDate?: Date; + /** Registered Server OS Version */ + serverOSVersion?: string; + /** Registered Server Management Error Code */ + serverManagementErrorCode?: number; + /** Registered Server last heart beat */ + lastHeartBeat?: string; + /** Registered Server Provisioning State */ + provisioningState?: string; + /** Registered Server serverRole */ + serverRole?: string; + /** Registered Server clusterId */ + clusterId?: string; + /** Registered Server clusterName */ + clusterName?: string; + /** Registered Server serverId */ + serverId?: string; + /** Registered Server storageSyncServiceUid */ + storageSyncServiceUid?: string; + /** Registered Server lastWorkflowId */ + lastWorkflowId?: string; + /** Resource Last Operation Name */ + lastOperationName?: string; + /** Resource discoveryEndpointUri */ + discoveryEndpointUri?: string; + /** Resource Location */ + resourceLocation?: string; + /** Service Location */ + serviceLocation?: string; + /** Friendly Name */ + friendlyName?: string; + /** Management Endpoint Uri */ + managementEndpointUri?: string; + /** Telemetry Endpoint Uri */ + monitoringEndpointUri?: string; + /** Monitoring Configuration */ + monitoringConfiguration?: string; + /** + * Server name + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly serverName?: string; +}; + +/** The parameters used when creating a registered server. */ +export type RegisteredServerCreateParameters = ProxyResource & { + /** Registered Server Certificate */ + serverCertificate?: string; + /** Registered Server Agent Version */ + agentVersion?: string; + /** Registered Server OS Version */ + serverOSVersion?: string; + /** Registered Server last heart beat */ + lastHeartBeat?: string; + /** Registered Server serverRole */ + serverRole?: string; + /** Registered Server clusterId */ + clusterId?: string; + /** Registered Server clusterName */ + clusterName?: string; + /** Registered Server serverId */ + serverId?: string; + /** Friendly Name */ + friendlyName?: string; +}; + +/** Workflow resource. */ +export type Workflow = ProxyResource & { + /** last step name */ + lastStepName?: string; + /** workflow status. */ + status?: WorkflowStatus; + /** operation direction. */ + operation?: OperationDirection; + /** workflow steps */ + steps?: string; + /** workflow last operation identifier. */ + lastOperationId?: string; + /** + * workflow command name. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly commandName?: string; + /** + * workflow created timestamp. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly createdTimestamp?: Date; + /** + * workflow last status timestamp. + * NOTE: This property will not be serialized. It can only be populated by the server. + */ + readonly lastStatusTimestamp?: Date; +}; + +/** Defines headers for Operations_list operation. */ export interface OperationsListHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for Get operation. - */ +/** Defines headers for Operations_listNext operation. */ +export interface OperationsListNextHeaders { + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; +} + +/** Defines headers for StorageSyncServices_create operation. */ +export interface StorageSyncServicesCreateHeaders { + /** Operation Status Location URI */ + azureAsyncOperation?: string; + /** Operation Status Location URI */ + location?: string; + /** Retry After */ + retryAfter?: string; + /** Request id */ + xMsRequestId?: string; + /** correlation request id */ + xMsCorrelationRequestId?: string; +} + +/** Defines headers for StorageSyncServices_get operation. */ export interface StorageSyncServicesGetHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for Update operation. - */ +/** Defines headers for StorageSyncServices_update operation. */ export interface StorageSyncServicesUpdateHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for Delete operation. - */ +/** Defines headers for StorageSyncServices_delete operation. */ export interface StorageSyncServicesDeleteHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for ListByResourceGroup operation. - */ +/** Defines headers for StorageSyncServices_listByResourceGroup operation. */ export interface StorageSyncServicesListByResourceGroupHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for ListBySubscription operation. - */ +/** Defines headers for StorageSyncServices_listBySubscription operation. */ export interface StorageSyncServicesListBySubscriptionHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for ListByStorageSyncService operation. - */ +/** Defines headers for PrivateEndpointConnections_create operation. */ +export interface PrivateEndpointConnectionsCreateHeaders { + /** Operation Status Location URI */ + azureAsyncOperation?: string; + /** Operation Status Location URI */ + location?: string; + /** Retry After */ + retryAfter?: string; + /** Request id */ + xMsRequestId?: string; + /** correlation request id */ + xMsCorrelationRequestId?: string; +} + +/** Defines headers for PrivateEndpointConnections_delete operation. */ +export interface PrivateEndpointConnectionsDeleteHeaders { + /** Operation Status Location URI */ + azureAsyncOperation?: string; + /** Operation Status Location URI */ + location?: string; + /** Retry After */ + retryAfter?: string; + /** Request id */ + xMsRequestId?: string; + /** correlation request id */ + xMsCorrelationRequestId?: string; +} + +/** Defines headers for PrivateEndpointConnections_listByStorageSyncService operation. */ +export interface PrivateEndpointConnectionsListByStorageSyncServiceHeaders { + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; +} + +/** Defines headers for SyncGroups_listByStorageSyncService operation. */ export interface SyncGroupsListByStorageSyncServiceHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for Create operation. - */ +/** Defines headers for SyncGroups_create operation. */ export interface SyncGroupsCreateHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for Get operation. - */ +/** Defines headers for SyncGroups_get operation. */ export interface SyncGroupsGetHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for Delete operation. - */ +/** Defines headers for SyncGroups_delete operation. */ export interface SyncGroupsDeleteHeaders { - /** - * Request id - */ - xMsRequestId: string; - /** - * correlation request id - */ - xMsCorrelationRequestId: string; + /** Request id */ + xMsRequestId?: string; + /** correlation request id */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for Create operation. - */ +/** Defines headers for CloudEndpoints_create operation. */ export interface CloudEndpointsCreateHeaders { - /** - * Request id - */ - xMsRequestId: string; - /** - * correlation request id - */ - xMsCorrelationRequestId: string; - /** - * Operation Status Location URI - */ - azureAsyncOperation: string; - /** - * Operation Status Location URI - */ - location: string; - /** - * Retry After - */ - retryAfter: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for Get operation. - */ +/** Defines headers for CloudEndpoints_get operation. */ export interface CloudEndpointsGetHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for Delete operation. - */ +/** Defines headers for CloudEndpoints_delete operation. */ export interface CloudEndpointsDeleteHeaders { - /** - * Request id - */ - xMsRequestId: string; - /** - * correlation request id - */ - xMsCorrelationRequestId: string; - /** - * Operation Status Location URI - */ - azureAsyncOperation: string; - /** - * Operation Status Location URI - */ - location: string; - /** - * Retry After - */ - retryAfter: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for ListBySyncGroup operation. - */ +/** Defines headers for CloudEndpoints_listBySyncGroup operation. */ export interface CloudEndpointsListBySyncGroupHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for PreBackup operation. - */ +/** Defines headers for CloudEndpoints_preBackup operation. */ export interface CloudEndpointsPreBackupHeaders { - /** - * Operation Status Location URI - */ - location: string; - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** Operation Status Location URI */ + location?: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for PostBackup operation. - */ +/** Defines headers for CloudEndpoints_postBackup operation. */ export interface CloudEndpointsPostBackupHeaders { - /** - * Operation Status Location URI - */ - location: string; - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** Operation Status Location URI */ + location?: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for PreRestore operation. - */ +/** Defines headers for CloudEndpoints_preRestore operation. */ export interface CloudEndpointsPreRestoreHeaders { - /** - * Operation Status Location URI - */ - location: string; - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** Operation Status Location URI */ + location?: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for restoreheartbeat operation. - */ +/** Defines headers for CloudEndpoints_restoreheartbeat operation. */ export interface CloudEndpointsRestoreheartbeatHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for PostRestore operation. - */ +/** Defines headers for CloudEndpoints_postRestore operation. */ export interface CloudEndpointsPostRestoreHeaders { - /** - * Operation Status Location URI - */ - location: string; - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** Operation Status Location URI */ + location?: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for TriggerChangeDetection operation. - */ +/** Defines headers for CloudEndpoints_triggerChangeDetection operation. */ export interface CloudEndpointsTriggerChangeDetectionHeaders { - /** - * Operation Status Location URI - */ - location: string; - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** Operation Status Location URI */ + location?: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for Create operation. - */ +/** Defines headers for ServerEndpoints_create operation. */ export interface ServerEndpointsCreateHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; - /** - * Operation Status Location URI - */ - azureAsyncOperation: string; - /** - * Operation Status Location URI - */ - location: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for Update operation. - */ +/** Defines headers for ServerEndpoints_update operation. */ export interface ServerEndpointsUpdateHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; - /** - * Operation Status Location URI - */ - azureAsyncOperation: string; - /** - * Operation Status Location URI - */ - location: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for Get operation. - */ +/** Defines headers for ServerEndpoints_get operation. */ export interface ServerEndpointsGetHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for Delete operation. - */ +/** Defines headers for ServerEndpoints_delete operation. */ export interface ServerEndpointsDeleteHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; - /** - * Operation Status Location URI - */ - location: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for ListBySyncGroup operation. - */ +/** Defines headers for ServerEndpoints_listBySyncGroup operation. */ export interface ServerEndpointsListBySyncGroupHeaders { - /** - * Operation Status Location URI - */ - location: string; - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** Operation Status Location URI */ + location?: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for recallAction operation. - */ +/** Defines headers for ServerEndpoints_recallAction operation. */ export interface ServerEndpointsRecallActionHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; - /** - * Operation Status Location URI - */ - location: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for ListByStorageSyncService operation. - */ +/** Defines headers for RegisteredServers_listByStorageSyncService operation. */ export interface RegisteredServersListByStorageSyncServiceHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for Get operation. - */ +/** Defines headers for RegisteredServers_get operation. */ export interface RegisteredServersGetHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for Create operation. - */ +/** Defines headers for RegisteredServers_create operation. */ export interface RegisteredServersCreateHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; - /** - * Operation Status Location URI - */ - azureAsyncOperation: string; - /** - * Operation Status Location URI - */ - location: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for Delete operation. - */ +/** Defines headers for RegisteredServers_delete operation. */ export interface RegisteredServersDeleteHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; - /** - * Operation Status Location URI - */ - location: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for triggerRollover operation. - */ +/** Defines headers for RegisteredServers_triggerRollover operation. */ export interface RegisteredServersTriggerRolloverHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; - /** - * Operation Status Location URI - */ - location: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for ListByStorageSyncService operation. - */ +/** Defines headers for Workflows_listByStorageSyncService operation. */ export interface WorkflowsListByStorageSyncServiceHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for Get operation. - */ +/** Defines headers for Workflows_get operation. */ export interface WorkflowsGetHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for Abort operation. - */ +/** Defines headers for Workflows_abort operation. */ export interface WorkflowsAbortHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; } -/** - * Defines headers for Get operation. - */ +/** Defines headers for OperationStatus_get operation. */ export interface OperationStatusGetHeaders { - /** - * request id. - */ - xMsRequestId: string; - /** - * correlation request id. - */ - xMsCorrelationRequestId: string; + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; +} + +/** Defines headers for MicrosoftStorageSync_locationOperationStatus operation. */ +export interface MicrosoftStorageSyncLocationOperationStatusHeaders { + /** request id. */ + xMsRequestId?: string; + /** correlation request id. */ + xMsCorrelationRequestId?: string; +} + +/** Known values of {@link IncomingTrafficPolicy} that the service accepts. */ +export enum KnownIncomingTrafficPolicy { + AllowAllTraffic = "AllowAllTraffic", + AllowVirtualNetworksOnly = "AllowVirtualNetworksOnly" } /** - * @interface - * The list of storage sync operations. - * @extends Array + * Defines values for IncomingTrafficPolicy. \ + * {@link KnownIncomingTrafficPolicy} can be used interchangeably with IncomingTrafficPolicy, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **AllowAllTraffic** \ + * **AllowVirtualNetworksOnly** */ -export interface OperationEntityListResult extends Array { - /** - * The link used to get the next page of operations. - */ - nextLink?: string; +export type IncomingTrafficPolicy = string; + +/** Known values of {@link PrivateEndpointServiceConnectionStatus} that the service accepts. */ +export enum KnownPrivateEndpointServiceConnectionStatus { + Pending = "Pending", + Approved = "Approved", + Rejected = "Rejected" } /** - * @interface - * Array of StorageSyncServices - * @extends Array + * Defines values for PrivateEndpointServiceConnectionStatus. \ + * {@link KnownPrivateEndpointServiceConnectionStatus} can be used interchangeably with PrivateEndpointServiceConnectionStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Pending** \ + * **Approved** \ + * **Rejected** */ -export interface StorageSyncServiceArray extends Array { +export type PrivateEndpointServiceConnectionStatus = string; + +/** Known values of {@link PrivateEndpointConnectionProvisioningState} that the service accepts. */ +export enum KnownPrivateEndpointConnectionProvisioningState { + Succeeded = "Succeeded", + Creating = "Creating", + Deleting = "Deleting", + Failed = "Failed" } /** - * @interface - * Array of SyncGroup - * @extends Array + * Defines values for PrivateEndpointConnectionProvisioningState. \ + * {@link KnownPrivateEndpointConnectionProvisioningState} can be used interchangeably with PrivateEndpointConnectionProvisioningState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Succeeded** \ + * **Creating** \ + * **Deleting** \ + * **Failed** */ -export interface SyncGroupArray extends Array { +export type PrivateEndpointConnectionProvisioningState = string; + +/** Known values of {@link CloudEndpointChangeEnumerationActivityState} that the service accepts. */ +export enum KnownCloudEndpointChangeEnumerationActivityState { + InitialEnumerationInProgress = "InitialEnumerationInProgress", + EnumerationInProgress = "EnumerationInProgress" } /** - * @interface - * Array of CloudEndpoint - * @extends Array + * Defines values for CloudEndpointChangeEnumerationActivityState. \ + * {@link KnownCloudEndpointChangeEnumerationActivityState} can be used interchangeably with CloudEndpointChangeEnumerationActivityState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **InitialEnumerationInProgress** \ + * **EnumerationInProgress** */ -export interface CloudEndpointArray extends Array { +export type CloudEndpointChangeEnumerationActivityState = string; + +/** Known values of {@link CloudEndpointChangeEnumerationTotalCountsState} that the service accepts. */ +export enum KnownCloudEndpointChangeEnumerationTotalCountsState { + Calculating = "Calculating", + Final = "Final" } /** - * @interface - * Array of ServerEndpoint - * @extends Array + * Defines values for CloudEndpointChangeEnumerationTotalCountsState. \ + * {@link KnownCloudEndpointChangeEnumerationTotalCountsState} can be used interchangeably with CloudEndpointChangeEnumerationTotalCountsState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Calculating** \ + * **Final** */ -export interface ServerEndpointArray extends Array { +export type CloudEndpointChangeEnumerationTotalCountsState = string; + +/** Known values of {@link ChangeDetectionMode} that the service accepts. */ +export enum KnownChangeDetectionMode { + Default = "Default", + Recursive = "Recursive" } /** - * @interface - * Array of RegisteredServer - * @extends Array + * Defines values for ChangeDetectionMode. \ + * {@link KnownChangeDetectionMode} can be used interchangeably with ChangeDetectionMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Default** \ + * **Recursive** */ -export interface RegisteredServerArray extends Array { +export type ChangeDetectionMode = string; + +/** Known values of {@link FeatureStatus} that the service accepts. */ +export enum KnownFeatureStatus { + On = "on", + Off = "off" } /** - * @interface - * Array of Workflow - * @extends Array + * Defines values for FeatureStatus. \ + * {@link KnownFeatureStatus} can be used interchangeably with FeatureStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **on** \ + * **off** */ -export interface WorkflowArray extends Array { +export type FeatureStatus = string; + +/** Known values of {@link InitialDownloadPolicy} that the service accepts. */ +export enum KnownInitialDownloadPolicy { + NamespaceOnly = "NamespaceOnly", + NamespaceThenModifiedFiles = "NamespaceThenModifiedFiles", + AvoidTieredFiles = "AvoidTieredFiles" } /** - * Defines values for Reason. - * Possible values include: 'Registered', 'Unregistered', 'Warned', 'Suspended', 'Deleted' - * @readonly - * @enum {string} + * Defines values for InitialDownloadPolicy. \ + * {@link KnownInitialDownloadPolicy} can be used interchangeably with InitialDownloadPolicy, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **NamespaceOnly** \ + * **NamespaceThenModifiedFiles** \ + * **AvoidTieredFiles** */ -export type Reason = 'Registered' | 'Unregistered' | 'Warned' | 'Suspended' | 'Deleted'; +export type InitialDownloadPolicy = string; + +/** Known values of {@link LocalCacheMode} that the service accepts. */ +export enum KnownLocalCacheMode { + DownloadNewAndModifiedFiles = "DownloadNewAndModifiedFiles", + UpdateLocallyCachedFiles = "UpdateLocallyCachedFiles" +} /** - * Defines values for ChangeDetectionMode. - * Possible values include: 'Default', 'Recursive' - * @readonly - * @enum {string} + * Defines values for LocalCacheMode. \ + * {@link KnownLocalCacheMode} can be used interchangeably with LocalCacheMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **DownloadNewAndModifiedFiles** \ + * **UpdateLocallyCachedFiles** */ -export type ChangeDetectionMode = 'Default' | 'Recursive'; +export type LocalCacheMode = string; + +/** Known values of {@link InitialUploadPolicy} that the service accepts. */ +export enum KnownInitialUploadPolicy { + ServerAuthoritative = "ServerAuthoritative", + Merge = "Merge" +} /** - * Defines values for NameAvailabilityReason. - * Possible values include: 'Invalid', 'AlreadyExists' - * @readonly - * @enum {string} + * Defines values for InitialUploadPolicy. \ + * {@link KnownInitialUploadPolicy} can be used interchangeably with InitialUploadPolicy, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **ServerAuthoritative** \ + * **Merge** */ -export type NameAvailabilityReason = 'Invalid' | 'AlreadyExists'; +export type InitialUploadPolicy = string; + +/** Known values of {@link ServerEndpointHealthState} that the service accepts. */ +export enum KnownServerEndpointHealthState { + Unavailable = "Unavailable", + Healthy = "Healthy", + Error = "Error" +} /** - * Defines values for CloudTiering. - * Possible values include: 'on', 'off' - * @readonly - * @enum {string} + * Defines values for ServerEndpointHealthState. \ + * {@link KnownServerEndpointHealthState} can be used interchangeably with ServerEndpointHealthState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Unavailable** \ + * **Healthy** \ + * **Error** */ -export type CloudTiering = 'on' | 'off'; +export type ServerEndpointHealthState = string; + +/** Known values of {@link ServerEndpointSyncActivityState} that the service accepts. */ +export enum KnownServerEndpointSyncActivityState { + Upload = "Upload", + Download = "Download", + UploadAndDownload = "UploadAndDownload" +} /** - * Defines values for OfflineDataTransfer. - * Possible values include: 'on', 'off' - * @readonly - * @enum {string} + * Defines values for ServerEndpointSyncActivityState. \ + * {@link KnownServerEndpointSyncActivityState} can be used interchangeably with ServerEndpointSyncActivityState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Upload** \ + * **Download** \ + * **UploadAndDownload** */ -export type OfflineDataTransfer = 'on' | 'off'; +export type ServerEndpointSyncActivityState = string; + +/** Known values of {@link ServerEndpointSyncMode} that the service accepts. */ +export enum KnownServerEndpointSyncMode { + Regular = "Regular", + NamespaceDownload = "NamespaceDownload", + InitialUpload = "InitialUpload", + SnapshotUpload = "SnapshotUpload", + InitialFullDownload = "InitialFullDownload" +} /** - * Defines values for CloudTiering1. - * Possible values include: 'on', 'off' - * @readonly - * @enum {string} + * Defines values for ServerEndpointSyncMode. \ + * {@link KnownServerEndpointSyncMode} can be used interchangeably with ServerEndpointSyncMode, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Regular** \ + * **NamespaceDownload** \ + * **InitialUpload** \ + * **SnapshotUpload** \ + * **InitialFullDownload** */ -export type CloudTiering1 = 'on' | 'off'; +export type ServerEndpointSyncMode = string; + +/** Known values of {@link ServerEndpointOfflineDataTransferState} that the service accepts. */ +export enum KnownServerEndpointOfflineDataTransferState { + InProgress = "InProgress", + Stopping = "Stopping", + NotRunning = "NotRunning", + Complete = "Complete" +} /** - * Defines values for OfflineDataTransfer1. - * Possible values include: 'on', 'off' - * @readonly - * @enum {string} + * Defines values for ServerEndpointOfflineDataTransferState. \ + * {@link KnownServerEndpointOfflineDataTransferState} can be used interchangeably with ServerEndpointOfflineDataTransferState, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **InProgress** \ + * **Stopping** \ + * **NotRunning** \ + * **Complete** */ -export type OfflineDataTransfer1 = 'on' | 'off'; +export type ServerEndpointOfflineDataTransferState = string; + +/** Known values of {@link RegisteredServerAgentVersionStatus} that the service accepts. */ +export enum KnownRegisteredServerAgentVersionStatus { + Ok = "Ok", + NearExpiry = "NearExpiry", + Expired = "Expired", + Blocked = "Blocked" +} /** - * Defines values for DownloadHealth. - * Possible values include: 'Healthy', 'Error', 'SyncBlockedForRestore', - * 'SyncBlockedForChangeDetectionPostRestore', 'NoActivity' - * @readonly - * @enum {string} + * Defines values for RegisteredServerAgentVersionStatus. \ + * {@link KnownRegisteredServerAgentVersionStatus} can be used interchangeably with RegisteredServerAgentVersionStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Ok** \ + * **NearExpiry** \ + * **Expired** \ + * **Blocked** */ -export type DownloadHealth = 'Healthy' | 'Error' | 'SyncBlockedForRestore' | 'SyncBlockedForChangeDetectionPostRestore' | 'NoActivity'; +export type RegisteredServerAgentVersionStatus = string; + +/** Known values of {@link WorkflowStatus} that the service accepts. */ +export enum KnownWorkflowStatus { + Active = "active", + Expired = "expired", + Succeeded = "succeeded", + Aborted = "aborted", + Failed = "failed" +} /** - * Defines values for UploadHealth. - * Possible values include: 'Healthy', 'Error', 'SyncBlockedForRestore', - * 'SyncBlockedForChangeDetectionPostRestore', 'NoActivity' - * @readonly - * @enum {string} + * Defines values for WorkflowStatus. \ + * {@link KnownWorkflowStatus} can be used interchangeably with WorkflowStatus, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **active** \ + * **expired** \ + * **succeeded** \ + * **aborted** \ + * **failed** */ -export type UploadHealth = 'Healthy' | 'Error' | 'SyncBlockedForRestore' | 'SyncBlockedForChangeDetectionPostRestore' | 'NoActivity'; +export type WorkflowStatus = string; + +/** Known values of {@link OperationDirection} that the service accepts. */ +export enum KnownOperationDirection { + Do = "do", + Undo = "undo", + Cancel = "cancel" +} /** - * Defines values for CombinedHealth. - * Possible values include: 'Healthy', 'Error', 'SyncBlockedForRestore', - * 'SyncBlockedForChangeDetectionPostRestore', 'NoActivity' - * @readonly - * @enum {string} + * Defines values for OperationDirection. \ + * {@link KnownOperationDirection} can be used interchangeably with OperationDirection, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **do** \ + * **undo** \ + * **cancel** */ -export type CombinedHealth = 'Healthy' | 'Error' | 'SyncBlockedForRestore' | 'SyncBlockedForChangeDetectionPostRestore' | 'NoActivity'; +export type OperationDirection = string; + +/** Known values of {@link Reason} that the service accepts. */ +export enum KnownReason { + Registered = "Registered", + Unregistered = "Unregistered", + Warned = "Warned", + Suspended = "Suspended", + Deleted = "Deleted" +} /** - * Defines values for SyncActivity. - * Possible values include: 'Upload', 'Download', 'UploadAndDownload' - * @readonly - * @enum {string} + * Defines values for Reason. \ + * {@link KnownReason} can be used interchangeably with Reason, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **Registered** \ + * **Unregistered** \ + * **Warned** \ + * **Suspended** \ + * **Deleted** */ -export type SyncActivity = 'Upload' | 'Download' | 'UploadAndDownload'; +export type Reason = string; + +/** Known values of {@link ProgressType} that the service accepts. */ +export enum KnownProgressType { + None = "none", + Initialize = "initialize", + Download = "download", + Upload = "upload", + Recall = "recall" +} /** - * Defines values for OfflineDataTransferStatus. - * Possible values include: 'InProgress', 'Stopping', 'NotRunning', 'Complete' - * @readonly - * @enum {string} + * Defines values for ProgressType. \ + * {@link KnownProgressType} can be used interchangeably with ProgressType, + * this enum contains the known values that the service supports. + * ### Known values supported by the service + * **none** \ + * **initialize** \ + * **download** \ + * **upload** \ + * **recall** */ -export type OfflineDataTransferStatus = 'InProgress' | 'Stopping' | 'NotRunning' | 'Complete'; - -/** - * Defines values for Health. - * Possible values include: 'Healthy', 'Error' - * @readonly - * @enum {string} - */ -export type Health = 'Healthy' | 'Error'; - -/** - * Defines values for CloudTiering2. - * Possible values include: 'on', 'off' - * @readonly - * @enum {string} - */ -export type CloudTiering2 = 'on' | 'off'; - -/** - * Defines values for OfflineDataTransfer2. - * Possible values include: 'on', 'off' - * @readonly - * @enum {string} - */ -export type OfflineDataTransfer2 = 'on' | 'off'; - -/** - * Defines values for Status. - * Possible values include: 'active', 'expired', 'succeeded', 'aborted', 'failed' - * @readonly - * @enum {string} - */ -export type Status = 'active' | 'expired' | 'succeeded' | 'aborted' | 'failed'; - -/** - * Defines values for Operation. - * Possible values include: 'do', 'undo', 'cancel' - * @readonly - * @enum {string} - */ -export type Operation = 'do' | 'undo' | 'cancel'; - -/** - * Contains response data for the list operation. - */ -export type OperationsListResponse = OperationEntityListResult & OperationsListHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: OperationsListHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationEntityListResult; - }; -}; - -/** - * Contains response data for the checkNameAvailability operation. - */ -export type StorageSyncServicesCheckNameAvailabilityResponse = CheckNameAvailabilityResult & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: CheckNameAvailabilityResult; - }; -}; - -/** - * Contains response data for the create operation. - */ -export type StorageSyncServicesCreateResponse = StorageSyncService & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: StorageSyncService; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type StorageSyncServicesGetResponse = StorageSyncService & StorageSyncServicesGetHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: StorageSyncServicesGetHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: StorageSyncService; - }; -}; - -/** - * Contains response data for the update operation. - */ -export type StorageSyncServicesUpdateResponse = StorageSyncService & StorageSyncServicesUpdateHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: StorageSyncServicesUpdateHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: StorageSyncService; - }; -}; - -/** - * Contains response data for the deleteMethod operation. - */ -export type StorageSyncServicesDeleteResponse = StorageSyncServicesDeleteHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: StorageSyncServicesDeleteHeaders; - }; -}; - -/** - * Contains response data for the listByResourceGroup operation. - */ -export type StorageSyncServicesListByResourceGroupResponse = StorageSyncServiceArray & StorageSyncServicesListByResourceGroupHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: StorageSyncServicesListByResourceGroupHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: StorageSyncServiceArray; - }; -}; - -/** - * Contains response data for the listBySubscription operation. - */ -export type StorageSyncServicesListBySubscriptionResponse = StorageSyncServiceArray & StorageSyncServicesListBySubscriptionHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: StorageSyncServicesListBySubscriptionHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: StorageSyncServiceArray; - }; -}; - -/** - * Contains response data for the listByStorageSyncService operation. - */ -export type SyncGroupsListByStorageSyncServiceResponse = SyncGroupArray & SyncGroupsListByStorageSyncServiceHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: SyncGroupsListByStorageSyncServiceHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SyncGroupArray; - }; -}; - -/** - * Contains response data for the create operation. - */ -export type SyncGroupsCreateResponse = SyncGroup & SyncGroupsCreateHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: SyncGroupsCreateHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SyncGroup; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type SyncGroupsGetResponse = SyncGroup & SyncGroupsGetHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: SyncGroupsGetHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: SyncGroup; - }; -}; - -/** - * Contains response data for the deleteMethod operation. - */ -export type SyncGroupsDeleteResponse = SyncGroupsDeleteHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: SyncGroupsDeleteHeaders; - }; -}; - -/** - * Contains response data for the create operation. - */ -export type CloudEndpointsCreateResponse = CloudEndpoint & CloudEndpointsCreateHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: CloudEndpointsCreateHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: CloudEndpoint; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type CloudEndpointsGetResponse = CloudEndpoint & CloudEndpointsGetHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: CloudEndpointsGetHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: CloudEndpoint; - }; -}; - -/** - * Contains response data for the deleteMethod operation. - */ -export type CloudEndpointsDeleteResponse = CloudEndpointsDeleteHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: CloudEndpointsDeleteHeaders; - }; -}; - -/** - * Contains response data for the listBySyncGroup operation. - */ -export type CloudEndpointsListBySyncGroupResponse = CloudEndpointArray & CloudEndpointsListBySyncGroupHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: CloudEndpointsListBySyncGroupHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: CloudEndpointArray; - }; -}; - -/** - * Contains response data for the preBackup operation. - */ -export type CloudEndpointsPreBackupResponse = CloudEndpointsPreBackupHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: CloudEndpointsPreBackupHeaders; - }; -}; - -/** - * Contains response data for the postBackup operation. - */ -export type CloudEndpointsPostBackupResponse = PostBackupResponse & CloudEndpointsPostBackupHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: CloudEndpointsPostBackupHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: PostBackupResponse; - }; -}; - -/** - * Contains response data for the preRestore operation. - */ -export type CloudEndpointsPreRestoreResponse = CloudEndpointsPreRestoreHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: CloudEndpointsPreRestoreHeaders; - }; -}; - -/** - * Contains response data for the restoreheartbeat operation. - */ -export type CloudEndpointsRestoreheartbeatResponse = CloudEndpointsRestoreheartbeatHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: CloudEndpointsRestoreheartbeatHeaders; - }; -}; - -/** - * Contains response data for the postRestore operation. - */ -export type CloudEndpointsPostRestoreResponse = CloudEndpointsPostRestoreHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: CloudEndpointsPostRestoreHeaders; - }; -}; - -/** - * Contains response data for the triggerChangeDetection operation. - */ -export type CloudEndpointsTriggerChangeDetectionResponse = CloudEndpointsTriggerChangeDetectionHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: CloudEndpointsTriggerChangeDetectionHeaders; - }; -}; - -/** - * Contains response data for the create operation. - */ -export type ServerEndpointsCreateResponse = ServerEndpoint & ServerEndpointsCreateHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: ServerEndpointsCreateHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ServerEndpoint; - }; -}; - -/** - * Contains response data for the update operation. - */ -export type ServerEndpointsUpdateResponse = ServerEndpoint & ServerEndpointsUpdateHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: ServerEndpointsUpdateHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ServerEndpoint; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type ServerEndpointsGetResponse = ServerEndpoint & ServerEndpointsGetHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: ServerEndpointsGetHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ServerEndpoint; - }; -}; - -/** - * Contains response data for the deleteMethod operation. - */ -export type ServerEndpointsDeleteResponse = ServerEndpointsDeleteHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: ServerEndpointsDeleteHeaders; - }; -}; - -/** - * Contains response data for the listBySyncGroup operation. - */ -export type ServerEndpointsListBySyncGroupResponse = ServerEndpointArray & ServerEndpointsListBySyncGroupHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: ServerEndpointsListBySyncGroupHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: ServerEndpointArray; - }; -}; - -/** - * Contains response data for the recallAction operation. - */ -export type ServerEndpointsRecallActionResponse = ServerEndpointsRecallActionHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: ServerEndpointsRecallActionHeaders; - }; -}; - -/** - * Contains response data for the listByStorageSyncService operation. - */ -export type RegisteredServersListByStorageSyncServiceResponse = RegisteredServerArray & RegisteredServersListByStorageSyncServiceHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: RegisteredServersListByStorageSyncServiceHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RegisteredServerArray; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type RegisteredServersGetResponse = RegisteredServer & RegisteredServersGetHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: RegisteredServersGetHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RegisteredServer; - }; -}; - -/** - * Contains response data for the create operation. - */ -export type RegisteredServersCreateResponse = RegisteredServer & RegisteredServersCreateHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: RegisteredServersCreateHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: RegisteredServer; - }; -}; - -/** - * Contains response data for the deleteMethod operation. - */ -export type RegisteredServersDeleteResponse = RegisteredServersDeleteHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: RegisteredServersDeleteHeaders; - }; -}; - -/** - * Contains response data for the triggerRollover operation. - */ -export type RegisteredServersTriggerRolloverResponse = RegisteredServersTriggerRolloverHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: RegisteredServersTriggerRolloverHeaders; - }; -}; - -/** - * Contains response data for the listByStorageSyncService operation. - */ -export type WorkflowsListByStorageSyncServiceResponse = WorkflowArray & WorkflowsListByStorageSyncServiceHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: WorkflowsListByStorageSyncServiceHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: WorkflowArray; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type WorkflowsGetResponse = Workflow & WorkflowsGetHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: WorkflowsGetHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: Workflow; - }; -}; - -/** - * Contains response data for the abort operation. - */ -export type WorkflowsAbortResponse = WorkflowsAbortHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: WorkflowsAbortHeaders; - }; -}; - -/** - * Contains response data for the get operation. - */ -export type OperationStatusGetResponse = OperationStatus & OperationStatusGetHeaders & { - /** - * The underlying HTTP response. - */ - _response: msRest.HttpResponse & { - /** - * The parsed HTTP response headers. - */ - parsedHeaders: OperationStatusGetHeaders; - - /** - * The response body as text (string format) - */ - bodyAsText: string; - - /** - * The response body as parsed JSON or XML - */ - parsedBody: OperationStatus; - }; -}; +export type ProgressType = string; +/** Defines values for NameAvailabilityReason. */ +export type NameAvailabilityReason = "Invalid" | "AlreadyExists"; + +/** Optional parameters. */ +export interface OperationsListOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the list operation. */ +export type OperationsListResponse = OperationsListHeaders & + OperationEntityListResult; + +/** Optional parameters. */ +export interface OperationsListNextOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listNext operation. */ +export type OperationsListNextResponse = OperationsListNextHeaders & + OperationEntityListResult; + +/** Optional parameters. */ +export interface StorageSyncServicesCheckNameAvailabilityOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the checkNameAvailability operation. */ +export type StorageSyncServicesCheckNameAvailabilityResponse = CheckNameAvailabilityResult; + +/** Optional parameters. */ +export interface StorageSyncServicesCreateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the create operation. */ +export type StorageSyncServicesCreateResponse = StorageSyncService; + +/** Optional parameters. */ +export interface StorageSyncServicesGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type StorageSyncServicesGetResponse = StorageSyncServicesGetHeaders & + StorageSyncService; + +/** Optional parameters. */ +export interface StorageSyncServicesUpdateOptionalParams + extends coreClient.OperationOptions { + /** Storage Sync Service resource. */ + parameters?: StorageSyncServiceUpdateParameters; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the update operation. */ +export type StorageSyncServicesUpdateResponse = StorageSyncServicesUpdateHeaders & + StorageSyncService; + +/** Optional parameters. */ +export interface StorageSyncServicesDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the delete operation. */ +export type StorageSyncServicesDeleteResponse = StorageSyncServicesDeleteHeaders; + +/** Optional parameters. */ +export interface StorageSyncServicesListByResourceGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByResourceGroup operation. */ +export type StorageSyncServicesListByResourceGroupResponse = StorageSyncServicesListByResourceGroupHeaders & + StorageSyncServiceArray; + +/** Optional parameters. */ +export interface StorageSyncServicesListBySubscriptionOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySubscription operation. */ +export type StorageSyncServicesListBySubscriptionResponse = StorageSyncServicesListBySubscriptionHeaders & + StorageSyncServiceArray; + +/** Optional parameters. */ +export interface PrivateLinkResourcesListByStorageSyncServiceOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByStorageSyncService operation. */ +export type PrivateLinkResourcesListByStorageSyncServiceResponse = PrivateLinkResourceListResult; + +/** Optional parameters. */ +export interface PrivateEndpointConnectionsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type PrivateEndpointConnectionsGetResponse = PrivateEndpointConnection; + +/** Optional parameters. */ +export interface PrivateEndpointConnectionsCreateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the create operation. */ +export type PrivateEndpointConnectionsCreateResponse = PrivateEndpointConnection; + +/** Optional parameters. */ +export interface PrivateEndpointConnectionsDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface PrivateEndpointConnectionsListByStorageSyncServiceOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByStorageSyncService operation. */ +export type PrivateEndpointConnectionsListByStorageSyncServiceResponse = PrivateEndpointConnectionsListByStorageSyncServiceHeaders & + PrivateEndpointConnectionListResult; + +/** Optional parameters. */ +export interface SyncGroupsListByStorageSyncServiceOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByStorageSyncService operation. */ +export type SyncGroupsListByStorageSyncServiceResponse = SyncGroupsListByStorageSyncServiceHeaders & + SyncGroupArray; + +/** Optional parameters. */ +export interface SyncGroupsCreateOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the create operation. */ +export type SyncGroupsCreateResponse = SyncGroupsCreateHeaders & SyncGroup; + +/** Optional parameters. */ +export interface SyncGroupsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type SyncGroupsGetResponse = SyncGroupsGetHeaders & SyncGroup; + +/** Optional parameters. */ +export interface SyncGroupsDeleteOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the delete operation. */ +export type SyncGroupsDeleteResponse = SyncGroupsDeleteHeaders; + +/** Optional parameters. */ +export interface CloudEndpointsCreateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the create operation. */ +export type CloudEndpointsCreateResponse = CloudEndpointsCreateHeaders & + CloudEndpoint; + +/** Optional parameters. */ +export interface CloudEndpointsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type CloudEndpointsGetResponse = CloudEndpointsGetHeaders & + CloudEndpoint; + +/** Optional parameters. */ +export interface CloudEndpointsDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the delete operation. */ +export type CloudEndpointsDeleteResponse = CloudEndpointsDeleteHeaders; + +/** Optional parameters. */ +export interface CloudEndpointsListBySyncGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySyncGroup operation. */ +export type CloudEndpointsListBySyncGroupResponse = CloudEndpointsListBySyncGroupHeaders & + CloudEndpointArray; + +/** Optional parameters. */ +export interface CloudEndpointsPreBackupOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the preBackup operation. */ +export type CloudEndpointsPreBackupResponse = CloudEndpointsPreBackupHeaders; + +/** Optional parameters. */ +export interface CloudEndpointsPostBackupOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the postBackup operation. */ +export type CloudEndpointsPostBackupResponse = CloudEndpointsPostBackupHeaders & + PostBackupResponse; + +/** Optional parameters. */ +export interface CloudEndpointsPreRestoreOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface CloudEndpointsRestoreheartbeatOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the restoreheartbeat operation. */ +export type CloudEndpointsRestoreheartbeatResponse = CloudEndpointsRestoreheartbeatHeaders; + +/** Optional parameters. */ +export interface CloudEndpointsPostRestoreOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface CloudEndpointsTriggerChangeDetectionOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Optional parameters. */ +export interface ServerEndpointsCreateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the create operation. */ +export type ServerEndpointsCreateResponse = ServerEndpointsCreateHeaders & + ServerEndpoint; + +/** Optional parameters. */ +export interface ServerEndpointsUpdateOptionalParams + extends coreClient.OperationOptions { + /** Any of the properties applicable in PUT request. */ + parameters?: ServerEndpointUpdateParameters; + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the update operation. */ +export type ServerEndpointsUpdateResponse = ServerEndpointsUpdateHeaders & + ServerEndpoint; + +/** Optional parameters. */ +export interface ServerEndpointsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type ServerEndpointsGetResponse = ServerEndpointsGetHeaders & + ServerEndpoint; + +/** Optional parameters. */ +export interface ServerEndpointsDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the delete operation. */ +export type ServerEndpointsDeleteResponse = ServerEndpointsDeleteHeaders; + +/** Optional parameters. */ +export interface ServerEndpointsListBySyncGroupOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listBySyncGroup operation. */ +export type ServerEndpointsListBySyncGroupResponse = ServerEndpointsListBySyncGroupHeaders & + ServerEndpointArray; + +/** Optional parameters. */ +export interface ServerEndpointsRecallActionOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the recallAction operation. */ +export type ServerEndpointsRecallActionResponse = ServerEndpointsRecallActionHeaders; + +/** Optional parameters. */ +export interface RegisteredServersListByStorageSyncServiceOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByStorageSyncService operation. */ +export type RegisteredServersListByStorageSyncServiceResponse = RegisteredServersListByStorageSyncServiceHeaders & + RegisteredServerArray; + +/** Optional parameters. */ +export interface RegisteredServersGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type RegisteredServersGetResponse = RegisteredServersGetHeaders & + RegisteredServer; + +/** Optional parameters. */ +export interface RegisteredServersCreateOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the create operation. */ +export type RegisteredServersCreateResponse = RegisteredServersCreateHeaders & + RegisteredServer; + +/** Optional parameters. */ +export interface RegisteredServersDeleteOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the delete operation. */ +export type RegisteredServersDeleteResponse = RegisteredServersDeleteHeaders; + +/** Optional parameters. */ +export interface RegisteredServersTriggerRolloverOptionalParams + extends coreClient.OperationOptions { + /** Delay to wait until next poll, in milliseconds. */ + updateIntervalInMs?: number; + /** A serialized poller which can be used to resume an existing paused Long-Running-Operation. */ + resumeFrom?: string; +} + +/** Contains response data for the triggerRollover operation. */ +export type RegisteredServersTriggerRolloverResponse = RegisteredServersTriggerRolloverHeaders; + +/** Optional parameters. */ +export interface WorkflowsListByStorageSyncServiceOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the listByStorageSyncService operation. */ +export type WorkflowsListByStorageSyncServiceResponse = WorkflowsListByStorageSyncServiceHeaders & + WorkflowArray; + +/** Optional parameters. */ +export interface WorkflowsGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type WorkflowsGetResponse = WorkflowsGetHeaders & Workflow; + +/** Optional parameters. */ +export interface WorkflowsAbortOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the abort operation. */ +export type WorkflowsAbortResponse = WorkflowsAbortHeaders; + +/** Optional parameters. */ +export interface OperationStatusGetOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the get operation. */ +export type OperationStatusGetResponse = OperationStatusGetHeaders & + OperationStatus; + +/** Optional parameters. */ +export interface LocationOperationStatusOptionalParams + extends coreClient.OperationOptions {} + +/** Contains response data for the locationOperationStatus operation. */ +export type LocationOperationStatusResponse = MicrosoftStorageSyncLocationOperationStatusHeaders & + LocationOperationStatus; + +/** Optional parameters. */ +export interface MicrosoftStorageSyncOptionalParams + extends coreClient.ServiceClientOptions { + /** server parameter */ + $host?: string; + /** Api Version */ + apiVersion?: string; + /** Overrides client endpoint. */ + endpoint?: string; +} diff --git a/sdk/storagesync/arm-storagesync/src/models/mappers.ts b/sdk/storagesync/arm-storagesync/src/models/mappers.ts index 5a0f25e6e36..56e7b37c872 100644 --- a/sdk/storagesync/arm-storagesync/src/models/mappers.ts +++ b/sdk/storagesync/arm-storagesync/src/models/mappers.ts @@ -1,37 +1,100 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import { CloudErrorMapper, BaseResourceMapper } from "@azure/ms-rest-azure-js"; -import * as msRest from "@azure/ms-rest-js"; +import * as coreClient from "@azure/core-client"; -export const CloudError = CloudErrorMapper; -export const BaseResource = BaseResourceMapper; - -export const StorageSyncErrorDetails: msRest.CompositeMapper = { - serializedName: "StorageSyncErrorDetails", +export const OperationEntityListResult: coreClient.CompositeMapper = { type: { name: "Composite", - className: "StorageSyncErrorDetails", + className: "OperationEntityListResult", modelProperties: { - code: { - serializedName: "code", + nextLink: { + serializedName: "nextLink", type: { name: "String" } }, - message: { - serializedName: "message", + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OperationEntity" + } + } + } + } + } + } +}; + +export const OperationEntity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationEntity", + modelProperties: { + name: { + serializedName: "name", type: { name: "String" } }, - target: { - serializedName: "target", + display: { + serializedName: "display", + type: { + name: "Composite", + className: "OperationDisplayInfo" + } + }, + origin: { + serializedName: "origin", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Composite", + className: "OperationProperties" + } + } + } + } +}; + +export const OperationDisplayInfo: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplayInfo", + modelProperties: { + description: { + serializedName: "description", + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + type: { + name: "String" + } + }, + provider: { + serializedName: "provider", + type: { + name: "String" + } + }, + resource: { + serializedName: "resource", type: { name: "String" } @@ -40,8 +103,151 @@ export const StorageSyncErrorDetails: msRest.CompositeMapper = { } }; -export const StorageSyncApiError: msRest.CompositeMapper = { - serializedName: "StorageSyncApiError", +export const OperationProperties: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationProperties", + modelProperties: { + serviceSpecification: { + serializedName: "serviceSpecification", + type: { + name: "Composite", + className: "OperationResourceServiceSpecification" + } + } + } + } +}; + +export const OperationResourceServiceSpecification: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationResourceServiceSpecification", + modelProperties: { + metricSpecifications: { + serializedName: "metricSpecifications", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OperationResourceMetricSpecification" + } + } + } + } + } + } +}; + +export const OperationResourceMetricSpecification: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationResourceMetricSpecification", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + displayDescription: { + serializedName: "displayDescription", + type: { + name: "String" + } + }, + unit: { + serializedName: "unit", + type: { + name: "String" + } + }, + aggregationType: { + serializedName: "aggregationType", + type: { + name: "String" + } + }, + fillGapWithZero: { + serializedName: "fillGapWithZero", + type: { + name: "Boolean" + } + }, + dimensions: { + serializedName: "dimensions", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "OperationResourceMetricSpecificationDimension" + } + } + } + } + } + } +}; + +export const OperationResourceMetricSpecificationDimension: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationResourceMetricSpecificationDimension", + modelProperties: { + name: { + serializedName: "name", + type: { + name: "String" + } + }, + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + toBeExportedForShoebox: { + serializedName: "toBeExportedForShoebox", + type: { + name: "Boolean" + } + } + } + } +}; + +export const StorageSyncError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageSyncError", + modelProperties: { + error: { + serializedName: "error", + type: { + name: "Composite", + className: "StorageSyncApiError" + } + }, + innererror: { + serializedName: "innererror", + type: { + name: "Composite", + className: "StorageSyncApiError" + } + } + } + } +}; + +export const StorageSyncApiError: coreClient.CompositeMapper = { type: { name: "Composite", className: "StorageSyncApiError", @@ -70,17 +276,1783 @@ export const StorageSyncApiError: msRest.CompositeMapper = { name: "Composite", className: "StorageSyncErrorDetails" } + }, + innerError: { + serializedName: "innerError", + type: { + name: "Composite", + className: "StorageSyncInnerErrorDetails" + } } } } }; -export const StorageSyncError: msRest.CompositeMapper = { - serializedName: "StorageSyncError", +export const StorageSyncErrorDetails: coreClient.CompositeMapper = { type: { name: "Composite", - className: "StorageSyncError", + className: "StorageSyncErrorDetails", modelProperties: { + code: { + serializedName: "code", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + }, + target: { + serializedName: "target", + type: { + name: "String" + } + }, + requestUri: { + serializedName: "requestUri", + type: { + name: "String" + } + }, + exceptionType: { + serializedName: "exceptionType", + type: { + name: "String" + } + }, + httpMethod: { + serializedName: "httpMethod", + type: { + name: "String" + } + }, + hashedMessage: { + serializedName: "hashedMessage", + type: { + name: "String" + } + }, + httpErrorCode: { + serializedName: "httpErrorCode", + type: { + name: "String" + } + } + } + } +}; + +export const StorageSyncInnerErrorDetails: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageSyncInnerErrorDetails", + modelProperties: { + callStack: { + serializedName: "callStack", + type: { + name: "String" + } + }, + message: { + serializedName: "message", + type: { + name: "String" + } + }, + innerException: { + serializedName: "innerException", + type: { + name: "String" + } + }, + innerExceptionCallStack: { + serializedName: "innerExceptionCallStack", + type: { + name: "String" + } + } + } + } +}; + +export const CheckNameAvailabilityParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CheckNameAvailabilityParameters", + modelProperties: { + name: { + serializedName: "name", + required: true, + type: { + name: "String" + } + }, + type: { + defaultValue: "Microsoft.StorageSync/storageSyncServices", + isConstant: true, + serializedName: "type", + type: { + name: "String" + } + } + } + } +}; + +export const CheckNameAvailabilityResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CheckNameAvailabilityResult", + modelProperties: { + nameAvailable: { + serializedName: "nameAvailable", + readOnly: true, + type: { + name: "Boolean" + } + }, + reason: { + serializedName: "reason", + readOnly: true, + type: { + name: "Enum", + allowedValues: ["Invalid", "AlreadyExists"] + } + }, + message: { + serializedName: "message", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const StorageSyncServiceCreateParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageSyncServiceCreateParameters", + modelProperties: { + location: { + serializedName: "location", + required: true, + type: { + name: "String" + } + }, + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + incomingTrafficPolicy: { + serializedName: "properties.incomingTrafficPolicy", + type: { + name: "String" + } + } + } + } +}; + +export const PrivateEndpoint: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateEndpoint", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const PrivateLinkServiceConnectionState: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateLinkServiceConnectionState", + modelProperties: { + status: { + serializedName: "status", + type: { + name: "String" + } + }, + description: { + serializedName: "description", + type: { + name: "String" + } + }, + actionsRequired: { + serializedName: "actionsRequired", + type: { + name: "String" + } + } + } + } +}; + +export const Resource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "Resource", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + type: { + serializedName: "type", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const StorageSyncServiceUpdateParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageSyncServiceUpdateParameters", + modelProperties: { + tags: { + serializedName: "tags", + type: { + name: "Dictionary", + value: { type: { name: "String" } } + } + }, + incomingTrafficPolicy: { + serializedName: "properties.incomingTrafficPolicy", + type: { + name: "String" + } + } + } + } +}; + +export const StorageSyncServiceArray: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageSyncServiceArray", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "StorageSyncService" + } + } + } + } + } + } +}; + +export const PrivateLinkResourceListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateLinkResourceListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PrivateLinkResource" + } + } + } + } + } + } +}; + +export const PrivateEndpointConnectionListResult: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateEndpointConnectionListResult", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PrivateEndpointConnection" + } + } + } + } + } + } +}; + +export const SyncGroupArray: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SyncGroupArray", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "SyncGroup" + } + } + } + } + } + } +}; + +export const CloudEndpointChangeEnumerationStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CloudEndpointChangeEnumerationStatus", + modelProperties: { + lastUpdatedTimestamp: { + serializedName: "lastUpdatedTimestamp", + readOnly: true, + type: { + name: "DateTime" + } + }, + lastEnumerationStatus: { + serializedName: "lastEnumerationStatus", + type: { + name: "Composite", + className: "CloudEndpointLastChangeEnumerationStatus" + } + }, + activity: { + serializedName: "activity", + type: { + name: "Composite", + className: "CloudEndpointChangeEnumerationActivity" + } + } + } + } +}; + +export const CloudEndpointLastChangeEnumerationStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CloudEndpointLastChangeEnumerationStatus", + modelProperties: { + startedTimestamp: { + serializedName: "startedTimestamp", + readOnly: true, + type: { + name: "DateTime" + } + }, + completedTimestamp: { + serializedName: "completedTimestamp", + readOnly: true, + type: { + name: "DateTime" + } + }, + namespaceFilesCount: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "namespaceFilesCount", + readOnly: true, + type: { + name: "Number" + } + }, + namespaceDirectoriesCount: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "namespaceDirectoriesCount", + readOnly: true, + type: { + name: "Number" + } + }, + namespaceSizeBytes: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "namespaceSizeBytes", + readOnly: true, + type: { + name: "Number" + } + }, + nextRunTimestamp: { + serializedName: "nextRunTimestamp", + readOnly: true, + type: { + name: "DateTime" + } + } + } + } +}; + +export const CloudEndpointChangeEnumerationActivity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CloudEndpointChangeEnumerationActivity", + modelProperties: { + lastUpdatedTimestamp: { + serializedName: "lastUpdatedTimestamp", + readOnly: true, + type: { + name: "DateTime" + } + }, + operationState: { + serializedName: "operationState", + readOnly: true, + type: { + name: "String" + } + }, + statusCode: { + serializedName: "statusCode", + readOnly: true, + type: { + name: "Number" + } + }, + startedTimestamp: { + serializedName: "startedTimestamp", + readOnly: true, + type: { + name: "DateTime" + } + }, + processedFilesCount: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "processedFilesCount", + readOnly: true, + type: { + name: "Number" + } + }, + processedDirectoriesCount: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "processedDirectoriesCount", + readOnly: true, + type: { + name: "Number" + } + }, + totalFilesCount: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "totalFilesCount", + readOnly: true, + type: { + name: "Number" + } + }, + totalDirectoriesCount: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "totalDirectoriesCount", + readOnly: true, + type: { + name: "Number" + } + }, + totalSizeBytes: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "totalSizeBytes", + readOnly: true, + type: { + name: "Number" + } + }, + progressPercent: { + constraints: { + InclusiveMaximum: 100, + InclusiveMinimum: 0 + }, + serializedName: "progressPercent", + readOnly: true, + type: { + name: "Number" + } + }, + minutesRemaining: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "minutesRemaining", + readOnly: true, + type: { + name: "Number" + } + }, + totalCountsState: { + serializedName: "totalCountsState", + readOnly: true, + type: { + name: "String" + } + }, + deletesProgressPercent: { + constraints: { + InclusiveMaximum: 100, + InclusiveMinimum: 0 + }, + serializedName: "deletesProgressPercent", + readOnly: true, + type: { + name: "Number" + } + } + } + } +}; + +export const CloudEndpointArray: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CloudEndpointArray", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "CloudEndpoint" + } + } + } + } + } + } +}; + +export const BackupRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "BackupRequest", + modelProperties: { + azureFileShare: { + serializedName: "azureFileShare", + type: { + name: "String" + } + } + } + } +}; + +export const PostBackupResponse: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PostBackupResponse", + modelProperties: { + cloudEndpointName: { + serializedName: "backupMetadata.cloudEndpointName", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const PreRestoreRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PreRestoreRequest", + modelProperties: { + partition: { + serializedName: "partition", + type: { + name: "String" + } + }, + replicaGroup: { + serializedName: "replicaGroup", + type: { + name: "String" + } + }, + requestId: { + serializedName: "requestId", + type: { + name: "String" + } + }, + azureFileShareUri: { + serializedName: "azureFileShareUri", + type: { + name: "String" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + }, + sourceAzureFileShareUri: { + serializedName: "sourceAzureFileShareUri", + type: { + name: "String" + } + }, + backupMetadataPropertyBag: { + serializedName: "backupMetadataPropertyBag", + type: { + name: "String" + } + }, + restoreFileSpec: { + serializedName: "restoreFileSpec", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "RestoreFileSpec" + } + } + } + }, + pauseWaitForSyncDrainTimePeriodInSeconds: { + serializedName: "pauseWaitForSyncDrainTimePeriodInSeconds", + type: { + name: "Number" + } + } + } + } +}; + +export const RestoreFileSpec: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RestoreFileSpec", + modelProperties: { + path: { + serializedName: "path", + type: { + name: "String" + } + }, + isdir: { + serializedName: "isdir", + type: { + name: "Boolean" + } + } + } + } +}; + +export const PostRestoreRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PostRestoreRequest", + modelProperties: { + partition: { + serializedName: "partition", + type: { + name: "String" + } + }, + replicaGroup: { + serializedName: "replicaGroup", + type: { + name: "String" + } + }, + requestId: { + serializedName: "requestId", + type: { + name: "String" + } + }, + azureFileShareUri: { + serializedName: "azureFileShareUri", + type: { + name: "String" + } + }, + status: { + serializedName: "status", + type: { + name: "String" + } + }, + sourceAzureFileShareUri: { + serializedName: "sourceAzureFileShareUri", + type: { + name: "String" + } + }, + failedFileList: { + serializedName: "failedFileList", + type: { + name: "String" + } + }, + restoreFileSpec: { + serializedName: "restoreFileSpec", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "RestoreFileSpec" + } + } + } + } + } + } +}; + +export const TriggerChangeDetectionParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TriggerChangeDetectionParameters", + modelProperties: { + directoryPath: { + serializedName: "directoryPath", + type: { + name: "String" + } + }, + changeDetectionMode: { + serializedName: "changeDetectionMode", + type: { + name: "String" + } + }, + paths: { + serializedName: "paths", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const ServerEndpointSyncStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ServerEndpointSyncStatus", + modelProperties: { + downloadHealth: { + serializedName: "downloadHealth", + readOnly: true, + type: { + name: "String" + } + }, + uploadHealth: { + serializedName: "uploadHealth", + readOnly: true, + type: { + name: "String" + } + }, + combinedHealth: { + serializedName: "combinedHealth", + readOnly: true, + type: { + name: "String" + } + }, + syncActivity: { + serializedName: "syncActivity", + readOnly: true, + type: { + name: "String" + } + }, + totalPersistentFilesNotSyncingCount: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "totalPersistentFilesNotSyncingCount", + readOnly: true, + type: { + name: "Number" + } + }, + lastUpdatedTimestamp: { + serializedName: "lastUpdatedTimestamp", + readOnly: true, + type: { + name: "DateTime" + } + }, + uploadStatus: { + serializedName: "uploadStatus", + type: { + name: "Composite", + className: "ServerEndpointSyncSessionStatus" + } + }, + downloadStatus: { + serializedName: "downloadStatus", + type: { + name: "Composite", + className: "ServerEndpointSyncSessionStatus" + } + }, + uploadActivity: { + serializedName: "uploadActivity", + type: { + name: "Composite", + className: "ServerEndpointSyncActivityStatus" + } + }, + downloadActivity: { + serializedName: "downloadActivity", + type: { + name: "Composite", + className: "ServerEndpointSyncActivityStatus" + } + }, + offlineDataTransferStatus: { + serializedName: "offlineDataTransferStatus", + readOnly: true, + type: { + name: "String" + } + }, + backgroundDataDownloadActivity: { + serializedName: "backgroundDataDownloadActivity", + type: { + name: "Composite", + className: "ServerEndpointBackgroundDataDownloadActivity" + } + } + } + } +}; + +export const ServerEndpointSyncSessionStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ServerEndpointSyncSessionStatus", + modelProperties: { + lastSyncResult: { + serializedName: "lastSyncResult", + readOnly: true, + type: { + name: "Number" + } + }, + lastSyncTimestamp: { + serializedName: "lastSyncTimestamp", + readOnly: true, + type: { + name: "DateTime" + } + }, + lastSyncSuccessTimestamp: { + serializedName: "lastSyncSuccessTimestamp", + readOnly: true, + type: { + name: "DateTime" + } + }, + lastSyncPerItemErrorCount: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "lastSyncPerItemErrorCount", + readOnly: true, + type: { + name: "Number" + } + }, + persistentFilesNotSyncingCount: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "persistentFilesNotSyncingCount", + readOnly: true, + type: { + name: "Number" + } + }, + transientFilesNotSyncingCount: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "transientFilesNotSyncingCount", + readOnly: true, + type: { + name: "Number" + } + }, + filesNotSyncingErrors: { + serializedName: "filesNotSyncingErrors", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ServerEndpointFilesNotSyncingError" + } + } + } + }, + lastSyncMode: { + serializedName: "lastSyncMode", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const ServerEndpointFilesNotSyncingError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ServerEndpointFilesNotSyncingError", + modelProperties: { + errorCode: { + serializedName: "errorCode", + readOnly: true, + type: { + name: "Number" + } + }, + persistentCount: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "persistentCount", + readOnly: true, + type: { + name: "Number" + } + }, + transientCount: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "transientCount", + readOnly: true, + type: { + name: "Number" + } + } + } + } +}; + +export const ServerEndpointSyncActivityStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ServerEndpointSyncActivityStatus", + modelProperties: { + timestamp: { + serializedName: "timestamp", + readOnly: true, + type: { + name: "DateTime" + } + }, + perItemErrorCount: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "perItemErrorCount", + readOnly: true, + type: { + name: "Number" + } + }, + appliedItemCount: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "appliedItemCount", + readOnly: true, + type: { + name: "Number" + } + }, + totalItemCount: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "totalItemCount", + readOnly: true, + type: { + name: "Number" + } + }, + appliedBytes: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "appliedBytes", + readOnly: true, + type: { + name: "Number" + } + }, + totalBytes: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "totalBytes", + readOnly: true, + type: { + name: "Number" + } + }, + syncMode: { + serializedName: "syncMode", + readOnly: true, + type: { + name: "String" + } + }, + sessionMinutesRemaining: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "sessionMinutesRemaining", + readOnly: true, + type: { + name: "Number" + } + } + } + } +}; + +export const ServerEndpointBackgroundDataDownloadActivity: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ServerEndpointBackgroundDataDownloadActivity", + modelProperties: { + timestamp: { + serializedName: "timestamp", + readOnly: true, + type: { + name: "DateTime" + } + }, + startedTimestamp: { + serializedName: "startedTimestamp", + readOnly: true, + type: { + name: "DateTime" + } + }, + percentProgress: { + constraints: { + InclusiveMaximum: 100, + InclusiveMinimum: 0 + }, + serializedName: "percentProgress", + readOnly: true, + type: { + name: "Number" + } + }, + downloadedBytes: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "downloadedBytes", + readOnly: true, + type: { + name: "Number" + } + } + } + } +}; + +export const ServerEndpointCloudTieringStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ServerEndpointCloudTieringStatus", + modelProperties: { + lastUpdatedTimestamp: { + serializedName: "lastUpdatedTimestamp", + readOnly: true, + type: { + name: "DateTime" + } + }, + health: { + serializedName: "health", + readOnly: true, + type: { + name: "String" + } + }, + healthLastUpdatedTimestamp: { + serializedName: "healthLastUpdatedTimestamp", + readOnly: true, + type: { + name: "DateTime" + } + }, + lastCloudTieringResult: { + serializedName: "lastCloudTieringResult", + readOnly: true, + type: { + name: "Number" + } + }, + lastSuccessTimestamp: { + serializedName: "lastSuccessTimestamp", + readOnly: true, + type: { + name: "DateTime" + } + }, + spaceSavings: { + serializedName: "spaceSavings", + type: { + name: "Composite", + className: "CloudTieringSpaceSavings" + } + }, + cachePerformance: { + serializedName: "cachePerformance", + type: { + name: "Composite", + className: "CloudTieringCachePerformance" + } + }, + filesNotTiering: { + serializedName: "filesNotTiering", + type: { + name: "Composite", + className: "CloudTieringFilesNotTiering" + } + }, + volumeFreeSpacePolicyStatus: { + serializedName: "volumeFreeSpacePolicyStatus", + type: { + name: "Composite", + className: "CloudTieringVolumeFreeSpacePolicyStatus" + } + }, + datePolicyStatus: { + serializedName: "datePolicyStatus", + type: { + name: "Composite", + className: "CloudTieringDatePolicyStatus" + } + } + } + } +}; + +export const CloudTieringSpaceSavings: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CloudTieringSpaceSavings", + modelProperties: { + lastUpdatedTimestamp: { + serializedName: "lastUpdatedTimestamp", + readOnly: true, + type: { + name: "DateTime" + } + }, + volumeSizeBytes: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "volumeSizeBytes", + readOnly: true, + type: { + name: "Number" + } + }, + totalSizeCloudBytes: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "totalSizeCloudBytes", + readOnly: true, + type: { + name: "Number" + } + }, + cachedSizeBytes: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "cachedSizeBytes", + readOnly: true, + type: { + name: "Number" + } + }, + spaceSavingsPercent: { + constraints: { + InclusiveMaximum: 100, + InclusiveMinimum: 0 + }, + serializedName: "spaceSavingsPercent", + readOnly: true, + type: { + name: "Number" + } + }, + spaceSavingsBytes: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "spaceSavingsBytes", + readOnly: true, + type: { + name: "Number" + } + } + } + } +}; + +export const CloudTieringCachePerformance: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CloudTieringCachePerformance", + modelProperties: { + lastUpdatedTimestamp: { + serializedName: "lastUpdatedTimestamp", + readOnly: true, + type: { + name: "DateTime" + } + }, + cacheHitBytes: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "cacheHitBytes", + readOnly: true, + type: { + name: "Number" + } + }, + cacheMissBytes: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "cacheMissBytes", + readOnly: true, + type: { + name: "Number" + } + }, + cacheHitBytesPercent: { + constraints: { + InclusiveMaximum: 100, + InclusiveMinimum: 0 + }, + serializedName: "cacheHitBytesPercent", + readOnly: true, + type: { + name: "Number" + } + } + } + } +}; + +export const CloudTieringFilesNotTiering: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CloudTieringFilesNotTiering", + modelProperties: { + lastUpdatedTimestamp: { + serializedName: "lastUpdatedTimestamp", + readOnly: true, + type: { + name: "DateTime" + } + }, + totalFileCount: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "totalFileCount", + readOnly: true, + type: { + name: "Number" + } + }, + errors: { + serializedName: "errors", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "FilesNotTieringError" + } + } + } + } + } + } +}; + +export const FilesNotTieringError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "FilesNotTieringError", + modelProperties: { + errorCode: { + serializedName: "errorCode", + readOnly: true, + type: { + name: "Number" + } + }, + fileCount: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "fileCount", + readOnly: true, + type: { + name: "Number" + } + } + } + } +}; + +export const CloudTieringVolumeFreeSpacePolicyStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CloudTieringVolumeFreeSpacePolicyStatus", + modelProperties: { + lastUpdatedTimestamp: { + serializedName: "lastUpdatedTimestamp", + readOnly: true, + type: { + name: "DateTime" + } + }, + effectiveVolumeFreeSpacePolicy: { + constraints: { + InclusiveMaximum: 100, + InclusiveMinimum: 0 + }, + serializedName: "effectiveVolumeFreeSpacePolicy", + readOnly: true, + type: { + name: "Number" + } + }, + currentVolumeFreeSpacePercent: { + constraints: { + InclusiveMaximum: 100, + InclusiveMinimum: 0 + }, + serializedName: "currentVolumeFreeSpacePercent", + readOnly: true, + type: { + name: "Number" + } + } + } + } +}; + +export const CloudTieringDatePolicyStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CloudTieringDatePolicyStatus", + modelProperties: { + lastUpdatedTimestamp: { + serializedName: "lastUpdatedTimestamp", + readOnly: true, + type: { + name: "DateTime" + } + }, + tieredFilesMostRecentAccessTimestamp: { + serializedName: "tieredFilesMostRecentAccessTimestamp", + readOnly: true, + type: { + name: "DateTime" + } + } + } + } +}; + +export const ServerEndpointRecallStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ServerEndpointRecallStatus", + modelProperties: { + lastUpdatedTimestamp: { + serializedName: "lastUpdatedTimestamp", + readOnly: true, + type: { + name: "DateTime" + } + }, + totalRecallErrorsCount: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "totalRecallErrorsCount", + readOnly: true, + type: { + name: "Number" + } + }, + recallErrors: { + serializedName: "recallErrors", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ServerEndpointRecallError" + } + } + } + } + } + } +}; + +export const ServerEndpointRecallError: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ServerEndpointRecallError", + modelProperties: { + errorCode: { + serializedName: "errorCode", + readOnly: true, + type: { + name: "Number" + } + }, + count: { + constraints: { + InclusiveMinimum: 0 + }, + serializedName: "count", + readOnly: true, + type: { + name: "Number" + } + } + } + } +}; + +export const ServerEndpointUpdateParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ServerEndpointUpdateParameters", + modelProperties: { + cloudTiering: { + serializedName: "properties.cloudTiering", + type: { + name: "String" + } + }, + volumeFreeSpacePercent: { + constraints: { + InclusiveMaximum: 100, + InclusiveMinimum: 0 + }, + serializedName: "properties.volumeFreeSpacePercent", + type: { + name: "Number" + } + }, + tierFilesOlderThanDays: { + constraints: { + InclusiveMaximum: 2147483647, + InclusiveMinimum: 0 + }, + serializedName: "properties.tierFilesOlderThanDays", + type: { + name: "Number" + } + }, + offlineDataTransfer: { + serializedName: "properties.offlineDataTransfer", + type: { + name: "String" + } + }, + offlineDataTransferShareName: { + serializedName: "properties.offlineDataTransferShareName", + type: { + name: "String" + } + }, + localCacheMode: { + serializedName: "properties.localCacheMode", + type: { + name: "String" + } + } + } + } +}; + +export const ServerEndpointArray: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "ServerEndpointArray", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "ServerEndpoint" + } + } + } + } + } + } +}; + +export const RecallActionParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RecallActionParameters", + modelProperties: { + pattern: { + serializedName: "pattern", + type: { + name: "String" + } + }, + recallPath: { + serializedName: "recallPath", + type: { + name: "String" + } + } + } + } +}; + +export const RegisteredServerArray: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "RegisteredServerArray", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "RegisteredServer" + } + } + } + } + } + } +}; + +export const TriggerRolloverRequest: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "TriggerRolloverRequest", + modelProperties: { + serverCertificate: { + serializedName: "serverCertificate", + type: { + name: "String" + } + } + } + } +}; + +export const WorkflowArray: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "WorkflowArray", + modelProperties: { + value: { + serializedName: "value", + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "Workflow" + } + } + } + } + } + } +}; + +export const OperationStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationStatus", + modelProperties: { + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + status: { + serializedName: "status", + readOnly: true, + type: { + name: "String" + } + }, + startTime: { + serializedName: "startTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + endTime: { + serializedName: "endTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + error: { + serializedName: "error", + type: { + name: "Composite", + className: "StorageSyncApiError" + } + } + } + } +}; + +export const LocationOperationStatus: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "LocationOperationStatus", + modelProperties: { + id: { + serializedName: "id", + readOnly: true, + type: { + name: "String" + } + }, + name: { + serializedName: "name", + readOnly: true, + type: { + name: "String" + } + }, + status: { + serializedName: "status", + readOnly: true, + type: { + name: "String" + } + }, + startTime: { + serializedName: "startTime", + readOnly: true, + type: { + name: "DateTime" + } + }, + endTime: { + serializedName: "endTime", + readOnly: true, + type: { + name: "DateTime" + } + }, error: { serializedName: "error", type: { @@ -88,19 +2060,18 @@ export const StorageSyncError: msRest.CompositeMapper = { className: "StorageSyncApiError" } }, - innererror: { - serializedName: "innererror", + percentComplete: { + serializedName: "percentComplete", + readOnly: true, type: { - name: "Composite", - className: "StorageSyncApiError" + name: "Number" } } } } }; -export const SubscriptionState: msRest.CompositeMapper = { - serializedName: "SubscriptionState", +export const SubscriptionState: coreClient.CompositeMapper = { type: { name: "Composite", className: "SubscriptionState", @@ -112,8 +2083,8 @@ export const SubscriptionState: msRest.CompositeMapper = { } }, istransitioning: { - readOnly: true, serializedName: "istransitioning", + readOnly: true, type: { name: "Boolean" } @@ -121,36 +2092,65 @@ export const SubscriptionState: msRest.CompositeMapper = { properties: { serializedName: "properties", type: { - name: "Object" + name: "Dictionary", + value: { type: { name: "any" } } } } } } }; -export const Resource: msRest.CompositeMapper = { - serializedName: "Resource", +export const ResourcesMoveInfo: coreClient.CompositeMapper = { type: { name: "Composite", - className: "Resource", + className: "ResourcesMoveInfo", modelProperties: { - id: { - readOnly: true, - serializedName: "id", + targetResourceGroup: { + serializedName: "targetResourceGroup", type: { name: "String" } }, - name: { - readOnly: true, - serializedName: "name", + resources: { + serializedName: "resources", + type: { + name: "Sequence", + element: { + type: { + name: "String" + } + } + } + } + } + } +}; + +export const OperationDisplayResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationDisplayResource", + modelProperties: { + provider: { + serializedName: "provider", type: { name: "String" } }, - type: { - readOnly: true, - serializedName: "type", + resource: { + serializedName: "resource", + type: { + name: "String" + } + }, + operation: { + serializedName: "operation", + type: { + name: "String" + } + }, + description: { + serializedName: "description", type: { name: "String" } @@ -159,8 +2159,38 @@ export const Resource: msRest.CompositeMapper = { } }; -export const TrackedResource: msRest.CompositeMapper = { - serializedName: "TrackedResource", +export const PrivateEndpointConnection: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateEndpointConnection", + modelProperties: { + ...Resource.type.modelProperties, + privateEndpoint: { + serializedName: "properties.privateEndpoint", + type: { + name: "Composite", + className: "PrivateEndpoint" + } + }, + privateLinkServiceConnectionState: { + serializedName: "properties.privateLinkServiceConnectionState", + type: { + name: "Composite", + className: "PrivateLinkServiceConnectionState" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + } + } + } +}; + +export const TrackedResource: coreClient.CompositeMapper = { type: { name: "Composite", className: "TrackedResource", @@ -170,51 +2200,61 @@ export const TrackedResource: msRest.CompositeMapper = { serializedName: "tags", type: { name: "Dictionary", - value: { + value: { type: { name: "String" } } + } + }, + location: { + serializedName: "location", + required: true, + type: { + name: "String" + } + } + } + } +}; + +export const PrivateLinkResource: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateLinkResource", + modelProperties: { + ...Resource.type.modelProperties, + groupId: { + serializedName: "properties.groupId", + readOnly: true, + type: { + name: "String" + } + }, + requiredMembers: { + serializedName: "properties.requiredMembers", + readOnly: true, + type: { + name: "Sequence", + element: { type: { name: "String" } } } }, - location: { - required: true, - serializedName: "location", + requiredZoneNames: { + serializedName: "properties.requiredZoneNames", type: { - name: "String" + name: "Sequence", + element: { + type: { + name: "String" + } + } } } } } }; -export const StorageSyncService: msRest.CompositeMapper = { - serializedName: "StorageSyncService", - type: { - name: "Composite", - className: "StorageSyncService", - modelProperties: { - ...TrackedResource.type.modelProperties, - storageSyncServiceStatus: { - readOnly: true, - serializedName: "properties.storageSyncServiceStatus", - type: { - name: "Number" - } - }, - storageSyncServiceUid: { - readOnly: true, - serializedName: "properties.storageSyncServiceUid", - type: { - name: "String" - } - } - } - } -}; - -export const ProxyResource: msRest.CompositeMapper = { - serializedName: "ProxyResource", +export const ProxyResource: coreClient.CompositeMapper = { type: { name: "Composite", className: "ProxyResource", @@ -224,23 +2264,86 @@ export const ProxyResource: msRest.CompositeMapper = { } }; -export const SyncGroup: msRest.CompositeMapper = { - serializedName: "SyncGroup", +export const StorageSyncService: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageSyncService", + modelProperties: { + ...TrackedResource.type.modelProperties, + incomingTrafficPolicy: { + serializedName: "properties.incomingTrafficPolicy", + type: { + name: "String" + } + }, + storageSyncServiceStatus: { + serializedName: "properties.storageSyncServiceStatus", + readOnly: true, + type: { + name: "Number" + } + }, + storageSyncServiceUid: { + serializedName: "properties.storageSyncServiceUid", + readOnly: true, + type: { + name: "String" + } + }, + provisioningState: { + serializedName: "properties.provisioningState", + readOnly: true, + type: { + name: "String" + } + }, + lastWorkflowId: { + serializedName: "properties.lastWorkflowId", + readOnly: true, + type: { + name: "String" + } + }, + lastOperationName: { + serializedName: "properties.lastOperationName", + readOnly: true, + type: { + name: "String" + } + }, + privateEndpointConnections: { + serializedName: "properties.privateEndpointConnections", + readOnly: true, + type: { + name: "Sequence", + element: { + type: { + name: "Composite", + className: "PrivateEndpointConnection" + } + } + } + } + } + } +}; + +export const SyncGroup: coreClient.CompositeMapper = { type: { name: "Composite", className: "SyncGroup", modelProperties: { ...ProxyResource.type.modelProperties, uniqueId: { - readOnly: true, serializedName: "properties.uniqueId", + readOnly: true, type: { name: "String" } }, syncGroupStatus: { - readOnly: true, serializedName: "properties.syncGroupStatus", + readOnly: true, type: { name: "String" } @@ -249,8 +2352,58 @@ export const SyncGroup: msRest.CompositeMapper = { } }; -export const CloudEndpoint: msRest.CompositeMapper = { - serializedName: "CloudEndpoint", +export const SyncGroupCreateParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "SyncGroupCreateParameters", + modelProperties: { + ...ProxyResource.type.modelProperties, + properties: { + serializedName: "properties", + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const CloudEndpointCreateParameters: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "CloudEndpointCreateParameters", + modelProperties: { + ...ProxyResource.type.modelProperties, + storageAccountResourceId: { + serializedName: "properties.storageAccountResourceId", + type: { + name: "String" + } + }, + azureFileShareName: { + serializedName: "properties.azureFileShareName", + type: { + name: "String" + } + }, + storageAccountTenantId: { + serializedName: "properties.storageAccountTenantId", + type: { + name: "String" + } + }, + friendlyName: { + serializedName: "properties.friendlyName", + type: { + name: "String" + } + } + } + } +}; + +export const CloudEndpoint: coreClient.CompositeMapper = { type: { name: "Composite", className: "CloudEndpoint", @@ -287,8 +2440,8 @@ export const CloudEndpoint: msRest.CompositeMapper = { } }, backupEnabled: { - readOnly: true, serializedName: "properties.backupEnabled", + readOnly: true, type: { name: "String" } @@ -310,154 +2463,19 @@ export const CloudEndpoint: msRest.CompositeMapper = { type: { name: "String" } - } - } - } -}; - -export const TriggerChangeDetectionParameters: msRest.CompositeMapper = { - serializedName: "TriggerChangeDetectionParameters", - type: { - name: "Composite", - className: "TriggerChangeDetectionParameters", - modelProperties: { - directoryPath: { - serializedName: "directoryPath", - type: { - name: "String" - } }, - changeDetectionMode: { - serializedName: "changeDetectionMode", + changeEnumerationStatus: { + serializedName: "properties.changeEnumerationStatus", type: { - name: "String" - } - }, - paths: { - serializedName: "paths", - type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } + name: "Composite", + className: "CloudEndpointChangeEnumerationStatus" } } } } }; -export const RecallActionParameters: msRest.CompositeMapper = { - serializedName: "RecallActionParameters", - type: { - name: "Composite", - className: "RecallActionParameters", - modelProperties: { - pattern: { - serializedName: "pattern", - type: { - name: "String" - } - }, - recallPath: { - serializedName: "recallPath", - type: { - name: "String" - } - } - } - } -}; - -export const StorageSyncServiceCreateParameters: msRest.CompositeMapper = { - serializedName: "StorageSyncServiceCreateParameters", - type: { - name: "Composite", - className: "StorageSyncServiceCreateParameters", - modelProperties: { - location: { - required: true, - serializedName: "location", - type: { - name: "String" - } - }, - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { - type: { - name: "String" - } - } - } - }, - properties: { - serializedName: "properties", - type: { - name: "Object" - } - } - } - } -}; - -export const SyncGroupCreateParameters: msRest.CompositeMapper = { - serializedName: "SyncGroupCreateParameters", - type: { - name: "Composite", - className: "SyncGroupCreateParameters", - modelProperties: { - ...ProxyResource.type.modelProperties, - properties: { - serializedName: "properties", - type: { - name: "Object" - } - } - } - } -}; - -export const CloudEndpointCreateParameters: msRest.CompositeMapper = { - serializedName: "CloudEndpointCreateParameters", - type: { - name: "Composite", - className: "CloudEndpointCreateParameters", - modelProperties: { - ...ProxyResource.type.modelProperties, - storageAccountResourceId: { - serializedName: "properties.storageAccountResourceId", - type: { - name: "String" - } - }, - azureFileShareName: { - serializedName: "properties.azureFileShareName", - type: { - name: "String" - } - }, - storageAccountTenantId: { - serializedName: "properties.storageAccountTenantId", - type: { - name: "String" - } - }, - friendlyName: { - serializedName: "properties.friendlyName", - type: { - name: "String" - } - } - } - } -}; - -export const ServerEndpointCreateParameters: msRest.CompositeMapper = { - serializedName: "ServerEndpointCreateParameters", +export const ServerEndpointCreateParameters: coreClient.CompositeMapper = { type: { name: "Composite", className: "ServerEndpointCreateParameters", @@ -476,21 +2494,22 @@ export const ServerEndpointCreateParameters: msRest.CompositeMapper = { } }, volumeFreeSpacePercent: { - serializedName: "properties.volumeFreeSpacePercent", + defaultValue: 20, constraints: { InclusiveMaximum: 100, InclusiveMinimum: 0 }, + serializedName: "properties.volumeFreeSpacePercent", type: { name: "Number" } }, tierFilesOlderThanDays: { - serializedName: "properties.tierFilesOlderThanDays", constraints: { InclusiveMaximum: 2147483647, InclusiveMinimum: 0 }, + serializedName: "properties.tierFilesOlderThanDays", type: { name: "Number" } @@ -518,19 +2537,21 @@ export const ServerEndpointCreateParameters: msRest.CompositeMapper = { type: { name: "String" } - } - } - } -}; - -export const TriggerRolloverRequest: msRest.CompositeMapper = { - serializedName: "TriggerRolloverRequest", - type: { - name: "Composite", - className: "TriggerRolloverRequest", - modelProperties: { - serverCertificate: { - serializedName: "serverCertificate", + }, + initialDownloadPolicy: { + serializedName: "properties.initialDownloadPolicy", + type: { + name: "String" + } + }, + localCacheMode: { + serializedName: "properties.localCacheMode", + type: { + name: "String" + } + }, + initialUploadPolicy: { + serializedName: "properties.initialUploadPolicy", type: { name: "String" } @@ -539,498 +2560,7 @@ export const TriggerRolloverRequest: msRest.CompositeMapper = { } }; -export const RegisteredServerCreateParameters: msRest.CompositeMapper = { - serializedName: "RegisteredServerCreateParameters", - type: { - name: "Composite", - className: "RegisteredServerCreateParameters", - modelProperties: { - ...ProxyResource.type.modelProperties, - serverCertificate: { - serializedName: "properties.serverCertificate", - type: { - name: "String" - } - }, - agentVersion: { - serializedName: "properties.agentVersion", - type: { - name: "String" - } - }, - serverOSVersion: { - serializedName: "properties.serverOSVersion", - type: { - name: "String" - } - }, - lastHeartBeat: { - serializedName: "properties.lastHeartBeat", - type: { - name: "String" - } - }, - serverRole: { - serializedName: "properties.serverRole", - type: { - name: "String" - } - }, - clusterId: { - serializedName: "properties.clusterId", - type: { - name: "String" - } - }, - clusterName: { - serializedName: "properties.clusterName", - type: { - name: "String" - } - }, - serverId: { - serializedName: "properties.serverId", - type: { - name: "String" - } - }, - friendlyName: { - serializedName: "properties.friendlyName", - type: { - name: "String" - } - } - } - } -}; - -export const ServerEndpointUpdateParameters: msRest.CompositeMapper = { - serializedName: "ServerEndpointUpdateParameters", - type: { - name: "Composite", - className: "ServerEndpointUpdateParameters", - modelProperties: { - cloudTiering: { - serializedName: "properties.cloudTiering", - type: { - name: "String" - } - }, - volumeFreeSpacePercent: { - serializedName: "properties.volumeFreeSpacePercent", - constraints: { - InclusiveMaximum: 100, - InclusiveMinimum: 0 - }, - type: { - name: "Number" - } - }, - tierFilesOlderThanDays: { - serializedName: "properties.tierFilesOlderThanDays", - constraints: { - InclusiveMaximum: 2147483647, - InclusiveMinimum: 0 - }, - type: { - name: "Number" - } - }, - offlineDataTransfer: { - serializedName: "properties.offlineDataTransfer", - type: { - name: "String" - } - }, - offlineDataTransferShareName: { - serializedName: "properties.offlineDataTransferShareName", - type: { - name: "String" - } - } - } - } -}; - -export const ServerEndpointFilesNotSyncingError: msRest.CompositeMapper = { - serializedName: "ServerEndpointFilesNotSyncingError", - type: { - name: "Composite", - className: "ServerEndpointFilesNotSyncingError", - modelProperties: { - errorCode: { - readOnly: true, - serializedName: "errorCode", - type: { - name: "Number" - } - }, - persistentCount: { - readOnly: true, - serializedName: "persistentCount", - constraints: { - InclusiveMinimum: 0 - }, - type: { - name: "Number" - } - }, - transientCount: { - readOnly: true, - serializedName: "transientCount", - constraints: { - InclusiveMinimum: 0 - }, - type: { - name: "Number" - } - } - } - } -}; - -export const ServerEndpointSyncSessionStatus: msRest.CompositeMapper = { - serializedName: "ServerEndpointSyncSessionStatus", - type: { - name: "Composite", - className: "ServerEndpointSyncSessionStatus", - modelProperties: { - lastSyncResult: { - readOnly: true, - serializedName: "lastSyncResult", - type: { - name: "Number" - } - }, - lastSyncTimestamp: { - readOnly: true, - serializedName: "lastSyncTimestamp", - type: { - name: "DateTime" - } - }, - lastSyncSuccessTimestamp: { - readOnly: true, - serializedName: "lastSyncSuccessTimestamp", - type: { - name: "DateTime" - } - }, - lastSyncPerItemErrorCount: { - readOnly: true, - serializedName: "lastSyncPerItemErrorCount", - constraints: { - InclusiveMinimum: 0 - }, - type: { - name: "Number" - } - }, - persistentFilesNotSyncingCount: { - readOnly: true, - serializedName: "persistentFilesNotSyncingCount", - constraints: { - InclusiveMinimum: 0 - }, - type: { - name: "Number" - } - }, - transientFilesNotSyncingCount: { - readOnly: true, - serializedName: "transientFilesNotSyncingCount", - constraints: { - InclusiveMinimum: 0 - }, - type: { - name: "Number" - } - }, - filesNotSyncingErrors: { - readOnly: true, - serializedName: "filesNotSyncingErrors", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ServerEndpointFilesNotSyncingError" - } - } - } - } - } - } -}; - -export const ServerEndpointSyncActivityStatus: msRest.CompositeMapper = { - serializedName: "ServerEndpointSyncActivityStatus", - type: { - name: "Composite", - className: "ServerEndpointSyncActivityStatus", - modelProperties: { - timestamp: { - readOnly: true, - serializedName: "timestamp", - type: { - name: "DateTime" - } - }, - perItemErrorCount: { - readOnly: true, - serializedName: "perItemErrorCount", - constraints: { - InclusiveMinimum: 0 - }, - type: { - name: "Number" - } - }, - appliedItemCount: { - readOnly: true, - serializedName: "appliedItemCount", - constraints: { - InclusiveMinimum: 0 - }, - type: { - name: "Number" - } - }, - totalItemCount: { - readOnly: true, - serializedName: "totalItemCount", - constraints: { - InclusiveMinimum: 0 - }, - type: { - name: "Number" - } - }, - appliedBytes: { - readOnly: true, - serializedName: "appliedBytes", - constraints: { - InclusiveMinimum: 0 - }, - type: { - name: "Number" - } - }, - totalBytes: { - readOnly: true, - serializedName: "totalBytes", - constraints: { - InclusiveMinimum: 0 - }, - type: { - name: "Number" - } - } - } - } -}; - -export const ServerEndpointSyncStatus: msRest.CompositeMapper = { - serializedName: "ServerEndpointSyncStatus", - type: { - name: "Composite", - className: "ServerEndpointSyncStatus", - modelProperties: { - downloadHealth: { - readOnly: true, - serializedName: "downloadHealth", - type: { - name: "String" - } - }, - uploadHealth: { - readOnly: true, - serializedName: "uploadHealth", - type: { - name: "String" - } - }, - combinedHealth: { - readOnly: true, - serializedName: "combinedHealth", - type: { - name: "String" - } - }, - syncActivity: { - readOnly: true, - serializedName: "syncActivity", - type: { - name: "String" - } - }, - totalPersistentFilesNotSyncingCount: { - readOnly: true, - serializedName: "totalPersistentFilesNotSyncingCount", - constraints: { - InclusiveMinimum: 0 - }, - type: { - name: "Number" - } - }, - lastUpdatedTimestamp: { - readOnly: true, - serializedName: "lastUpdatedTimestamp", - type: { - name: "DateTime" - } - }, - uploadStatus: { - readOnly: true, - serializedName: "uploadStatus", - type: { - name: "Composite", - className: "ServerEndpointSyncSessionStatus" - } - }, - downloadStatus: { - readOnly: true, - serializedName: "downloadStatus", - type: { - name: "Composite", - className: "ServerEndpointSyncSessionStatus" - } - }, - uploadActivity: { - readOnly: true, - serializedName: "uploadActivity", - type: { - name: "Composite", - className: "ServerEndpointSyncActivityStatus" - } - }, - downloadActivity: { - readOnly: true, - serializedName: "downloadActivity", - type: { - name: "Composite", - className: "ServerEndpointSyncActivityStatus" - } - }, - offlineDataTransferStatus: { - readOnly: true, - serializedName: "offlineDataTransferStatus", - type: { - name: "String" - } - } - } - } -}; - -export const ServerEndpointCloudTieringStatus: msRest.CompositeMapper = { - serializedName: "ServerEndpointCloudTieringStatus", - type: { - name: "Composite", - className: "ServerEndpointCloudTieringStatus", - modelProperties: { - health: { - readOnly: true, - serializedName: "health", - type: { - name: "String" - } - }, - lastUpdatedTimestamp: { - readOnly: true, - serializedName: "lastUpdatedTimestamp", - type: { - name: "DateTime" - } - }, - lastCloudTieringResult: { - readOnly: true, - serializedName: "lastCloudTieringResult", - type: { - name: "Number" - } - }, - lastSuccessTimestamp: { - readOnly: true, - serializedName: "lastSuccessTimestamp", - type: { - name: "DateTime" - } - } - } - } -}; - -export const ServerEndpointRecallError: msRest.CompositeMapper = { - serializedName: "ServerEndpointRecallError", - type: { - name: "Composite", - className: "ServerEndpointRecallError", - modelProperties: { - errorCode: { - readOnly: true, - serializedName: "errorCode", - type: { - name: "Number" - } - }, - count: { - readOnly: true, - serializedName: "count", - constraints: { - InclusiveMinimum: 0 - }, - type: { - name: "Number" - } - } - } - } -}; - -export const ServerEndpointRecallStatus: msRest.CompositeMapper = { - serializedName: "ServerEndpointRecallStatus", - type: { - name: "Composite", - className: "ServerEndpointRecallStatus", - modelProperties: { - lastUpdatedTimestamp: { - readOnly: true, - serializedName: "lastUpdatedTimestamp", - type: { - name: "DateTime" - } - }, - totalRecallErrorsCount: { - readOnly: true, - serializedName: "totalRecallErrorsCount", - constraints: { - InclusiveMinimum: 0 - }, - type: { - name: "Number" - } - }, - recallErrors: { - readOnly: true, - serializedName: "recallErrors", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ServerEndpointRecallError" - } - } - } - } - } - } -}; - -export const ServerEndpoint: msRest.CompositeMapper = { - serializedName: "ServerEndpoint", +export const ServerEndpoint: coreClient.CompositeMapper = { type: { name: "Composite", className: "ServerEndpoint", @@ -1049,21 +2579,21 @@ export const ServerEndpoint: msRest.CompositeMapper = { } }, volumeFreeSpacePercent: { - serializedName: "properties.volumeFreeSpacePercent", constraints: { InclusiveMaximum: 100, InclusiveMinimum: 0 }, + serializedName: "properties.volumeFreeSpacePercent", type: { name: "Number" } }, tierFilesOlderThanDays: { - serializedName: "properties.tierFilesOlderThanDays", constraints: { InclusiveMaximum: 2147483647, InclusiveMinimum: 0 }, + serializedName: "properties.tierFilesOlderThanDays", type: { name: "Number" } @@ -1081,28 +2611,27 @@ export const ServerEndpoint: msRest.CompositeMapper = { } }, provisioningState: { - readOnly: true, serializedName: "properties.provisioningState", + readOnly: true, type: { name: "String" } }, lastWorkflowId: { - readOnly: true, serializedName: "properties.lastWorkflowId", + readOnly: true, type: { name: "String" } }, lastOperationName: { - readOnly: true, serializedName: "properties.lastOperationName", + readOnly: true, type: { name: "String" } }, syncStatus: { - readOnly: true, serializedName: "properties.syncStatus", type: { name: "Composite", @@ -1116,15 +2645,16 @@ export const ServerEndpoint: msRest.CompositeMapper = { } }, offlineDataTransferStorageAccountResourceId: { + serializedName: + "properties.offlineDataTransferStorageAccountResourceId", readOnly: true, - serializedName: "properties.offlineDataTransferStorageAccountResourceId", type: { name: "String" } }, offlineDataTransferStorageAccountTenantId: { - readOnly: true, serializedName: "properties.offlineDataTransferStorageAccountTenantId", + readOnly: true, type: { name: "String" } @@ -1136,7 +2666,6 @@ export const ServerEndpoint: msRest.CompositeMapper = { } }, cloudTieringStatus: { - readOnly: true, serializedName: "properties.cloudTieringStatus", type: { name: "Composite", @@ -1144,19 +2673,42 @@ export const ServerEndpoint: msRest.CompositeMapper = { } }, recallStatus: { - readOnly: true, serializedName: "properties.recallStatus", type: { name: "Composite", className: "ServerEndpointRecallStatus" } + }, + initialDownloadPolicy: { + serializedName: "properties.initialDownloadPolicy", + type: { + name: "String" + } + }, + localCacheMode: { + serializedName: "properties.localCacheMode", + type: { + name: "String" + } + }, + initialUploadPolicy: { + serializedName: "properties.initialUploadPolicy", + type: { + name: "String" + } + }, + serverName: { + serializedName: "properties.serverName", + readOnly: true, + type: { + name: "String" + } } } } }; -export const RegisteredServer: msRest.CompositeMapper = { - serializedName: "RegisteredServer", +export const RegisteredServer: coreClient.CompositeMapper = { type: { name: "Composite", className: "RegisteredServer", @@ -1174,6 +2726,20 @@ export const RegisteredServer: msRest.CompositeMapper = { name: "String" } }, + agentVersionStatus: { + serializedName: "properties.agentVersionStatus", + readOnly: true, + type: { + name: "String" + } + }, + agentVersionExpirationDate: { + serializedName: "properties.agentVersionExpirationDate", + readOnly: true, + type: { + name: "DateTime" + } + }, serverOSVersion: { serializedName: "properties.serverOSVersion", type: { @@ -1270,45 +2836,94 @@ export const RegisteredServer: msRest.CompositeMapper = { name: "String" } }, + monitoringEndpointUri: { + serializedName: "properties.monitoringEndpointUri", + type: { + name: "String" + } + }, monitoringConfiguration: { serializedName: "properties.monitoringConfiguration", type: { name: "String" } + }, + serverName: { + serializedName: "properties.serverName", + readOnly: true, + type: { + name: "String" + } } } } }; -export const ResourcesMoveInfo: msRest.CompositeMapper = { - serializedName: "ResourcesMoveInfo", +export const RegisteredServerCreateParameters: coreClient.CompositeMapper = { type: { name: "Composite", - className: "ResourcesMoveInfo", + className: "RegisteredServerCreateParameters", modelProperties: { - targetResourceGroup: { - serializedName: "targetResourceGroup", + ...ProxyResource.type.modelProperties, + serverCertificate: { + serializedName: "properties.serverCertificate", type: { name: "String" } }, - resources: { - serializedName: "resources", + agentVersion: { + serializedName: "properties.agentVersion", type: { - name: "Sequence", - element: { - type: { - name: "String" - } - } + name: "String" + } + }, + serverOSVersion: { + serializedName: "properties.serverOSVersion", + type: { + name: "String" + } + }, + lastHeartBeat: { + serializedName: "properties.lastHeartBeat", + type: { + name: "String" + } + }, + serverRole: { + serializedName: "properties.serverRole", + type: { + name: "String" + } + }, + clusterId: { + serializedName: "properties.clusterId", + type: { + name: "String" + } + }, + clusterName: { + serializedName: "properties.clusterName", + type: { + name: "String" + } + }, + serverId: { + serializedName: "properties.serverId", + type: { + name: "String" + } + }, + friendlyName: { + serializedName: "properties.friendlyName", + type: { + name: "String" } } } } }; -export const Workflow: msRest.CompositeMapper = { - serializedName: "Workflow", +export const Workflow: coreClient.CompositeMapper = { type: { name: "Composite", className: "Workflow", @@ -1343,451 +2958,33 @@ export const Workflow: msRest.CompositeMapper = { type: { name: "String" } - } - } - } -}; - -export const OperationDisplayInfo: msRest.CompositeMapper = { - serializedName: "OperationDisplayInfo", - type: { - name: "Composite", - className: "OperationDisplayInfo", - modelProperties: { - description: { - serializedName: "description", - type: { - name: "String" - } }, - operation: { - serializedName: "operation", - type: { - name: "String" - } - }, - provider: { - serializedName: "provider", - type: { - name: "String" - } - }, - resource: { - serializedName: "resource", - type: { - name: "String" - } - } - } - } -}; - -export const OperationEntity: msRest.CompositeMapper = { - serializedName: "OperationEntity", - type: { - name: "Composite", - className: "OperationEntity", - modelProperties: { - name: { - serializedName: "name", - type: { - name: "String" - } - }, - display: { - serializedName: "display", - type: { - name: "Composite", - className: "OperationDisplayInfo" - } - }, - origin: { - serializedName: "origin", - type: { - name: "String" - } - } - } - } -}; - -export const OperationDisplayResource: msRest.CompositeMapper = { - serializedName: "OperationDisplayResource", - type: { - name: "Composite", - className: "OperationDisplayResource", - modelProperties: { - provider: { - serializedName: "provider", - type: { - name: "String" - } - }, - resource: { - serializedName: "resource", - type: { - name: "String" - } - }, - operation: { - serializedName: "operation", - type: { - name: "String" - } - }, - description: { - serializedName: "description", - type: { - name: "String" - } - } - } - } -}; - -export const CheckNameAvailabilityParameters: msRest.CompositeMapper = { - serializedName: "CheckNameAvailabilityParameters", - type: { - name: "Composite", - className: "CheckNameAvailabilityParameters", - modelProperties: { - name: { - required: true, - serializedName: "name", - type: { - name: "String" - } - }, - type: { - required: true, - isConstant: true, - serializedName: "type", - defaultValue: 'Microsoft.StorageSync/storageSyncServices', - type: { - name: "String" - } - } - } - } -}; - -export const CheckNameAvailabilityResult: msRest.CompositeMapper = { - serializedName: "CheckNameAvailabilityResult", - type: { - name: "Composite", - className: "CheckNameAvailabilityResult", - modelProperties: { - nameAvailable: { + commandName: { + serializedName: "properties.commandName", readOnly: true, - serializedName: "nameAvailable", type: { - name: "Boolean" + name: "String" } }, - reason: { + createdTimestamp: { + serializedName: "properties.createdTimestamp", readOnly: true, - serializedName: "reason", - type: { - name: "Enum", - allowedValues: [ - "Invalid", - "AlreadyExists" - ] - } - }, - message: { - readOnly: true, - serializedName: "message", - type: { - name: "String" - } - } - } - } -}; - -export const RestoreFileSpec: msRest.CompositeMapper = { - serializedName: "RestoreFileSpec", - type: { - name: "Composite", - className: "RestoreFileSpec", - modelProperties: { - path: { - serializedName: "path", - type: { - name: "String" - } - }, - isdir: { - serializedName: "isdir", - type: { - name: "Boolean" - } - } - } - } -}; - -export const PostRestoreRequest: msRest.CompositeMapper = { - serializedName: "PostRestoreRequest", - type: { - name: "Composite", - className: "PostRestoreRequest", - modelProperties: { - partition: { - serializedName: "partition", - type: { - name: "String" - } - }, - replicaGroup: { - serializedName: "replicaGroup", - type: { - name: "String" - } - }, - requestId: { - serializedName: "requestId", - type: { - name: "String" - } - }, - azureFileShareUri: { - serializedName: "azureFileShareUri", - type: { - name: "String" - } - }, - status: { - serializedName: "status", - type: { - name: "String" - } - }, - sourceAzureFileShareUri: { - serializedName: "sourceAzureFileShareUri", - type: { - name: "String" - } - }, - failedFileList: { - serializedName: "failedFileList", - type: { - name: "String" - } - }, - restoreFileSpec: { - serializedName: "restoreFileSpec", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "RestoreFileSpec" - } - } - } - } - } - } -}; - -export const PreRestoreRequest: msRest.CompositeMapper = { - serializedName: "PreRestoreRequest", - type: { - name: "Composite", - className: "PreRestoreRequest", - modelProperties: { - partition: { - serializedName: "partition", - type: { - name: "String" - } - }, - replicaGroup: { - serializedName: "replicaGroup", - type: { - name: "String" - } - }, - requestId: { - serializedName: "requestId", - type: { - name: "String" - } - }, - azureFileShareUri: { - serializedName: "azureFileShareUri", - type: { - name: "String" - } - }, - status: { - serializedName: "status", - type: { - name: "String" - } - }, - sourceAzureFileShareUri: { - serializedName: "sourceAzureFileShareUri", - type: { - name: "String" - } - }, - backupMetadataPropertyBag: { - serializedName: "backupMetadataPropertyBag", - type: { - name: "String" - } - }, - restoreFileSpec: { - serializedName: "restoreFileSpec", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "RestoreFileSpec" - } - } - } - }, - pauseWaitForSyncDrainTimePeriodInSeconds: { - serializedName: "pauseWaitForSyncDrainTimePeriodInSeconds", - type: { - name: "Number" - } - } - } - } -}; - -export const BackupRequest: msRest.CompositeMapper = { - serializedName: "BackupRequest", - type: { - name: "Composite", - className: "BackupRequest", - modelProperties: { - azureFileShare: { - serializedName: "azureFileShare", - type: { - name: "String" - } - } - } - } -}; - -export const PostBackupResponse: msRest.CompositeMapper = { - serializedName: "PostBackupResponse", - type: { - name: "Composite", - className: "PostBackupResponse", - modelProperties: { - cloudEndpointName: { - readOnly: true, - serializedName: "backupMetadata.cloudEndpointName", - type: { - name: "String" - } - } - } - } -}; - -export const StorageSyncServiceUpdateParameters: msRest.CompositeMapper = { - serializedName: "StorageSyncServiceUpdateParameters", - type: { - name: "Composite", - className: "StorageSyncServiceUpdateParameters", - modelProperties: { - tags: { - serializedName: "tags", - type: { - name: "Dictionary", - value: { - type: { - name: "String" - } - } - } - }, - properties: { - serializedName: "properties", - type: { - name: "Object" - } - } - } - } -}; - -export const OperationStatus: msRest.CompositeMapper = { - serializedName: "OperationStatus", - type: { - name: "Composite", - className: "OperationStatus", - modelProperties: { - name: { - readOnly: true, - serializedName: "name", - type: { - name: "String" - } - }, - status: { - readOnly: true, - serializedName: "status", - type: { - name: "String" - } - }, - startTime: { - readOnly: true, - serializedName: "startTime", type: { name: "DateTime" } }, - endTime: { + lastStatusTimestamp: { + serializedName: "properties.lastStatusTimestamp", readOnly: true, - serializedName: "endTime", type: { name: "DateTime" } - }, - error: { - readOnly: true, - serializedName: "error", - type: { - name: "Composite", - className: "StorageSyncApiError" - } } } } }; -export const AzureEntityResource: msRest.CompositeMapper = { - serializedName: "AzureEntityResource", - type: { - name: "Composite", - className: "AzureEntityResource", - modelProperties: { - ...Resource.type.modelProperties, - etag: { - readOnly: true, - serializedName: "etag", - type: { - name: "String" - } - } - } - } -}; - -export const OperationsListHeaders: msRest.CompositeMapper = { - serializedName: "operations-list-headers", +export const OperationsListHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "OperationsListHeaders", @@ -1808,8 +3005,67 @@ export const OperationsListHeaders: msRest.CompositeMapper = { } }; -export const StorageSyncServicesGetHeaders: msRest.CompositeMapper = { - serializedName: "storagesyncservices-get-headers", +export const OperationsListNextHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "OperationsListNextHeaders", + modelProperties: { + xMsRequestId: { + serializedName: "x-ms-request-id", + type: { + name: "String" + } + }, + xMsCorrelationRequestId: { + serializedName: "x-ms-correlation-request-id", + type: { + name: "String" + } + } + } + } +}; + +export const StorageSyncServicesCreateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "StorageSyncServicesCreateHeaders", + modelProperties: { + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "String" + } + }, + xMsRequestId: { + serializedName: "x-ms-request-id", + type: { + name: "String" + } + }, + xMsCorrelationRequestId: { + serializedName: "x-ms-correlation-request-id", + type: { + name: "String" + } + } + } + } +}; + +export const StorageSyncServicesGetHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "StorageSyncServicesGetHeaders", @@ -1830,8 +3086,7 @@ export const StorageSyncServicesGetHeaders: msRest.CompositeMapper = { } }; -export const StorageSyncServicesUpdateHeaders: msRest.CompositeMapper = { - serializedName: "storagesyncservices-update-headers", +export const StorageSyncServicesUpdateHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "StorageSyncServicesUpdateHeaders", @@ -1852,8 +3107,7 @@ export const StorageSyncServicesUpdateHeaders: msRest.CompositeMapper = { } }; -export const StorageSyncServicesDeleteHeaders: msRest.CompositeMapper = { - serializedName: "storagesyncservices-delete-headers", +export const StorageSyncServicesDeleteHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "StorageSyncServicesDeleteHeaders", @@ -1874,8 +3128,7 @@ export const StorageSyncServicesDeleteHeaders: msRest.CompositeMapper = { } }; -export const StorageSyncServicesListByResourceGroupHeaders: msRest.CompositeMapper = { - serializedName: "storagesyncservices-listbyresourcegroup-headers", +export const StorageSyncServicesListByResourceGroupHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "StorageSyncServicesListByResourceGroupHeaders", @@ -1896,8 +3149,7 @@ export const StorageSyncServicesListByResourceGroupHeaders: msRest.CompositeMapp } }; -export const StorageSyncServicesListBySubscriptionHeaders: msRest.CompositeMapper = { - serializedName: "storagesyncservices-listbysubscription-headers", +export const StorageSyncServicesListBySubscriptionHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "StorageSyncServicesListBySubscriptionHeaders", @@ -1918,8 +3170,106 @@ export const StorageSyncServicesListBySubscriptionHeaders: msRest.CompositeMappe } }; -export const SyncGroupsListByStorageSyncServiceHeaders: msRest.CompositeMapper = { - serializedName: "syncgroups-listbystoragesyncservice-headers", +export const PrivateEndpointConnectionsCreateHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateEndpointConnectionsCreateHeaders", + modelProperties: { + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "String" + } + }, + xMsRequestId: { + serializedName: "x-ms-request-id", + type: { + name: "String" + } + }, + xMsCorrelationRequestId: { + serializedName: "x-ms-correlation-request-id", + type: { + name: "String" + } + } + } + } +}; + +export const PrivateEndpointConnectionsDeleteHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateEndpointConnectionsDeleteHeaders", + modelProperties: { + azureAsyncOperation: { + serializedName: "azure-asyncoperation", + type: { + name: "String" + } + }, + location: { + serializedName: "location", + type: { + name: "String" + } + }, + retryAfter: { + serializedName: "retry-after", + type: { + name: "String" + } + }, + xMsRequestId: { + serializedName: "x-ms-request-id", + type: { + name: "String" + } + }, + xMsCorrelationRequestId: { + serializedName: "x-ms-correlation-request-id", + type: { + name: "String" + } + } + } + } +}; + +export const PrivateEndpointConnectionsListByStorageSyncServiceHeaders: coreClient.CompositeMapper = { + type: { + name: "Composite", + className: "PrivateEndpointConnectionsListByStorageSyncServiceHeaders", + modelProperties: { + xMsRequestId: { + serializedName: "x-ms-request-id", + type: { + name: "String" + } + }, + xMsCorrelationRequestId: { + serializedName: "x-ms-correlation-request-id", + type: { + name: "String" + } + } + } + } +}; + +export const SyncGroupsListByStorageSyncServiceHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "SyncGroupsListByStorageSyncServiceHeaders", @@ -1940,8 +3290,7 @@ export const SyncGroupsListByStorageSyncServiceHeaders: msRest.CompositeMapper = } }; -export const SyncGroupsCreateHeaders: msRest.CompositeMapper = { - serializedName: "syncgroups-create-headers", +export const SyncGroupsCreateHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "SyncGroupsCreateHeaders", @@ -1962,8 +3311,7 @@ export const SyncGroupsCreateHeaders: msRest.CompositeMapper = { } }; -export const SyncGroupsGetHeaders: msRest.CompositeMapper = { - serializedName: "syncgroups-get-headers", +export const SyncGroupsGetHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "SyncGroupsGetHeaders", @@ -1984,8 +3332,7 @@ export const SyncGroupsGetHeaders: msRest.CompositeMapper = { } }; -export const SyncGroupsDeleteHeaders: msRest.CompositeMapper = { - serializedName: "syncgroups-delete-headers", +export const SyncGroupsDeleteHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "SyncGroupsDeleteHeaders", @@ -2006,8 +3353,7 @@ export const SyncGroupsDeleteHeaders: msRest.CompositeMapper = { } }; -export const CloudEndpointsCreateHeaders: msRest.CompositeMapper = { - serializedName: "cloudendpoints-create-headers", +export const CloudEndpointsCreateHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "CloudEndpointsCreateHeaders", @@ -2023,31 +3369,12 @@ export const CloudEndpointsCreateHeaders: msRest.CompositeMapper = { type: { name: "String" } - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String" - } - }, - location: { - serializedName: "location", - type: { - name: "String" - } - }, - retryAfter: { - serializedName: "retry-after", - type: { - name: "String" - } } } } }; -export const CloudEndpointsGetHeaders: msRest.CompositeMapper = { - serializedName: "cloudendpoints-get-headers", +export const CloudEndpointsGetHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "CloudEndpointsGetHeaders", @@ -2068,8 +3395,7 @@ export const CloudEndpointsGetHeaders: msRest.CompositeMapper = { } }; -export const CloudEndpointsDeleteHeaders: msRest.CompositeMapper = { - serializedName: "cloudendpoints-delete-headers", +export const CloudEndpointsDeleteHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "CloudEndpointsDeleteHeaders", @@ -2085,31 +3411,12 @@ export const CloudEndpointsDeleteHeaders: msRest.CompositeMapper = { type: { name: "String" } - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String" - } - }, - location: { - serializedName: "location", - type: { - name: "String" - } - }, - retryAfter: { - serializedName: "retry-after", - type: { - name: "String" - } } } } }; -export const CloudEndpointsListBySyncGroupHeaders: msRest.CompositeMapper = { - serializedName: "cloudendpoints-listbysyncgroup-headers", +export const CloudEndpointsListBySyncGroupHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "CloudEndpointsListBySyncGroupHeaders", @@ -2130,8 +3437,7 @@ export const CloudEndpointsListBySyncGroupHeaders: msRest.CompositeMapper = { } }; -export const CloudEndpointsPreBackupHeaders: msRest.CompositeMapper = { - serializedName: "cloudendpoints-prebackup-headers", +export const CloudEndpointsPreBackupHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "CloudEndpointsPreBackupHeaders", @@ -2158,8 +3464,7 @@ export const CloudEndpointsPreBackupHeaders: msRest.CompositeMapper = { } }; -export const CloudEndpointsPostBackupHeaders: msRest.CompositeMapper = { - serializedName: "cloudendpoints-postbackup-headers", +export const CloudEndpointsPostBackupHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "CloudEndpointsPostBackupHeaders", @@ -2186,8 +3491,7 @@ export const CloudEndpointsPostBackupHeaders: msRest.CompositeMapper = { } }; -export const CloudEndpointsPreRestoreHeaders: msRest.CompositeMapper = { - serializedName: "cloudendpoints-prerestore-headers", +export const CloudEndpointsPreRestoreHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "CloudEndpointsPreRestoreHeaders", @@ -2214,8 +3518,7 @@ export const CloudEndpointsPreRestoreHeaders: msRest.CompositeMapper = { } }; -export const CloudEndpointsRestoreheartbeatHeaders: msRest.CompositeMapper = { - serializedName: "cloudendpoints-restoreheartbeat-headers", +export const CloudEndpointsRestoreheartbeatHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "CloudEndpointsRestoreheartbeatHeaders", @@ -2236,8 +3539,7 @@ export const CloudEndpointsRestoreheartbeatHeaders: msRest.CompositeMapper = { } }; -export const CloudEndpointsPostRestoreHeaders: msRest.CompositeMapper = { - serializedName: "cloudendpoints-postrestore-headers", +export const CloudEndpointsPostRestoreHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "CloudEndpointsPostRestoreHeaders", @@ -2264,8 +3566,7 @@ export const CloudEndpointsPostRestoreHeaders: msRest.CompositeMapper = { } }; -export const CloudEndpointsTriggerChangeDetectionHeaders: msRest.CompositeMapper = { - serializedName: "cloudendpoints-triggerchangedetection-headers", +export const CloudEndpointsTriggerChangeDetectionHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "CloudEndpointsTriggerChangeDetectionHeaders", @@ -2292,8 +3593,7 @@ export const CloudEndpointsTriggerChangeDetectionHeaders: msRest.CompositeMapper } }; -export const ServerEndpointsCreateHeaders: msRest.CompositeMapper = { - serializedName: "serverendpoints-create-headers", +export const ServerEndpointsCreateHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "ServerEndpointsCreateHeaders", @@ -2309,25 +3609,12 @@ export const ServerEndpointsCreateHeaders: msRest.CompositeMapper = { type: { name: "String" } - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String" - } - }, - location: { - serializedName: "location", - type: { - name: "String" - } } } } }; -export const ServerEndpointsUpdateHeaders: msRest.CompositeMapper = { - serializedName: "serverendpoints-update-headers", +export const ServerEndpointsUpdateHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "ServerEndpointsUpdateHeaders", @@ -2343,25 +3630,12 @@ export const ServerEndpointsUpdateHeaders: msRest.CompositeMapper = { type: { name: "String" } - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String" - } - }, - location: { - serializedName: "location", - type: { - name: "String" - } } } } }; -export const ServerEndpointsGetHeaders: msRest.CompositeMapper = { - serializedName: "serverendpoints-get-headers", +export const ServerEndpointsGetHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "ServerEndpointsGetHeaders", @@ -2382,8 +3656,7 @@ export const ServerEndpointsGetHeaders: msRest.CompositeMapper = { } }; -export const ServerEndpointsDeleteHeaders: msRest.CompositeMapper = { - serializedName: "serverendpoints-delete-headers", +export const ServerEndpointsDeleteHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "ServerEndpointsDeleteHeaders", @@ -2399,19 +3672,12 @@ export const ServerEndpointsDeleteHeaders: msRest.CompositeMapper = { type: { name: "String" } - }, - location: { - serializedName: "location", - type: { - name: "String" - } } } } }; -export const ServerEndpointsListBySyncGroupHeaders: msRest.CompositeMapper = { - serializedName: "serverendpoints-listbysyncgroup-headers", +export const ServerEndpointsListBySyncGroupHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "ServerEndpointsListBySyncGroupHeaders", @@ -2438,8 +3704,7 @@ export const ServerEndpointsListBySyncGroupHeaders: msRest.CompositeMapper = { } }; -export const ServerEndpointsRecallActionHeaders: msRest.CompositeMapper = { - serializedName: "serverendpoints-recallaction-headers", +export const ServerEndpointsRecallActionHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "ServerEndpointsRecallActionHeaders", @@ -2455,19 +3720,12 @@ export const ServerEndpointsRecallActionHeaders: msRest.CompositeMapper = { type: { name: "String" } - }, - location: { - serializedName: "location", - type: { - name: "String" - } } } } }; -export const RegisteredServersListByStorageSyncServiceHeaders: msRest.CompositeMapper = { - serializedName: "registeredservers-listbystoragesyncservice-headers", +export const RegisteredServersListByStorageSyncServiceHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "RegisteredServersListByStorageSyncServiceHeaders", @@ -2488,8 +3746,7 @@ export const RegisteredServersListByStorageSyncServiceHeaders: msRest.CompositeM } }; -export const RegisteredServersGetHeaders: msRest.CompositeMapper = { - serializedName: "registeredservers-get-headers", +export const RegisteredServersGetHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "RegisteredServersGetHeaders", @@ -2510,8 +3767,7 @@ export const RegisteredServersGetHeaders: msRest.CompositeMapper = { } }; -export const RegisteredServersCreateHeaders: msRest.CompositeMapper = { - serializedName: "registeredservers-create-headers", +export const RegisteredServersCreateHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "RegisteredServersCreateHeaders", @@ -2527,25 +3783,12 @@ export const RegisteredServersCreateHeaders: msRest.CompositeMapper = { type: { name: "String" } - }, - azureAsyncOperation: { - serializedName: "azure-asyncoperation", - type: { - name: "String" - } - }, - location: { - serializedName: "location", - type: { - name: "String" - } } } } }; -export const RegisteredServersDeleteHeaders: msRest.CompositeMapper = { - serializedName: "registeredservers-delete-headers", +export const RegisteredServersDeleteHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "RegisteredServersDeleteHeaders", @@ -2561,19 +3804,12 @@ export const RegisteredServersDeleteHeaders: msRest.CompositeMapper = { type: { name: "String" } - }, - location: { - serializedName: "location", - type: { - name: "String" - } } } } }; -export const RegisteredServersTriggerRolloverHeaders: msRest.CompositeMapper = { - serializedName: "registeredservers-triggerrollover-headers", +export const RegisteredServersTriggerRolloverHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "RegisteredServersTriggerRolloverHeaders", @@ -2589,19 +3825,12 @@ export const RegisteredServersTriggerRolloverHeaders: msRest.CompositeMapper = { type: { name: "String" } - }, - location: { - serializedName: "location", - type: { - name: "String" - } } } } }; -export const WorkflowsListByStorageSyncServiceHeaders: msRest.CompositeMapper = { - serializedName: "workflows-listbystoragesyncservice-headers", +export const WorkflowsListByStorageSyncServiceHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "WorkflowsListByStorageSyncServiceHeaders", @@ -2622,8 +3851,7 @@ export const WorkflowsListByStorageSyncServiceHeaders: msRest.CompositeMapper = } }; -export const WorkflowsGetHeaders: msRest.CompositeMapper = { - serializedName: "workflows-get-headers", +export const WorkflowsGetHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "WorkflowsGetHeaders", @@ -2644,8 +3872,7 @@ export const WorkflowsGetHeaders: msRest.CompositeMapper = { } }; -export const WorkflowsAbortHeaders: msRest.CompositeMapper = { - serializedName: "workflows-abort-headers", +export const WorkflowsAbortHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "WorkflowsAbortHeaders", @@ -2666,8 +3893,7 @@ export const WorkflowsAbortHeaders: msRest.CompositeMapper = { } }; -export const OperationStatusGetHeaders: msRest.CompositeMapper = { - serializedName: "operationstatus-get-headers", +export const OperationStatusGetHeaders: coreClient.CompositeMapper = { type: { name: "Composite", className: "OperationStatusGetHeaders", @@ -2688,160 +3914,21 @@ export const OperationStatusGetHeaders: msRest.CompositeMapper = { } }; -export const OperationEntityListResult: msRest.CompositeMapper = { - serializedName: "OperationEntityListResult", +export const MicrosoftStorageSyncLocationOperationStatusHeaders: coreClient.CompositeMapper = { type: { name: "Composite", - className: "OperationEntityListResult", + className: "MicrosoftStorageSyncLocationOperationStatusHeaders", modelProperties: { - nextLink: { - serializedName: "nextLink", + xMsRequestId: { + serializedName: "x-ms-request-id", type: { name: "String" } }, - value: { - serializedName: "", + xMsCorrelationRequestId: { + serializedName: "x-ms-correlation-request-id", type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "OperationEntity" - } - } - } - } - } - } -}; - -export const StorageSyncServiceArray: msRest.CompositeMapper = { - serializedName: "StorageSyncServiceArray", - type: { - name: "Composite", - className: "StorageSyncServiceArray", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "StorageSyncService" - } - } - } - } - } - } -}; - -export const SyncGroupArray: msRest.CompositeMapper = { - serializedName: "SyncGroupArray", - type: { - name: "Composite", - className: "SyncGroupArray", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "SyncGroup" - } - } - } - } - } - } -}; - -export const CloudEndpointArray: msRest.CompositeMapper = { - serializedName: "CloudEndpointArray", - type: { - name: "Composite", - className: "CloudEndpointArray", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "CloudEndpoint" - } - } - } - } - } - } -}; - -export const ServerEndpointArray: msRest.CompositeMapper = { - serializedName: "ServerEndpointArray", - type: { - name: "Composite", - className: "ServerEndpointArray", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "ServerEndpoint" - } - } - } - } - } - } -}; - -export const RegisteredServerArray: msRest.CompositeMapper = { - serializedName: "RegisteredServerArray", - type: { - name: "Composite", - className: "RegisteredServerArray", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "RegisteredServer" - } - } - } - } - } - } -}; - -export const WorkflowArray: msRest.CompositeMapper = { - serializedName: "WorkflowArray", - type: { - name: "Composite", - className: "WorkflowArray", - modelProperties: { - value: { - serializedName: "", - type: { - name: "Sequence", - element: { - type: { - name: "Composite", - className: "Workflow" - } - } + name: "String" } } } diff --git a/sdk/storagesync/arm-storagesync/src/models/operationStatusOperationsMappers.ts b/sdk/storagesync/arm-storagesync/src/models/operationStatusOperationsMappers.ts deleted file mode 100644 index 4de39529d32..00000000000 --- a/sdk/storagesync/arm-storagesync/src/models/operationStatusOperationsMappers.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - OperationStatus, - OperationStatusGetHeaders, - StorageSyncApiError, - StorageSyncError, - StorageSyncErrorDetails -} from "../models/mappers"; diff --git a/sdk/storagesync/arm-storagesync/src/models/operationsMappers.ts b/sdk/storagesync/arm-storagesync/src/models/operationsMappers.ts deleted file mode 100644 index 0300c447523..00000000000 --- a/sdk/storagesync/arm-storagesync/src/models/operationsMappers.ts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - OperationDisplayInfo, - OperationEntity, - OperationEntityListResult, - OperationsListHeaders, - StorageSyncApiError, - StorageSyncError, - StorageSyncErrorDetails -} from "../models/mappers"; diff --git a/sdk/storagesync/arm-storagesync/src/models/parameters.ts b/sdk/storagesync/arm-storagesync/src/models/parameters.ts index 4f73078d7bb..1a6b7e7c886 100644 --- a/sdk/storagesync/arm-storagesync/src/models/parameters.ts +++ b/sdk/storagesync/arm-storagesync/src/models/parameters.ts @@ -1,152 +1,291 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; +import { + OperationParameter, + OperationURLParameter, + OperationQueryParameter +} from "@azure/core-client"; +import { + CheckNameAvailabilityParameters as CheckNameAvailabilityParametersMapper, + StorageSyncServiceCreateParameters as StorageSyncServiceCreateParametersMapper, + StorageSyncServiceUpdateParameters as StorageSyncServiceUpdateParametersMapper, + PrivateEndpointConnection as PrivateEndpointConnectionMapper, + SyncGroupCreateParameters as SyncGroupCreateParametersMapper, + CloudEndpointCreateParameters as CloudEndpointCreateParametersMapper, + BackupRequest as BackupRequestMapper, + PreRestoreRequest as PreRestoreRequestMapper, + PostRestoreRequest as PostRestoreRequestMapper, + TriggerChangeDetectionParameters as TriggerChangeDetectionParametersMapper, + ServerEndpointCreateParameters as ServerEndpointCreateParametersMapper, + ServerEndpointUpdateParameters as ServerEndpointUpdateParametersMapper, + RecallActionParameters as RecallActionParametersMapper, + RegisteredServerCreateParameters as RegisteredServerCreateParametersMapper, + TriggerRolloverRequest as TriggerRolloverRequestMapper +} from "../models/mappers"; -export const acceptLanguage: msRest.OperationParameter = { - parameterPath: "acceptLanguage", +export const accept: OperationParameter = { + parameterPath: "accept", mapper: { - serializedName: "accept-language", - defaultValue: 'en-US', + defaultValue: "application/json", + isConstant: true, + serializedName: "Accept", type: { name: "String" } } }; -export const apiVersion: msRest.OperationQueryParameter = { - parameterPath: "apiVersion", + +export const $host: OperationURLParameter = { + parameterPath: "$host", mapper: { + serializedName: "$host", required: true, - serializedName: "api-version", - constraints: { - MinLength: 1 - }, - type: { - name: "String" - } - } -}; -export const cloudEndpointName: msRest.OperationURLParameter = { - parameterPath: "cloudEndpointName", - mapper: { - required: true, - serializedName: "cloudEndpointName", - type: { - name: "String" - } - } -}; -export const locationName: msRest.OperationURLParameter = { - parameterPath: "locationName", - mapper: { - required: true, - serializedName: "locationName", - type: { - name: "String" - } - } -}; -export const nextPageLink: msRest.OperationURLParameter = { - parameterPath: "nextPageLink", - mapper: { - required: true, - serializedName: "nextLink", type: { name: "String" } }, skipEncoding: true }; -export const operationId: msRest.OperationURLParameter = { - parameterPath: "operationId", + +export const apiVersion: OperationQueryParameter = { + parameterPath: "apiVersion", mapper: { - required: true, - serializedName: "operationId", + defaultValue: "2020-09-01", + isConstant: true, + serializedName: "api-version", type: { name: "String" } } }; -export const resourceGroupName: msRest.OperationURLParameter = { - parameterPath: "resourceGroupName", + +export const nextLink: OperationURLParameter = { + parameterPath: "nextLink", mapper: { + serializedName: "nextLink", required: true, - serializedName: "resourceGroupName", - constraints: { - MaxLength: 90, - MinLength: 1, - Pattern: /^[-\w\._\(\)]+$/ - }, + type: { + name: "String" + } + }, + skipEncoding: true +}; + +export const contentType: OperationParameter = { + parameterPath: ["options", "contentType"], + mapper: { + defaultValue: "application/json", + isConstant: true, + serializedName: "Content-Type", type: { name: "String" } } }; -export const serverEndpointName: msRest.OperationURLParameter = { - parameterPath: "serverEndpointName", + +export const parameters: OperationParameter = { + parameterPath: "parameters", + mapper: CheckNameAvailabilityParametersMapper +}; + +export const locationName: OperationURLParameter = { + parameterPath: "locationName", mapper: { + serializedName: "locationName", required: true, - serializedName: "serverEndpointName", type: { name: "String" } } }; -export const serverId: msRest.OperationURLParameter = { - parameterPath: "serverId", - mapper: { - required: true, - serializedName: "serverId", - type: { - name: "String" - } - } -}; -export const storageSyncServiceName: msRest.OperationURLParameter = { - parameterPath: "storageSyncServiceName", - mapper: { - required: true, - serializedName: "storageSyncServiceName", - type: { - name: "String" - } - } -}; -export const subscriptionId: msRest.OperationURLParameter = { + +export const subscriptionId: OperationURLParameter = { parameterPath: "subscriptionId", mapper: { - required: true, - serializedName: "subscriptionId", constraints: { MinLength: 1 }, + serializedName: "subscriptionId", + required: true, type: { name: "String" } } }; -export const syncGroupName: msRest.OperationURLParameter = { + +export const parameters1: OperationParameter = { + parameterPath: "parameters", + mapper: StorageSyncServiceCreateParametersMapper +}; + +export const resourceGroupName: OperationURLParameter = { + parameterPath: "resourceGroupName", + mapper: { + constraints: { + MaxLength: 90, + MinLength: 1 + }, + serializedName: "resourceGroupName", + required: true, + type: { + name: "String" + } + } +}; + +export const storageSyncServiceName: OperationURLParameter = { + parameterPath: "storageSyncServiceName", + mapper: { + serializedName: "storageSyncServiceName", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters2: OperationParameter = { + parameterPath: ["options", "parameters"], + mapper: StorageSyncServiceUpdateParametersMapper +}; + +export const privateEndpointConnectionName: OperationURLParameter = { + parameterPath: "privateEndpointConnectionName", + mapper: { + serializedName: "privateEndpointConnectionName", + required: true, + type: { + name: "String" + } + } +}; + +export const properties: OperationParameter = { + parameterPath: "properties", + mapper: PrivateEndpointConnectionMapper +}; + +export const parameters3: OperationParameter = { + parameterPath: "parameters", + mapper: SyncGroupCreateParametersMapper +}; + +export const syncGroupName: OperationURLParameter = { parameterPath: "syncGroupName", mapper: { - required: true, serializedName: "syncGroupName", + required: true, type: { name: "String" } } }; -export const workflowId: msRest.OperationURLParameter = { + +export const parameters4: OperationParameter = { + parameterPath: "parameters", + mapper: CloudEndpointCreateParametersMapper +}; + +export const cloudEndpointName: OperationURLParameter = { + parameterPath: "cloudEndpointName", + mapper: { + serializedName: "cloudEndpointName", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters5: OperationParameter = { + parameterPath: "parameters", + mapper: BackupRequestMapper +}; + +export const parameters6: OperationParameter = { + parameterPath: "parameters", + mapper: PreRestoreRequestMapper +}; + +export const parameters7: OperationParameter = { + parameterPath: "parameters", + mapper: PostRestoreRequestMapper +}; + +export const parameters8: OperationParameter = { + parameterPath: "parameters", + mapper: TriggerChangeDetectionParametersMapper +}; + +export const parameters9: OperationParameter = { + parameterPath: "parameters", + mapper: ServerEndpointCreateParametersMapper +}; + +export const serverEndpointName: OperationURLParameter = { + parameterPath: "serverEndpointName", + mapper: { + serializedName: "serverEndpointName", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters10: OperationParameter = { + parameterPath: ["options", "parameters"], + mapper: ServerEndpointUpdateParametersMapper +}; + +export const parameters11: OperationParameter = { + parameterPath: "parameters", + mapper: RecallActionParametersMapper +}; + +export const serverId: OperationURLParameter = { + parameterPath: "serverId", + mapper: { + serializedName: "serverId", + required: true, + type: { + name: "String" + } + } +}; + +export const parameters12: OperationParameter = { + parameterPath: "parameters", + mapper: RegisteredServerCreateParametersMapper +}; + +export const parameters13: OperationParameter = { + parameterPath: "parameters", + mapper: TriggerRolloverRequestMapper +}; + +export const workflowId: OperationURLParameter = { parameterPath: "workflowId", mapper: { - required: true, serializedName: "workflowId", + required: true, + type: { + name: "String" + } + } +}; + +export const operationId: OperationURLParameter = { + parameterPath: "operationId", + mapper: { + serializedName: "operationId", + required: true, type: { name: "String" } diff --git a/sdk/storagesync/arm-storagesync/src/models/registeredServersMappers.ts b/sdk/storagesync/arm-storagesync/src/models/registeredServersMappers.ts deleted file mode 100644 index 558aecd968b..00000000000 --- a/sdk/storagesync/arm-storagesync/src/models/registeredServersMappers.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - AzureEntityResource, - BaseResource, - CloudEndpoint, - CloudEndpointCreateParameters, - ProxyResource, - RegisteredServer, - RegisteredServerArray, - RegisteredServerCreateParameters, - RegisteredServersCreateHeaders, - RegisteredServersDeleteHeaders, - RegisteredServersGetHeaders, - RegisteredServersListByStorageSyncServiceHeaders, - RegisteredServersTriggerRolloverHeaders, - Resource, - ServerEndpoint, - ServerEndpointCloudTieringStatus, - ServerEndpointCreateParameters, - ServerEndpointFilesNotSyncingError, - ServerEndpointRecallError, - ServerEndpointRecallStatus, - ServerEndpointSyncActivityStatus, - ServerEndpointSyncSessionStatus, - ServerEndpointSyncStatus, - StorageSyncApiError, - StorageSyncError, - StorageSyncErrorDetails, - StorageSyncService, - SyncGroup, - SyncGroupCreateParameters, - TrackedResource, - TriggerRolloverRequest, - Workflow -} from "../models/mappers"; diff --git a/sdk/storagesync/arm-storagesync/src/models/serverEndpointsMappers.ts b/sdk/storagesync/arm-storagesync/src/models/serverEndpointsMappers.ts deleted file mode 100644 index d2cf597bac5..00000000000 --- a/sdk/storagesync/arm-storagesync/src/models/serverEndpointsMappers.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - AzureEntityResource, - BaseResource, - CloudEndpoint, - CloudEndpointCreateParameters, - ProxyResource, - RecallActionParameters, - RegisteredServer, - RegisteredServerCreateParameters, - Resource, - ServerEndpoint, - ServerEndpointArray, - ServerEndpointCloudTieringStatus, - ServerEndpointCreateParameters, - ServerEndpointFilesNotSyncingError, - ServerEndpointRecallError, - ServerEndpointRecallStatus, - ServerEndpointsCreateHeaders, - ServerEndpointsDeleteHeaders, - ServerEndpointsGetHeaders, - ServerEndpointsListBySyncGroupHeaders, - ServerEndpointsRecallActionHeaders, - ServerEndpointsUpdateHeaders, - ServerEndpointSyncActivityStatus, - ServerEndpointSyncSessionStatus, - ServerEndpointSyncStatus, - ServerEndpointUpdateParameters, - StorageSyncApiError, - StorageSyncError, - StorageSyncErrorDetails, - StorageSyncService, - SyncGroup, - SyncGroupCreateParameters, - TrackedResource, - Workflow -} from "../models/mappers"; diff --git a/sdk/storagesync/arm-storagesync/src/models/storageSyncServicesMappers.ts b/sdk/storagesync/arm-storagesync/src/models/storageSyncServicesMappers.ts deleted file mode 100644 index 2bc4aa2c18e..00000000000 --- a/sdk/storagesync/arm-storagesync/src/models/storageSyncServicesMappers.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - AzureEntityResource, - BaseResource, - CheckNameAvailabilityParameters, - CheckNameAvailabilityResult, - CloudEndpoint, - CloudEndpointCreateParameters, - CloudError, - ProxyResource, - RegisteredServer, - RegisteredServerCreateParameters, - Resource, - ServerEndpoint, - ServerEndpointCloudTieringStatus, - ServerEndpointCreateParameters, - ServerEndpointFilesNotSyncingError, - ServerEndpointRecallError, - ServerEndpointRecallStatus, - ServerEndpointSyncActivityStatus, - ServerEndpointSyncSessionStatus, - ServerEndpointSyncStatus, - StorageSyncApiError, - StorageSyncError, - StorageSyncErrorDetails, - StorageSyncService, - StorageSyncServiceArray, - StorageSyncServiceCreateParameters, - StorageSyncServicesDeleteHeaders, - StorageSyncServicesGetHeaders, - StorageSyncServicesListByResourceGroupHeaders, - StorageSyncServicesListBySubscriptionHeaders, - StorageSyncServicesUpdateHeaders, - StorageSyncServiceUpdateParameters, - SyncGroup, - SyncGroupCreateParameters, - TrackedResource, - Workflow -} from "../models/mappers"; diff --git a/sdk/storagesync/arm-storagesync/src/models/syncGroupsMappers.ts b/sdk/storagesync/arm-storagesync/src/models/syncGroupsMappers.ts deleted file mode 100644 index f7e5c093c06..00000000000 --- a/sdk/storagesync/arm-storagesync/src/models/syncGroupsMappers.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - AzureEntityResource, - BaseResource, - CloudEndpoint, - CloudEndpointCreateParameters, - ProxyResource, - RegisteredServer, - RegisteredServerCreateParameters, - Resource, - ServerEndpoint, - ServerEndpointCloudTieringStatus, - ServerEndpointCreateParameters, - ServerEndpointFilesNotSyncingError, - ServerEndpointRecallError, - ServerEndpointRecallStatus, - ServerEndpointSyncActivityStatus, - ServerEndpointSyncSessionStatus, - ServerEndpointSyncStatus, - StorageSyncApiError, - StorageSyncError, - StorageSyncErrorDetails, - StorageSyncService, - SyncGroup, - SyncGroupArray, - SyncGroupCreateParameters, - SyncGroupsCreateHeaders, - SyncGroupsDeleteHeaders, - SyncGroupsGetHeaders, - SyncGroupsListByStorageSyncServiceHeaders, - TrackedResource, - Workflow -} from "../models/mappers"; diff --git a/sdk/storagesync/arm-storagesync/src/models/workflowsMappers.ts b/sdk/storagesync/arm-storagesync/src/models/workflowsMappers.ts deleted file mode 100644 index cc6031cb217..00000000000 --- a/sdk/storagesync/arm-storagesync/src/models/workflowsMappers.ts +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is regenerated. - */ - -export { - AzureEntityResource, - BaseResource, - CloudEndpoint, - CloudEndpointCreateParameters, - ProxyResource, - RegisteredServer, - RegisteredServerCreateParameters, - Resource, - ServerEndpoint, - ServerEndpointCloudTieringStatus, - ServerEndpointCreateParameters, - ServerEndpointFilesNotSyncingError, - ServerEndpointRecallError, - ServerEndpointRecallStatus, - ServerEndpointSyncActivityStatus, - ServerEndpointSyncSessionStatus, - ServerEndpointSyncStatus, - StorageSyncApiError, - StorageSyncError, - StorageSyncErrorDetails, - StorageSyncService, - SyncGroup, - SyncGroupCreateParameters, - TrackedResource, - Workflow, - WorkflowArray, - WorkflowsAbortHeaders, - WorkflowsGetHeaders, - WorkflowsListByStorageSyncServiceHeaders -} from "../models/mappers"; diff --git a/sdk/storagesync/arm-storagesync/src/operations/cloudEndpoints.ts b/sdk/storagesync/arm-storagesync/src/operations/cloudEndpoints.ts index 0885608e307..3b5bbe1b6c3 100644 --- a/sdk/storagesync/arm-storagesync/src/operations/cloudEndpoints.ts +++ b/sdk/storagesync/arm-storagesync/src/operations/cloudEndpoints.ts @@ -1,32 +1,126 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/cloudEndpointsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { CloudEndpoints } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { StorageSyncManagementClientContext } from "../storageSyncManagementClientContext"; +import { MicrosoftStorageSync } from "../microsoftStorageSync"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + CloudEndpoint, + CloudEndpointsListBySyncGroupOptionalParams, + CloudEndpointCreateParameters, + CloudEndpointsCreateOptionalParams, + CloudEndpointsCreateResponse, + CloudEndpointsGetOptionalParams, + CloudEndpointsGetResponse, + CloudEndpointsDeleteOptionalParams, + CloudEndpointsDeleteResponse, + CloudEndpointsListBySyncGroupResponse, + BackupRequest, + CloudEndpointsPreBackupOptionalParams, + CloudEndpointsPreBackupResponse, + CloudEndpointsPostBackupOptionalParams, + CloudEndpointsPostBackupResponse, + PreRestoreRequest, + CloudEndpointsPreRestoreOptionalParams, + CloudEndpointsRestoreheartbeatOptionalParams, + CloudEndpointsRestoreheartbeatResponse, + PostRestoreRequest, + CloudEndpointsPostRestoreOptionalParams, + TriggerChangeDetectionParameters, + CloudEndpointsTriggerChangeDetectionOptionalParams +} from "../models"; -/** Class representing a CloudEndpoints. */ -export class CloudEndpoints { - private readonly client: StorageSyncManagementClientContext; +/// +/** Class containing CloudEndpoints operations. */ +export class CloudEndpointsImpl implements CloudEndpoints { + private readonly client: MicrosoftStorageSync; /** - * Create a CloudEndpoints. - * @param {StorageSyncManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class CloudEndpoints class. + * @param client Reference to the service client */ - constructor(client: StorageSyncManagementClientContext) { + constructor(client: MicrosoftStorageSync) { this.client = client; } + /** + * Get a CloudEndpoint List. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param options The options parameters. + */ + public listBySyncGroup( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + options?: CloudEndpointsListBySyncGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySyncGroupPagingAll( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listBySyncGroupPagingPage( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + options + ); + } + }; + } + + private async *listBySyncGroupPagingPage( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + options?: CloudEndpointsListBySyncGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listBySyncGroup( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + options + ); + yield result.value || []; + } + + private async *listBySyncGroupPagingAll( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + options?: CloudEndpointsListBySyncGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySyncGroupPagingPage( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + options + )) { + yield* page; + } + } + /** * Create a new CloudEndpoint. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -34,12 +128,104 @@ export class CloudEndpoints { * @param syncGroupName Name of Sync Group resource. * @param cloudEndpointName Name of Cloud Endpoint object. * @param parameters Body of Cloud Endpoint resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: Models.CloudEndpointCreateParameters, options?: msRest.RequestOptionsBase): Promise { - return this.beginCreate(resourceGroupName,storageSyncServiceName,syncGroupName,cloudEndpointName,parameters,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginCreate( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: CloudEndpointCreateParameters, + options?: CloudEndpointsCreateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + CloudEndpointsCreateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters, + options + }, + createOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Create a new CloudEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param parameters Body of Cloud Endpoint resource. + * @param options The options parameters. + */ + async beginCreateAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: CloudEndpointCreateParameters, + options?: CloudEndpointsCreateOptionalParams + ): Promise { + const poller = await this.beginCreate( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters, + options + ); + return poller.pollUntilDone(); } /** @@ -48,28 +234,15 @@ export class CloudEndpoints { * @param storageSyncServiceName Name of Storage Sync Service resource. * @param syncGroupName Name of Sync Group resource. * @param cloudEndpointName Name of Cloud Endpoint object. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param cloudEndpointName Name of Cloud Endpoint object. - * @param callback The callback - */ - get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param cloudEndpointName Name of Cloud Endpoint object. - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + options?: CloudEndpointsGetOptionalParams + ): Promise { return this.client.sendOperationRequest( { resourceGroupName, @@ -78,8 +251,8 @@ export class CloudEndpoints { cloudEndpointName, options }, - getOperationSpec, - callback) as Promise; + getOperationSpec + ); } /** @@ -88,12 +261,99 @@ export class CloudEndpoints { * @param storageSyncServiceName Name of Storage Sync Service resource. * @param syncGroupName Name of Sync Group resource. * @param cloudEndpointName Name of Cloud Endpoint object. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - deleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginDeleteMethod(resourceGroupName,storageSyncServiceName,syncGroupName,cloudEndpointName,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginDelete( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + options?: CloudEndpointsDeleteOptionalParams + ): Promise< + PollerLike< + PollOperationState, + CloudEndpointsDeleteResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + options + }, + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Delete a given CloudEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + options?: CloudEndpointsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + options + ); + return poller.pollUntilDone(); } /** @@ -101,35 +361,18 @@ export class CloudEndpoints { * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param storageSyncServiceName Name of Storage Sync Service resource. * @param syncGroupName Name of Sync Group resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param callback The callback - */ - listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param options The optional parameters - * @param callback The callback - */ - listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listBySyncGroup( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + options?: CloudEndpointsListBySyncGroupOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - storageSyncServiceName, - syncGroupName, - options - }, - listBySyncGroupOperationSpec, - callback) as Promise; + { resourceGroupName, storageSyncServiceName, syncGroupName, options }, + listBySyncGroupOperationSpec + ); } /** @@ -139,12 +382,104 @@ export class CloudEndpoints { * @param syncGroupName Name of Sync Group resource. * @param cloudEndpointName Name of Cloud Endpoint object. * @param parameters Body of Backup request. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - preBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: Models.BackupRequest, options?: msRest.RequestOptionsBase): Promise { - return this.beginPreBackup(resourceGroupName,storageSyncServiceName,syncGroupName,cloudEndpointName,parameters,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginPreBackup( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: BackupRequest, + options?: CloudEndpointsPreBackupOptionalParams + ): Promise< + PollerLike< + PollOperationState, + CloudEndpointsPreBackupResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters, + options + }, + preBackupOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Pre Backup a given CloudEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param parameters Body of Backup request. + * @param options The options parameters. + */ + async beginPreBackupAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: BackupRequest, + options?: CloudEndpointsPreBackupOptionalParams + ): Promise { + const poller = await this.beginPreBackup( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters, + options + ); + return poller.pollUntilDone(); } /** @@ -154,12 +489,104 @@ export class CloudEndpoints { * @param syncGroupName Name of Sync Group resource. * @param cloudEndpointName Name of Cloud Endpoint object. * @param parameters Body of Backup request. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - postBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: Models.BackupRequest, options?: msRest.RequestOptionsBase): Promise { - return this.beginPostBackup(resourceGroupName,storageSyncServiceName,syncGroupName,cloudEndpointName,parameters,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginPostBackup( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: BackupRequest, + options?: CloudEndpointsPostBackupOptionalParams + ): Promise< + PollerLike< + PollOperationState, + CloudEndpointsPostBackupResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters, + options + }, + postBackupOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Post Backup a given CloudEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param parameters Body of Backup request. + * @param options The options parameters. + */ + async beginPostBackupAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: BackupRequest, + options?: CloudEndpointsPostBackupOptionalParams + ): Promise { + const poller = await this.beginPostBackup( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters, + options + ); + return poller.pollUntilDone(); } /** @@ -169,12 +596,99 @@ export class CloudEndpoints { * @param syncGroupName Name of Sync Group resource. * @param cloudEndpointName Name of Cloud Endpoint object. * @param parameters Body of Cloud Endpoint object. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - preRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: Models.PreRestoreRequest, options?: msRest.RequestOptionsBase): Promise { - return this.beginPreRestore(resourceGroupName,storageSyncServiceName,syncGroupName,cloudEndpointName,parameters,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginPreRestore( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: PreRestoreRequest, + options?: CloudEndpointsPreRestoreOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters, + options + }, + preRestoreOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Pre Restore a given CloudEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param parameters Body of Cloud Endpoint object. + * @param options The options parameters. + */ + async beginPreRestoreAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: PreRestoreRequest, + options?: CloudEndpointsPreRestoreOptionalParams + ): Promise { + const poller = await this.beginPreRestore( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters, + options + ); + return poller.pollUntilDone(); } /** @@ -183,28 +697,15 @@ export class CloudEndpoints { * @param storageSyncServiceName Name of Storage Sync Service resource. * @param syncGroupName Name of Sync Group resource. * @param cloudEndpointName Name of Cloud Endpoint object. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - restoreheartbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param cloudEndpointName Name of Cloud Endpoint object. - * @param callback The callback - */ - restoreheartbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param cloudEndpointName Name of Cloud Endpoint object. - * @param options The optional parameters - * @param callback The callback - */ - restoreheartbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - restoreheartbeat(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + restoreheartbeat( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + options?: CloudEndpointsRestoreheartbeatOptionalParams + ): Promise { return this.client.sendOperationRequest( { resourceGroupName, @@ -213,8 +714,8 @@ export class CloudEndpoints { cloudEndpointName, options }, - restoreheartbeatOperationSpec, - callback) as Promise; + restoreheartbeatOperationSpec + ); } /** @@ -224,42 +725,57 @@ export class CloudEndpoints { * @param syncGroupName Name of Sync Group resource. * @param cloudEndpointName Name of Cloud Endpoint object. * @param parameters Body of Cloud Endpoint object. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - postRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: Models.PostRestoreRequest, options?: msRest.RequestOptionsBase): Promise { - return this.beginPostRestore(resourceGroupName,storageSyncServiceName,syncGroupName,cloudEndpointName,parameters,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; - } + async beginPostRestore( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: PostRestoreRequest, + options?: CloudEndpointsPostRestoreOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; - /** - * Triggers detection of changes performed on Azure File share connected to the specified Azure - * File Sync Cloud Endpoint. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param cloudEndpointName Name of Cloud Endpoint object. - * @param parameters Trigger Change Detection Action parameters. - * @param [options] The optional parameters - * @returns Promise - */ - triggerChangeDetection(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: Models.TriggerChangeDetectionParameters, options?: msRest.RequestOptionsBase): Promise { - return this.beginTriggerChangeDetection(resourceGroupName,storageSyncServiceName,syncGroupName,cloudEndpointName,parameters,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; - } - - /** - * Create a new CloudEndpoint. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param cloudEndpointName Name of Cloud Endpoint object. - * @param parameters Body of Cloud Endpoint resource. - * @param [options] The optional parameters - * @returns Promise - */ - beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: Models.CloudEndpointCreateParameters, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( + const lro = new LroImpl( + sendOperation, { resourceGroupName, storageSyncServiceName, @@ -268,102 +784,12 @@ export class CloudEndpoints { parameters, options }, - beginCreateOperationSpec, - options); - } - - /** - * Delete a given CloudEndpoint. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param cloudEndpointName Name of Cloud Endpoint object. - * @param [options] The optional parameters - * @returns Promise - */ - beginDeleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - storageSyncServiceName, - syncGroupName, - cloudEndpointName, - options - }, - beginDeleteMethodOperationSpec, - options); - } - - /** - * Pre Backup a given CloudEndpoint. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param cloudEndpointName Name of Cloud Endpoint object. - * @param parameters Body of Backup request. - * @param [options] The optional parameters - * @returns Promise - */ - beginPreBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: Models.BackupRequest, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - storageSyncServiceName, - syncGroupName, - cloudEndpointName, - parameters, - options - }, - beginPreBackupOperationSpec, - options); - } - - /** - * Post Backup a given CloudEndpoint. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param cloudEndpointName Name of Cloud Endpoint object. - * @param parameters Body of Backup request. - * @param [options] The optional parameters - * @returns Promise - */ - beginPostBackup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: Models.BackupRequest, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - storageSyncServiceName, - syncGroupName, - cloudEndpointName, - parameters, - options - }, - beginPostBackupOperationSpec, - options); - } - - /** - * Pre Restore a given CloudEndpoint. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param cloudEndpointName Name of Cloud Endpoint object. - * @param parameters Body of Cloud Endpoint object. - * @param [options] The optional parameters - * @returns Promise - */ - beginPreRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: Models.PreRestoreRequest, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - storageSyncServiceName, - syncGroupName, - cloudEndpointName, - parameters, - options - }, - beginPreRestoreOperationSpec, - options); + postRestoreOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** @@ -373,36 +799,86 @@ export class CloudEndpoints { * @param syncGroupName Name of Sync Group resource. * @param cloudEndpointName Name of Cloud Endpoint object. * @param parameters Body of Cloud Endpoint object. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginPostRestore(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: Models.PostRestoreRequest, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - storageSyncServiceName, - syncGroupName, - cloudEndpointName, - parameters, - options - }, - beginPostRestoreOperationSpec, - options); + async beginPostRestoreAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: PostRestoreRequest, + options?: CloudEndpointsPostRestoreOptionalParams + ): Promise { + const poller = await this.beginPostRestore( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters, + options + ); + return poller.pollUntilDone(); } /** - * Triggers detection of changes performed on Azure File share connected to the specified Azure - * File Sync Cloud Endpoint. + * Triggers detection of changes performed on Azure File share connected to the specified Azure File + * Sync Cloud Endpoint. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param storageSyncServiceName Name of Storage Sync Service resource. * @param syncGroupName Name of Sync Group resource. * @param cloudEndpointName Name of Cloud Endpoint object. * @param parameters Trigger Change Detection Action parameters. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginTriggerChangeDetection(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, cloudEndpointName: string, parameters: Models.TriggerChangeDetectionParameters, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( + async beginTriggerChangeDetection( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: TriggerChangeDetectionParameters, + options?: CloudEndpointsTriggerChangeDetectionOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, { resourceGroupName, storageSyncServiceName, @@ -411,29 +887,89 @@ export class CloudEndpoints { parameters, options }, - beginTriggerChangeDetectionOperationSpec, - options); + triggerChangeDetectionOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Triggers detection of changes performed on Azure File share connected to the specified Azure File + * Sync Cloud Endpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param parameters Trigger Change Detection Action parameters. + * @param options The options parameters. + */ + async beginTriggerChangeDetectionAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: TriggerChangeDetectionParameters, + options?: CloudEndpointsTriggerChangeDetectionOptionalParams + ): Promise { + const poller = await this.beginTriggerChangeDetection( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + cloudEndpointName, + parameters, + options + ); + return poller.pollUntilDone(); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}", +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.CloudEndpoint, + headersMapper: Mappers.CloudEndpointsCreateHeaders + }, + 201: { + bodyMapper: Mappers.CloudEndpoint, + headersMapper: Mappers.CloudEndpointsCreateHeaders + }, + 202: { + bodyMapper: Mappers.CloudEndpoint, + headersMapper: Mappers.CloudEndpointsCreateHeaders + }, + 204: { + bodyMapper: Mappers.CloudEndpoint, + headersMapper: Mappers.CloudEndpointsCreateHeaders + }, + default: { + bodyMapper: Mappers.StorageSyncError + } + }, + requestBody: Parameters.parameters4, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.storageSyncServiceName, Parameters.syncGroupName, Parameters.cloudEndpointName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.CloudEndpoint, @@ -443,121 +979,29 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.StorageSyncError } }, - serializer -}; - -const listBySyncGroupOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.storageSyncServiceName, - Parameters.syncGroupName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.CloudEndpointArray, - headersMapper: Mappers.CloudEndpointsListBySyncGroupHeaders - }, - default: { - bodyMapper: Mappers.StorageSyncError - } - }, - serializer -}; - -const restoreheartbeatOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/restoreheartbeat", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.storageSyncServiceName, Parameters.syncGroupName, Parameters.cloudEndpointName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - headersMapper: Mappers.CloudEndpointsRestoreheartbeatHeaders - }, - default: { - bodyMapper: Mappers.StorageSyncError - } - }, + headerParameters: [Parameters.accept], serializer }; - -const beginCreateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.storageSyncServiceName, - Parameters.syncGroupName, - Parameters.cloudEndpointName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.CloudEndpointCreateParameters, - required: true - } - }, - responses: { - 200: { - bodyMapper: Mappers.CloudEndpoint, - headersMapper: Mappers.CloudEndpointsCreateHeaders - }, - 202: { - headersMapper: Mappers.CloudEndpointsCreateHeaders - }, - default: { - bodyMapper: Mappers.StorageSyncError - } - }, - serializer -}; - -const beginDeleteMethodOperationSpec: msRest.OperationSpec = { +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}", httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.storageSyncServiceName, - Parameters.syncGroupName, - Parameters.cloudEndpointName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { headersMapper: Mappers.CloudEndpointsDeleteHeaders }, + 201: { + headersMapper: Mappers.CloudEndpointsDeleteHeaders + }, 202: { headersMapper: Mappers.CloudEndpointsDeleteHeaders }, @@ -568,191 +1012,218 @@ const beginDeleteMethodOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.StorageSyncError } }, - serializer -}; - -const beginPreBackupOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prebackup", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.storageSyncServiceName, Parameters.syncGroupName, Parameters.cloudEndpointName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.BackupRequest, - required: true + headerParameters: [Parameters.accept], + serializer +}; +const listBySyncGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.CloudEndpointArray, + headersMapper: Mappers.CloudEndpointsListBySyncGroupHeaders + }, + default: { + bodyMapper: Mappers.StorageSyncError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageSyncServiceName, + Parameters.syncGroupName + ], + headerParameters: [Parameters.accept], + serializer +}; +const preBackupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prebackup", + httpMethod: "POST", responses: { 200: { headersMapper: Mappers.CloudEndpointsPreBackupHeaders }, + 201: { + headersMapper: Mappers.CloudEndpointsPreBackupHeaders + }, 202: { headersMapper: Mappers.CloudEndpointsPreBackupHeaders }, + 204: { + headersMapper: Mappers.CloudEndpointsPreBackupHeaders + }, default: { bodyMapper: Mappers.StorageSyncError } }, - serializer -}; - -const beginPostBackupOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postbackup", + requestBody: Parameters.parameters5, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.storageSyncServiceName, Parameters.syncGroupName, Parameters.cloudEndpointName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.BackupRequest, - required: true - } - }, + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const postBackupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postbackup", + httpMethod: "POST", responses: { 200: { bodyMapper: Mappers.PostBackupResponse, headersMapper: Mappers.CloudEndpointsPostBackupHeaders }, + 201: { + bodyMapper: Mappers.PostBackupResponse, + headersMapper: Mappers.CloudEndpointsPostBackupHeaders + }, 202: { + bodyMapper: Mappers.PostBackupResponse, + headersMapper: Mappers.CloudEndpointsPostBackupHeaders + }, + 204: { + bodyMapper: Mappers.PostBackupResponse, headersMapper: Mappers.CloudEndpointsPostBackupHeaders }, default: { bodyMapper: Mappers.StorageSyncError } }, - serializer -}; - -const beginPreRestoreOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prerestore", + requestBody: Parameters.parameters5, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.storageSyncServiceName, Parameters.syncGroupName, Parameters.cloudEndpointName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.PreRestoreRequest, - required: true - } - }, + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const preRestoreOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/prerestore", + httpMethod: "POST", responses: { - 200: { - headersMapper: Mappers.CloudEndpointsPreRestoreHeaders - }, - 202: { - headersMapper: Mappers.CloudEndpointsPreRestoreHeaders - }, + 200: {}, + 201: {}, + 202: {}, + 204: {}, default: { bodyMapper: Mappers.StorageSyncError } }, - serializer -}; - -const beginPostRestoreOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postrestore", + requestBody: Parameters.parameters6, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.storageSyncServiceName, Parameters.syncGroupName, Parameters.cloudEndpointName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.PostRestoreRequest, - required: true - } - }, + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const restoreheartbeatOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/restoreheartbeat", + httpMethod: "POST", responses: { 200: { - headersMapper: Mappers.CloudEndpointsPostRestoreHeaders - }, - 202: { - headersMapper: Mappers.CloudEndpointsPostRestoreHeaders + headersMapper: Mappers.CloudEndpointsRestoreheartbeatHeaders }, default: { bodyMapper: Mappers.StorageSyncError } }, - serializer -}; - -const beginTriggerChangeDetectionOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/triggerChangeDetection", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.storageSyncServiceName, Parameters.syncGroupName, Parameters.cloudEndpointName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.TriggerChangeDetectionParameters, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const postRestoreOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/postrestore", + httpMethod: "POST", responses: { - 200: { - headersMapper: Mappers.CloudEndpointsTriggerChangeDetectionHeaders - }, - 202: { - headersMapper: Mappers.CloudEndpointsTriggerChangeDetectionHeaders - }, + 200: {}, + 201: {}, + 202: {}, + 204: {}, default: { bodyMapper: Mappers.StorageSyncError } }, + requestBody: Parameters.parameters7, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageSyncServiceName, + Parameters.syncGroupName, + Parameters.cloudEndpointName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const triggerChangeDetectionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}/triggerChangeDetection", + httpMethod: "POST", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.StorageSyncError + } + }, + requestBody: Parameters.parameters8, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageSyncServiceName, + Parameters.syncGroupName, + Parameters.cloudEndpointName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", serializer }; diff --git a/sdk/storagesync/arm-storagesync/src/operations/index.ts b/sdk/storagesync/arm-storagesync/src/operations/index.ts index d6e1eee242f..d191ca1962b 100644 --- a/sdk/storagesync/arm-storagesync/src/operations/index.ts +++ b/sdk/storagesync/arm-storagesync/src/operations/index.ts @@ -1,15 +1,15 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ export * from "./operations"; export * from "./storageSyncServices"; +export * from "./privateLinkResources"; +export * from "./privateEndpointConnections"; export * from "./syncGroups"; export * from "./cloudEndpoints"; export * from "./serverEndpoints"; diff --git a/sdk/storagesync/arm-storagesync/src/operations/operationStatusOperations.ts b/sdk/storagesync/arm-storagesync/src/operations/operationStatusOperations.ts index 5e94dc133c0..caa62a2e93a 100644 --- a/sdk/storagesync/arm-storagesync/src/operations/operationStatusOperations.ts +++ b/sdk/storagesync/arm-storagesync/src/operations/operationStatusOperations.ts @@ -1,28 +1,31 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/operationStatusOperationsMappers"; +import { OperationStatusOperations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { StorageSyncManagementClientContext } from "../storageSyncManagementClientContext"; +import { MicrosoftStorageSync } from "../microsoftStorageSync"; +import { + OperationStatusGetOptionalParams, + OperationStatusGetResponse +} from "../models"; -/** Class representing a OperationStatusOperations. */ -export class OperationStatusOperations { - private readonly client: StorageSyncManagementClientContext; +/** Class containing OperationStatusOperations operations. */ +export class OperationStatusOperationsImpl + implements OperationStatusOperations { + private readonly client: MicrosoftStorageSync; /** - * Create a OperationStatusOperations. - * @param {StorageSyncManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class OperationStatusOperations class. + * @param client Reference to the service client */ - constructor(client: StorageSyncManagementClientContext) { + constructor(client: MicrosoftStorageSync) { this.client = client; } @@ -32,59 +35,28 @@ export class OperationStatusOperations { * @param locationName The desired region to obtain information from. * @param workflowId workflow Id * @param operationId operation Id - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, locationName: string, workflowId: string, operationId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param locationName The desired region to obtain information from. - * @param workflowId workflow Id - * @param operationId operation Id - * @param callback The callback - */ - get(resourceGroupName: string, locationName: string, workflowId: string, operationId: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param locationName The desired region to obtain information from. - * @param workflowId workflow Id - * @param operationId operation Id - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, locationName: string, workflowId: string, operationId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, locationName: string, workflowId: string, operationId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + locationName: string, + workflowId: string, + operationId: string, + options?: OperationStatusGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - locationName, - workflowId, - operationId, - options - }, - getOperationSpec, - callback) as Promise; + { resourceGroupName, locationName, workflowId, operationId, options }, + getOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/locations/{locationName}/workflows/{workflowId}/operations/{operationId}", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/locations/{locationName}/workflows/{workflowId}/operations/{operationId}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.locationName, - Parameters.workflowId, - Parameters.operationId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.OperationStatus, @@ -94,5 +66,15 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.StorageSyncError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.locationName, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.workflowId, + Parameters.operationId + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/storagesync/arm-storagesync/src/operations/operations.ts b/sdk/storagesync/arm-storagesync/src/operations/operations.ts index 5e526f5a7e9..43f0ff5c5fb 100644 --- a/sdk/storagesync/arm-storagesync/src/operations/operations.ts +++ b/sdk/storagesync/arm-storagesync/src/operations/operations.ts @@ -1,117 +1,111 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/operationsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Operations } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { StorageSyncManagementClientContext } from "../storageSyncManagementClientContext"; +import { MicrosoftStorageSync } from "../microsoftStorageSync"; +import { + OperationEntity, + OperationsListNextOptionalParams, + OperationsListOptionalParams, + OperationsListResponse, + OperationsListNextResponse +} from "../models"; -/** Class representing a Operations. */ -export class Operations { - private readonly client: StorageSyncManagementClientContext; +/// +/** Class containing Operations operations. */ +export class OperationsImpl implements Operations { + private readonly client: MicrosoftStorageSync; /** - * Create a Operations. - * @param {StorageSyncManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class Operations class. + * @param client Reference to the service client */ - constructor(client: StorageSyncManagementClientContext) { + constructor(client: MicrosoftStorageSync) { this.client = client; } /** * Lists all of the available Storage Sync Rest API operations. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - list(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - list(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - list(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - list(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - options + public list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listPagingAll(options); + return { + next() { + return iter.next(); }, - listOperationSpec, - callback) as Promise; + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listPagingPage(options); + } + }; + } + + private async *listPagingPage( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + let result = await this._list(options); + yield result.value || []; + let continuationToken = result.nextLink; + while (continuationToken) { + result = await this._listNext(continuationToken, options); + continuationToken = result.nextLink; + yield result.value || []; + } + } + + private async *listPagingAll( + options?: OperationsListOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listPagingPage(options)) { + yield* page; + } } /** * Lists all of the available Storage Sync Rest API operations. - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase): Promise; + private _list( + options?: OperationsListOptionalParams + ): Promise { + return this.client.sendOperationRequest({ options }, listOperationSpec); + } + /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param callback The callback + * ListNext + * @param nextLink The nextLink from the previous successful call to the List method. + * @param options The options parameters. */ - listNext(nextPageLink: string, callback: msRest.ServiceCallback): void; - /** - * @param nextPageLink The NextLink from the previous successful call to List operation. - * @param options The optional parameters - * @param callback The callback - */ - listNext(nextPageLink: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listNext(nextPageLink: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listNext( + nextLink: string, + options?: OperationsListNextOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - nextPageLink, - options - }, - listNextOperationSpec, - callback) as Promise; + { nextLink, options }, + listNextOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "providers/Microsoft.StorageSync/operations", - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - bodyMapper: Mappers.OperationEntityListResult, - headersMapper: Mappers.OperationsListHeaders - }, - default: { - bodyMapper: Mappers.StorageSyncError - } - }, - serializer -}; +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); -const listNextOperationSpec: msRest.OperationSpec = { +const listOperationSpec: coreClient.OperationSpec = { + path: "/providers/Microsoft.StorageSync/operations", httpMethod: "GET", - baseUrl: "https://management.azure.com", - path: "{nextLink}", - urlParameters: [ - Parameters.nextPageLink - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.OperationEntityListResult, @@ -121,5 +115,25 @@ const listNextOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.StorageSyncError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host], + headerParameters: [Parameters.accept], + serializer +}; +const listNextOperationSpec: coreClient.OperationSpec = { + path: "{nextLink}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.OperationEntityListResult, + headersMapper: Mappers.OperationsListNextHeaders + }, + default: { + bodyMapper: Mappers.StorageSyncError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.nextLink], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/storagesync/arm-storagesync/src/operations/privateEndpointConnections.ts b/sdk/storagesync/arm-storagesync/src/operations/privateEndpointConnections.ts new file mode 100644 index 00000000000..b5bac3d3a11 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/src/operations/privateEndpointConnections.ts @@ -0,0 +1,451 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PrivateEndpointConnections } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MicrosoftStorageSync } from "../microsoftStorageSync"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + PrivateEndpointConnection, + PrivateEndpointConnectionsListByStorageSyncServiceOptionalParams, + PrivateEndpointConnectionsGetOptionalParams, + PrivateEndpointConnectionsGetResponse, + PrivateEndpointConnectionsCreateOptionalParams, + PrivateEndpointConnectionsCreateResponse, + PrivateEndpointConnectionsDeleteOptionalParams, + PrivateEndpointConnectionsListByStorageSyncServiceResponse +} from "../models"; + +/// +/** Class containing PrivateEndpointConnections operations. */ +export class PrivateEndpointConnectionsImpl + implements PrivateEndpointConnections { + private readonly client: MicrosoftStorageSync; + + /** + * Initialize a new instance of the class PrivateEndpointConnections class. + * @param client Reference to the service client + */ + constructor(client: MicrosoftStorageSync) { + this.client = client; + } + + /** + * Get a PrivateEndpointConnection List. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param options The options parameters. + */ + public listByStorageSyncService( + resourceGroupName: string, + storageSyncServiceName: string, + options?: PrivateEndpointConnectionsListByStorageSyncServiceOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByStorageSyncServicePagingAll( + resourceGroupName, + storageSyncServiceName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByStorageSyncServicePagingPage( + resourceGroupName, + storageSyncServiceName, + options + ); + } + }; + } + + private async *listByStorageSyncServicePagingPage( + resourceGroupName: string, + storageSyncServiceName: string, + options?: PrivateEndpointConnectionsListByStorageSyncServiceOptionalParams + ): AsyncIterableIterator { + let result = await this._listByStorageSyncService( + resourceGroupName, + storageSyncServiceName, + options + ); + yield result.value || []; + } + + private async *listByStorageSyncServicePagingAll( + resourceGroupName: string, + storageSyncServiceName: string, + options?: PrivateEndpointConnectionsListByStorageSyncServiceOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByStorageSyncServicePagingPage( + resourceGroupName, + storageSyncServiceName, + options + )) { + yield* page; + } + } + + /** + * Gets the specified private endpoint connection associated with the storage sync service. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName The name of the storage sync service name within the specified + * resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the + * Azure resource + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageSyncServiceName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsGetOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { + resourceGroupName, + storageSyncServiceName, + privateEndpointConnectionName, + options + }, + getOperationSpec + ); + } + + /** + * Update the state of specified private endpoint connection associated with the storage sync service. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName The name of the storage sync service name within the specified + * resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the + * Azure resource + * @param properties The private endpoint connection properties. + * @param options The options parameters. + */ + async beginCreate( + resourceGroupName: string, + storageSyncServiceName: string, + privateEndpointConnectionName: string, + properties: PrivateEndpointConnection, + options?: PrivateEndpointConnectionsCreateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + PrivateEndpointConnectionsCreateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { + resourceGroupName, + storageSyncServiceName, + privateEndpointConnectionName, + properties, + options + }, + createOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Update the state of specified private endpoint connection associated with the storage sync service. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName The name of the storage sync service name within the specified + * resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the + * Azure resource + * @param properties The private endpoint connection properties. + * @param options The options parameters. + */ + async beginCreateAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + privateEndpointConnectionName: string, + properties: PrivateEndpointConnection, + options?: PrivateEndpointConnectionsCreateOptionalParams + ): Promise { + const poller = await this.beginCreate( + resourceGroupName, + storageSyncServiceName, + privateEndpointConnectionName, + properties, + options + ); + return poller.pollUntilDone(); + } + + /** + * Deletes the specified private endpoint connection associated with the storage sync service. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName The name of the storage sync service name within the specified + * resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the + * Azure resource + * @param options The options parameters. + */ + async beginDelete( + resourceGroupName: string, + storageSyncServiceName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams + ): Promise, void>> { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { + resourceGroupName, + storageSyncServiceName, + privateEndpointConnectionName, + options + }, + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Deletes the specified private endpoint connection associated with the storage sync service. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName The name of the storage sync service name within the specified + * resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the + * Azure resource + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + storageSyncServiceName, + privateEndpointConnectionName, + options + ); + return poller.pollUntilDone(); + } + + /** + * Get a PrivateEndpointConnection List. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param options The options parameters. + */ + private _listByStorageSyncService( + resourceGroupName: string, + storageSyncServiceName: string, + options?: PrivateEndpointConnectionsListByStorageSyncServiceOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageSyncServiceName, options }, + listByStorageSyncServiceOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PrivateEndpointConnection + }, + default: { + bodyMapper: Mappers.StorageSyncError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageSyncServiceName, + Parameters.privateEndpointConnectionName + ], + headerParameters: [Parameters.accept], + serializer +}; +const createOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.PrivateEndpointConnection + }, + 201: { + bodyMapper: Mappers.PrivateEndpointConnection + }, + 202: { + bodyMapper: Mappers.PrivateEndpointConnection + }, + 204: { + bodyMapper: Mappers.PrivateEndpointConnection + }, + default: { + bodyMapper: Mappers.StorageSyncError + } + }, + requestBody: Parameters.properties, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageSyncServiceName, + Parameters.privateEndpointConnectionName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections/{privateEndpointConnectionName}", + httpMethod: "DELETE", + responses: { + 200: {}, + 201: {}, + 202: {}, + 204: {}, + default: { + bodyMapper: Mappers.StorageSyncError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageSyncServiceName, + Parameters.privateEndpointConnectionName + ], + headerParameters: [Parameters.accept], + serializer +}; +const listByStorageSyncServiceOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateEndpointConnections", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PrivateEndpointConnectionListResult, + headersMapper: + Mappers.PrivateEndpointConnectionsListByStorageSyncServiceHeaders + }, + default: { + bodyMapper: Mappers.StorageSyncError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageSyncServiceName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/storagesync/arm-storagesync/src/operations/privateLinkResources.ts b/sdk/storagesync/arm-storagesync/src/operations/privateLinkResources.ts new file mode 100644 index 00000000000..26892559b3e --- /dev/null +++ b/sdk/storagesync/arm-storagesync/src/operations/privateLinkResources.ts @@ -0,0 +1,70 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PrivateLinkResources } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; +import * as Parameters from "../models/parameters"; +import { MicrosoftStorageSync } from "../microsoftStorageSync"; +import { + PrivateLinkResourcesListByStorageSyncServiceOptionalParams, + PrivateLinkResourcesListByStorageSyncServiceResponse +} from "../models"; + +/** Class containing PrivateLinkResources operations. */ +export class PrivateLinkResourcesImpl implements PrivateLinkResources { + private readonly client: MicrosoftStorageSync; + + /** + * Initialize a new instance of the class PrivateLinkResources class. + * @param client Reference to the service client + */ + constructor(client: MicrosoftStorageSync) { + this.client = client; + } + + /** + * Gets the private link resources that need to be created for a storage sync service. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName The name of the storage sync service name within the specified + * resource group. + * @param options The options parameters. + */ + listByStorageSyncService( + resourceGroupName: string, + storageSyncServiceName: string, + options?: PrivateLinkResourcesListByStorageSyncServiceOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageSyncServiceName, options }, + listByStorageSyncServiceOperationSpec + ); + } +} +// Operation Specifications +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByStorageSyncServiceOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/privateLinkResources", + httpMethod: "GET", + responses: { + 200: { + bodyMapper: Mappers.PrivateLinkResourceListResult + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageSyncServiceName + ], + headerParameters: [Parameters.accept], + serializer +}; diff --git a/sdk/storagesync/arm-storagesync/src/operations/registeredServers.ts b/sdk/storagesync/arm-storagesync/src/operations/registeredServers.ts index a82543597dc..0b3ef1b0610 100644 --- a/sdk/storagesync/arm-storagesync/src/operations/registeredServers.ts +++ b/sdk/storagesync/arm-storagesync/src/operations/registeredServers.ts @@ -1,29 +1,45 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/registeredServersMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { RegisteredServers } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { StorageSyncManagementClientContext } from "../storageSyncManagementClientContext"; +import { MicrosoftStorageSync } from "../microsoftStorageSync"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + RegisteredServer, + RegisteredServersListByStorageSyncServiceOptionalParams, + RegisteredServersListByStorageSyncServiceResponse, + RegisteredServersGetOptionalParams, + RegisteredServersGetResponse, + RegisteredServerCreateParameters, + RegisteredServersCreateOptionalParams, + RegisteredServersCreateResponse, + RegisteredServersDeleteOptionalParams, + RegisteredServersDeleteResponse, + TriggerRolloverRequest, + RegisteredServersTriggerRolloverOptionalParams, + RegisteredServersTriggerRolloverResponse +} from "../models"; -/** Class representing a RegisteredServers. */ -export class RegisteredServers { - private readonly client: StorageSyncManagementClientContext; +/// +/** Class containing RegisteredServers operations. */ +export class RegisteredServersImpl implements RegisteredServers { + private readonly client: MicrosoftStorageSync; /** - * Create a RegisteredServers. - * @param {StorageSyncManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class RegisteredServers class. + * @param client Reference to the service client */ - constructor(client: StorageSyncManagementClientContext) { + constructor(client: MicrosoftStorageSync) { this.client = client; } @@ -31,32 +47,77 @@ export class RegisteredServers { * Get a given registered server list. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param callback The callback - */ - listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param options The optional parameters - * @param callback The callback - */ - listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - storageSyncServiceName, - options + public listByStorageSyncService( + resourceGroupName: string, + storageSyncServiceName: string, + options?: RegisteredServersListByStorageSyncServiceOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByStorageSyncServicePagingAll( + resourceGroupName, + storageSyncServiceName, + options + ); + return { + next() { + return iter.next(); }, - listByStorageSyncServiceOperationSpec, - callback) as Promise; + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByStorageSyncServicePagingPage( + resourceGroupName, + storageSyncServiceName, + options + ); + } + }; + } + + private async *listByStorageSyncServicePagingPage( + resourceGroupName: string, + storageSyncServiceName: string, + options?: RegisteredServersListByStorageSyncServiceOptionalParams + ): AsyncIterableIterator { + let result = await this._listByStorageSyncService( + resourceGroupName, + storageSyncServiceName, + options + ); + yield result.value || []; + } + + private async *listByStorageSyncServicePagingAll( + resourceGroupName: string, + storageSyncServiceName: string, + options?: RegisteredServersListByStorageSyncServiceOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByStorageSyncServicePagingPage( + resourceGroupName, + storageSyncServiceName, + options + )) { + yield* page; + } + } + + /** + * Get a given registered server list. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param options The options parameters. + */ + private _listByStorageSyncService( + resourceGroupName: string, + storageSyncServiceName: string, + options?: RegisteredServersListByStorageSyncServiceOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageSyncServiceName, options }, + listByStorageSyncServiceOperationSpec + ); } /** @@ -64,35 +125,18 @@ export class RegisteredServers { * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param storageSyncServiceName Name of Storage Sync Service resource. * @param serverId GUID identifying the on-premises server. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, storageSyncServiceName: string, serverId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param serverId GUID identifying the on-premises server. - * @param callback The callback - */ - get(resourceGroupName: string, storageSyncServiceName: string, serverId: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param serverId GUID identifying the on-premises server. - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, storageSyncServiceName: string, serverId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, storageSyncServiceName: string, serverId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + storageSyncServiceName: string, + serverId: string, + options?: RegisteredServersGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - storageSyncServiceName, - serverId, - options - }, - getOperationSpec, - callback) as Promise; + { resourceGroupName, storageSyncServiceName, serverId, options }, + getOperationSpec + ); } /** @@ -101,39 +145,74 @@ export class RegisteredServers { * @param storageSyncServiceName Name of Storage Sync Service resource. * @param serverId GUID identifying the on-premises server. * @param parameters Body of Registered Server object. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - create(resourceGroupName: string, storageSyncServiceName: string, serverId: string, parameters: Models.RegisteredServerCreateParameters, options?: msRest.RequestOptionsBase): Promise { - return this.beginCreate(resourceGroupName,storageSyncServiceName,serverId,parameters,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; - } + async beginCreate( + resourceGroupName: string, + storageSyncServiceName: string, + serverId: string, + parameters: RegisteredServerCreateParameters, + options?: RegisteredServersCreateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + RegisteredServersCreateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; - /** - * Delete the given registered server. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param serverId GUID identifying the on-premises server. - * @param [options] The optional parameters - * @returns Promise - */ - deleteMethod(resourceGroupName: string, storageSyncServiceName: string, serverId: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginDeleteMethod(resourceGroupName,storageSyncServiceName,serverId,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; - } - - /** - * Triggers Server certificate rollover. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param serverId Server Id - * @param parameters Body of Trigger Rollover request. - * @param [options] The optional parameters - * @returns Promise - */ - triggerRollover(resourceGroupName: string, storageSyncServiceName: string, serverId: string, parameters: Models.TriggerRolloverRequest, options?: msRest.RequestOptionsBase): Promise { - return this.beginTriggerRollover(resourceGroupName,storageSyncServiceName,serverId,parameters,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + const lro = new LroImpl( + sendOperation, + { + resourceGroupName, + storageSyncServiceName, + serverId, + parameters, + options + }, + createOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** @@ -142,20 +221,23 @@ export class RegisteredServers { * @param storageSyncServiceName Name of Storage Sync Service resource. * @param serverId GUID identifying the on-premises server. * @param parameters Body of Registered Server object. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginCreate(resourceGroupName: string, storageSyncServiceName: string, serverId: string, parameters: Models.RegisteredServerCreateParameters, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - storageSyncServiceName, - serverId, - parameters, - options - }, - beginCreateOperationSpec, - options); + async beginCreateAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + serverId: string, + parameters: RegisteredServerCreateParameters, + options?: RegisteredServersCreateOptionalParams + ): Promise { + const poller = await this.beginCreate( + resourceGroupName, + storageSyncServiceName, + serverId, + parameters, + options + ); + return poller.pollUntilDone(); } /** @@ -163,19 +245,89 @@ export class RegisteredServers { * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param storageSyncServiceName Name of Storage Sync Service resource. * @param serverId GUID identifying the on-premises server. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginDeleteMethod(resourceGroupName: string, storageSyncServiceName: string, serverId: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - storageSyncServiceName, - serverId, - options - }, - beginDeleteMethodOperationSpec, - options); + async beginDelete( + resourceGroupName: string, + storageSyncServiceName: string, + serverId: string, + options?: RegisteredServersDeleteOptionalParams + ): Promise< + PollerLike< + PollOperationState, + RegisteredServersDeleteResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, storageSyncServiceName, serverId, options }, + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Delete the given registered server. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param serverId GUID identifying the on-premises server. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + serverId: string, + options?: RegisteredServersDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + storageSyncServiceName, + serverId, + options + ); + return poller.pollUntilDone(); } /** @@ -184,11 +336,61 @@ export class RegisteredServers { * @param storageSyncServiceName Name of Storage Sync Service resource. * @param serverId Server Id * @param parameters Body of Trigger Rollover request. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginTriggerRollover(resourceGroupName: string, storageSyncServiceName: string, serverId: string, parameters: Models.TriggerRolloverRequest, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( + async beginTriggerRollover( + resourceGroupName: string, + storageSyncServiceName: string, + serverId: string, + parameters: TriggerRolloverRequest, + options?: RegisteredServersTriggerRolloverOptionalParams + ): Promise< + PollerLike< + PollOperationState, + RegisteredServersTriggerRolloverResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, { resourceGroupName, storageSyncServiceName, @@ -196,27 +398,46 @@ export class RegisteredServers { parameters, options }, - beginTriggerRolloverOperationSpec, - options); + triggerRolloverOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Triggers Server certificate rollover. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param serverId Server Id + * @param parameters Body of Trigger Rollover request. + * @param options The options parameters. + */ + async beginTriggerRolloverAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + serverId: string, + parameters: TriggerRolloverRequest, + options?: RegisteredServersTriggerRolloverOptionalParams + ): Promise { + const poller = await this.beginTriggerRollover( + resourceGroupName, + storageSyncServiceName, + serverId, + parameters, + options + ); + return poller.pollUntilDone(); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listByStorageSyncServiceOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByStorageSyncServiceOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.storageSyncServiceName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.RegisteredServerArray, @@ -226,24 +447,20 @@ const listByStorageSyncServiceOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.StorageSyncError } }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.storageSyncServiceName, - Parameters.serverId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.storageSyncServiceName ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.RegisteredServer, @@ -253,65 +470,66 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.StorageSyncError } }, - serializer -}; - -const beginCreateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.storageSyncServiceName, Parameters.serverId ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.RegisteredServerCreateParameters, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const createOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}", + httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.RegisteredServer, headersMapper: Mappers.RegisteredServersCreateHeaders }, + 201: { + bodyMapper: Mappers.RegisteredServer, + headersMapper: Mappers.RegisteredServersCreateHeaders + }, 202: { + bodyMapper: Mappers.RegisteredServer, + headersMapper: Mappers.RegisteredServersCreateHeaders + }, + 204: { + bodyMapper: Mappers.RegisteredServer, headersMapper: Mappers.RegisteredServersCreateHeaders }, default: { bodyMapper: Mappers.StorageSyncError } }, - serializer -}; - -const beginDeleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}", + requestBody: Parameters.parameters12, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.storageSyncServiceName, Parameters.serverId ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}", + httpMethod: "DELETE", responses: { 200: { headersMapper: Mappers.RegisteredServersDeleteHeaders }, + 201: { + headersMapper: Mappers.RegisteredServersDeleteHeaders + }, 202: { headersMapper: Mappers.RegisteredServersDeleteHeaders }, @@ -322,41 +540,48 @@ const beginDeleteMethodOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.StorageSyncError } }, - serializer -}; - -const beginTriggerRolloverOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}/triggerRollover", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.storageSyncServiceName, Parameters.serverId ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.TriggerRolloverRequest, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const triggerRolloverOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/registeredServers/{serverId}/triggerRollover", + httpMethod: "POST", responses: { 200: { headersMapper: Mappers.RegisteredServersTriggerRolloverHeaders }, + 201: { + headersMapper: Mappers.RegisteredServersTriggerRolloverHeaders + }, 202: { headersMapper: Mappers.RegisteredServersTriggerRolloverHeaders }, + 204: { + headersMapper: Mappers.RegisteredServersTriggerRolloverHeaders + }, default: { bodyMapper: Mappers.StorageSyncError } }, + requestBody: Parameters.parameters13, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageSyncServiceName, + Parameters.serverId + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", serializer }; diff --git a/sdk/storagesync/arm-storagesync/src/operations/serverEndpoints.ts b/sdk/storagesync/arm-storagesync/src/operations/serverEndpoints.ts index e4ebf1aa217..5f1f461ad3f 100644 --- a/sdk/storagesync/arm-storagesync/src/operations/serverEndpoints.ts +++ b/sdk/storagesync/arm-storagesync/src/operations/serverEndpoints.ts @@ -1,32 +1,118 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; -import * as Models from "../models"; -import * as Mappers from "../models/serverEndpointsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { ServerEndpoints } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { StorageSyncManagementClientContext } from "../storageSyncManagementClientContext"; +import { MicrosoftStorageSync } from "../microsoftStorageSync"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + ServerEndpoint, + ServerEndpointsListBySyncGroupOptionalParams, + ServerEndpointCreateParameters, + ServerEndpointsCreateOptionalParams, + ServerEndpointsCreateResponse, + ServerEndpointsUpdateOptionalParams, + ServerEndpointsUpdateResponse, + ServerEndpointsGetOptionalParams, + ServerEndpointsGetResponse, + ServerEndpointsDeleteOptionalParams, + ServerEndpointsDeleteResponse, + ServerEndpointsListBySyncGroupResponse, + RecallActionParameters, + ServerEndpointsRecallActionOptionalParams, + ServerEndpointsRecallActionResponse +} from "../models"; -/** Class representing a ServerEndpoints. */ -export class ServerEndpoints { - private readonly client: StorageSyncManagementClientContext; +/// +/** Class containing ServerEndpoints operations. */ +export class ServerEndpointsImpl implements ServerEndpoints { + private readonly client: MicrosoftStorageSync; /** - * Create a ServerEndpoints. - * @param {StorageSyncManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class ServerEndpoints class. + * @param client Reference to the service client */ - constructor(client: StorageSyncManagementClientContext) { + constructor(client: MicrosoftStorageSync) { this.client = client; } + /** + * Get a ServerEndpoint list. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param options The options parameters. + */ + public listBySyncGroup( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + options?: ServerEndpointsListBySyncGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySyncGroupPagingAll( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + options + ); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listBySyncGroupPagingPage( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + options + ); + } + }; + } + + private async *listBySyncGroupPagingPage( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + options?: ServerEndpointsListBySyncGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listBySyncGroup( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + options + ); + yield result.value || []; + } + + private async *listBySyncGroupPagingAll( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + options?: ServerEndpointsListBySyncGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySyncGroupPagingPage( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + options + )) { + yield* page; + } + } + /** * Create a new ServerEndpoint. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -34,12 +120,104 @@ export class ServerEndpoints { * @param syncGroupName Name of Sync Group resource. * @param serverEndpointName Name of Server Endpoint object. * @param parameters Body of Server Endpoint object. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, parameters: Models.ServerEndpointCreateParameters, options?: msRest.RequestOptionsBase): Promise { - return this.beginCreate(resourceGroupName,storageSyncServiceName,syncGroupName,serverEndpointName,parameters,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginCreate( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + serverEndpointName: string, + parameters: ServerEndpointCreateParameters, + options?: ServerEndpointsCreateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ServerEndpointsCreateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName, + parameters, + options + }, + createOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Create a new ServerEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param serverEndpointName Name of Server Endpoint object. + * @param parameters Body of Server Endpoint object. + * @param options The options parameters. + */ + async beginCreateAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + serverEndpointName: string, + parameters: ServerEndpointCreateParameters, + options?: ServerEndpointsCreateOptionalParams + ): Promise { + const poller = await this.beginCreate( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName, + parameters, + options + ); + return poller.pollUntilDone(); } /** @@ -48,12 +226,99 @@ export class ServerEndpoints { * @param storageSyncServiceName Name of Storage Sync Service resource. * @param syncGroupName Name of Sync Group resource. * @param serverEndpointName Name of Server Endpoint object. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - update(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: Models.ServerEndpointsUpdateOptionalParams): Promise { - return this.beginUpdate(resourceGroupName,storageSyncServiceName,syncGroupName,serverEndpointName,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginUpdate( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + serverEndpointName: string, + options?: ServerEndpointsUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ServerEndpointsUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName, + options + }, + updateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Patch a given ServerEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param serverEndpointName Name of Server Endpoint object. + * @param options The options parameters. + */ + async beginUpdateAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + serverEndpointName: string, + options?: ServerEndpointsUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName, + options + ); + return poller.pollUntilDone(); } /** @@ -62,28 +327,15 @@ export class ServerEndpoints { * @param storageSyncServiceName Name of Storage Sync Service resource. * @param syncGroupName Name of Sync Group resource. * @param serverEndpointName Name of Server Endpoint object. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param serverEndpointName Name of Server Endpoint object. - * @param callback The callback - */ - get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param serverEndpointName Name of Server Endpoint object. - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + serverEndpointName: string, + options?: ServerEndpointsGetOptionalParams + ): Promise { return this.client.sendOperationRequest( { resourceGroupName, @@ -92,8 +344,8 @@ export class ServerEndpoints { serverEndpointName, options }, - getOperationSpec, - callback) as Promise; + getOperationSpec + ); } /** @@ -102,12 +354,99 @@ export class ServerEndpoints { * @param storageSyncServiceName Name of Storage Sync Service resource. * @param syncGroupName Name of Sync Group resource. * @param serverEndpointName Name of Server Endpoint object. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - deleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: msRest.RequestOptionsBase): Promise { - return this.beginDeleteMethod(resourceGroupName,storageSyncServiceName,syncGroupName,serverEndpointName,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; + async beginDelete( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + serverEndpointName: string, + options?: ServerEndpointsDeleteOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ServerEndpointsDeleteResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName, + options + }, + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + + /** + * Delete a given ServerEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param serverEndpointName Name of Server Endpoint object. + * @param options The options parameters. + */ + async beginDeleteAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + serverEndpointName: string, + options?: ServerEndpointsDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName, + options + ); + return poller.pollUntilDone(); } /** @@ -115,35 +454,18 @@ export class ServerEndpoints { * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param storageSyncServiceName Name of Storage Sync Service resource. * @param syncGroupName Name of Sync Group resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param callback The callback - */ - listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param options The optional parameters - * @param callback The callback - */ - listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listBySyncGroup(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listBySyncGroup( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + options?: ServerEndpointsListBySyncGroupOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - storageSyncServiceName, - syncGroupName, - options - }, - listBySyncGroupOperationSpec, - callback) as Promise; + { resourceGroupName, storageSyncServiceName, syncGroupName, options }, + listBySyncGroupOperationSpec + ); } /** @@ -153,26 +475,62 @@ export class ServerEndpoints { * @param syncGroupName Name of Sync Group resource. * @param serverEndpointName Name of Server Endpoint object. * @param parameters Body of Recall Action object. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - recallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, parameters: Models.RecallActionParameters, options?: msRest.RequestOptionsBase): Promise { - return this.beginRecallAction(resourceGroupName,storageSyncServiceName,syncGroupName,serverEndpointName,parameters,options) - .then(lroPoller => lroPoller.pollUntilFinished()) as Promise; - } + async beginRecallAction( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + serverEndpointName: string, + parameters: RecallActionParameters, + options?: ServerEndpointsRecallActionOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ServerEndpointsRecallActionResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; - /** - * Create a new ServerEndpoint. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param serverEndpointName Name of Server Endpoint object. - * @param parameters Body of Server Endpoint object. - * @param [options] The optional parameters - * @returns Promise - */ - beginCreate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, parameters: Models.ServerEndpointCreateParameters, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( + const lro = new LroImpl( + sendOperation, { resourceGroupName, storageSyncServiceName, @@ -181,52 +539,12 @@ export class ServerEndpoints { parameters, options }, - beginCreateOperationSpec, - options); - } - - /** - * Patch a given ServerEndpoint. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param serverEndpointName Name of Server Endpoint object. - * @param [options] The optional parameters - * @returns Promise - */ - beginUpdate(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: Models.ServerEndpointsBeginUpdateOptionalParams): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - storageSyncServiceName, - syncGroupName, - serverEndpointName, - options - }, - beginUpdateOperationSpec, - options); - } - - /** - * Delete a given ServerEndpoint. - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param serverEndpointName Name of Server Endpoint object. - * @param [options] The optional parameters - * @returns Promise - */ - beginDeleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - storageSyncServiceName, - syncGroupName, - serverEndpointName, - options - }, - beginDeleteMethodOperationSpec, - options); + recallActionOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); } /** @@ -236,42 +554,112 @@ export class ServerEndpoints { * @param syncGroupName Name of Sync Group resource. * @param serverEndpointName Name of Server Endpoint object. * @param parameters Body of Recall Action object. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - beginRecallAction(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, serverEndpointName: string, parameters: Models.RecallActionParameters, options?: msRest.RequestOptionsBase): Promise { - return this.client.sendLRORequest( - { - resourceGroupName, - storageSyncServiceName, - syncGroupName, - serverEndpointName, - parameters, - options - }, - beginRecallActionOperationSpec, - options); + async beginRecallActionAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + serverEndpointName: string, + parameters: RecallActionParameters, + options?: ServerEndpointsRecallActionOptionalParams + ): Promise { + const poller = await this.beginRecallAction( + resourceGroupName, + storageSyncServiceName, + syncGroupName, + serverEndpointName, + parameters, + options + ); + return poller.pollUntilDone(); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}", +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const createOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}", + httpMethod: "PUT", + responses: { + 200: { + bodyMapper: Mappers.ServerEndpoint, + headersMapper: Mappers.ServerEndpointsCreateHeaders + }, + 201: { + bodyMapper: Mappers.ServerEndpoint, + headersMapper: Mappers.ServerEndpointsCreateHeaders + }, + 202: { + bodyMapper: Mappers.ServerEndpoint, + headersMapper: Mappers.ServerEndpointsCreateHeaders + }, + 204: { + bodyMapper: Mappers.ServerEndpoint, + headersMapper: Mappers.ServerEndpointsCreateHeaders + }, + default: { + bodyMapper: Mappers.StorageSyncError + } + }, + requestBody: Parameters.parameters9, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.storageSyncServiceName, Parameters.syncGroupName, Parameters.serverEndpointName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}", + httpMethod: "PATCH", + responses: { + 200: { + bodyMapper: Mappers.ServerEndpoint, + headersMapper: Mappers.ServerEndpointsUpdateHeaders + }, + 201: { + bodyMapper: Mappers.ServerEndpoint, + headersMapper: Mappers.ServerEndpointsUpdateHeaders + }, + 202: { + bodyMapper: Mappers.ServerEndpoint, + headersMapper: Mappers.ServerEndpointsUpdateHeaders + }, + 204: { + bodyMapper: Mappers.ServerEndpoint, + headersMapper: Mappers.ServerEndpointsUpdateHeaders + }, + default: { + bodyMapper: Mappers.StorageSyncError + } + }, + requestBody: Parameters.parameters10, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageSyncServiceName, + Parameters.syncGroupName, + Parameters.serverEndpointName ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ServerEndpoint, @@ -281,24 +669,55 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.StorageSyncError } }, - serializer -}; - -const listBySyncGroupOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.storageSyncServiceName, - Parameters.syncGroupName + Parameters.syncGroupName, + Parameters.serverEndpointName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + headerParameters: [Parameters.accept], + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}", + httpMethod: "DELETE", + responses: { + 200: { + headersMapper: Mappers.ServerEndpointsDeleteHeaders + }, + 201: { + headersMapper: Mappers.ServerEndpointsDeleteHeaders + }, + 202: { + headersMapper: Mappers.ServerEndpointsDeleteHeaders + }, + 204: { + headersMapper: Mappers.ServerEndpointsDeleteHeaders + }, + default: { + bodyMapper: Mappers.StorageSyncError + } + }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageSyncServiceName, + Parameters.syncGroupName, + Parameters.serverEndpointName ], + headerParameters: [Parameters.accept], + serializer +}; +const listBySyncGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.ServerEndpointArray, @@ -308,148 +727,49 @@ const listBySyncGroupOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.StorageSyncError } }, - serializer -}; - -const beginCreateOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.storageSyncServiceName, - Parameters.syncGroupName, - Parameters.serverEndpointName + Parameters.syncGroupName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.ServerEndpointCreateParameters, - required: true - } - }, - responses: { - 200: { - bodyMapper: Mappers.ServerEndpoint, - headersMapper: Mappers.ServerEndpointsCreateHeaders - }, - 202: { - headersMapper: Mappers.ServerEndpointsCreateHeaders - }, - default: { - bodyMapper: Mappers.StorageSyncError - } - }, + headerParameters: [Parameters.accept], serializer }; - -const beginUpdateOperationSpec: msRest.OperationSpec = { - httpMethod: "PATCH", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.storageSyncServiceName, - Parameters.syncGroupName, - Parameters.serverEndpointName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: [ - "options", - "parameters" - ], - mapper: Mappers.ServerEndpointUpdateParameters - }, - responses: { - 200: { - bodyMapper: Mappers.ServerEndpoint, - headersMapper: Mappers.ServerEndpointsUpdateHeaders - }, - 202: { - headersMapper: Mappers.ServerEndpointsUpdateHeaders - }, - default: { - bodyMapper: Mappers.StorageSyncError - } - }, - serializer -}; - -const beginDeleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.storageSyncServiceName, - Parameters.syncGroupName, - Parameters.serverEndpointName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - responses: { - 200: { - headersMapper: Mappers.ServerEndpointsDeleteHeaders - }, - 202: { - headersMapper: Mappers.ServerEndpointsDeleteHeaders - }, - default: { - bodyMapper: Mappers.StorageSyncError - } - }, - serializer -}; - -const beginRecallActionOperationSpec: msRest.OperationSpec = { +const recallActionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}/recallAction", httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/serverEndpoints/{serverEndpointName}/recallAction", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.storageSyncServiceName, - Parameters.syncGroupName, - Parameters.serverEndpointName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.RecallActionParameters, - required: true - } - }, responses: { 200: { headersMapper: Mappers.ServerEndpointsRecallActionHeaders }, + 201: { + headersMapper: Mappers.ServerEndpointsRecallActionHeaders + }, 202: { headersMapper: Mappers.ServerEndpointsRecallActionHeaders }, + 204: { + headersMapper: Mappers.ServerEndpointsRecallActionHeaders + }, default: { bodyMapper: Mappers.StorageSyncError } }, + requestBody: Parameters.parameters11, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageSyncServiceName, + Parameters.syncGroupName, + Parameters.serverEndpointName + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", serializer }; diff --git a/sdk/storagesync/arm-storagesync/src/operations/storageSyncServices.ts b/sdk/storagesync/arm-storagesync/src/operations/storageSyncServices.ts index 4b38dbe1496..e16acca4d1b 100644 --- a/sdk/storagesync/arm-storagesync/src/operations/storageSyncServices.ts +++ b/sdk/storagesync/arm-storagesync/src/operations/storageSyncServices.ts @@ -1,61 +1,146 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/storageSyncServicesMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { StorageSyncServices } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { StorageSyncManagementClientContext } from "../storageSyncManagementClientContext"; +import { MicrosoftStorageSync } from "../microsoftStorageSync"; +import { PollerLike, PollOperationState, LroEngine } from "@azure/core-lro"; +import { LroImpl } from "../lroImpl"; +import { + StorageSyncService, + StorageSyncServicesListByResourceGroupOptionalParams, + StorageSyncServicesListBySubscriptionOptionalParams, + CheckNameAvailabilityParameters, + StorageSyncServicesCheckNameAvailabilityOptionalParams, + StorageSyncServicesCheckNameAvailabilityResponse, + StorageSyncServiceCreateParameters, + StorageSyncServicesCreateOptionalParams, + StorageSyncServicesCreateResponse, + StorageSyncServicesGetOptionalParams, + StorageSyncServicesGetResponse, + StorageSyncServicesUpdateOptionalParams, + StorageSyncServicesUpdateResponse, + StorageSyncServicesDeleteOptionalParams, + StorageSyncServicesDeleteResponse, + StorageSyncServicesListByResourceGroupResponse, + StorageSyncServicesListBySubscriptionResponse +} from "../models"; -/** Class representing a StorageSyncServices. */ -export class StorageSyncServices { - private readonly client: StorageSyncManagementClientContext; +/// +/** Class containing StorageSyncServices operations. */ +export class StorageSyncServicesImpl implements StorageSyncServices { + private readonly client: MicrosoftStorageSync; /** - * Create a StorageSyncServices. - * @param {StorageSyncManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class StorageSyncServices class. + * @param client Reference to the service client */ - constructor(client: StorageSyncManagementClientContext) { + constructor(client: MicrosoftStorageSync) { this.client = client; } + /** + * Get a StorageSyncService list by Resource group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + public listByResourceGroup( + resourceGroupName: string, + options?: StorageSyncServicesListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByResourceGroupPagingAll(resourceGroupName, options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByResourceGroupPagingPage(resourceGroupName, options); + } + }; + } + + private async *listByResourceGroupPagingPage( + resourceGroupName: string, + options?: StorageSyncServicesListByResourceGroupOptionalParams + ): AsyncIterableIterator { + let result = await this._listByResourceGroup(resourceGroupName, options); + yield result.value || []; + } + + private async *listByResourceGroupPagingAll( + resourceGroupName: string, + options?: StorageSyncServicesListByResourceGroupOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByResourceGroupPagingPage( + resourceGroupName, + options + )) { + yield* page; + } + } + + /** + * Get a StorageSyncService list by subscription. + * @param options The options parameters. + */ + public listBySubscription( + options?: StorageSyncServicesListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listBySubscriptionPagingAll(options); + return { + next() { + return iter.next(); + }, + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listBySubscriptionPagingPage(options); + } + }; + } + + private async *listBySubscriptionPagingPage( + options?: StorageSyncServicesListBySubscriptionOptionalParams + ): AsyncIterableIterator { + let result = await this._listBySubscription(options); + yield result.value || []; + } + + private async *listBySubscriptionPagingAll( + options?: StorageSyncServicesListBySubscriptionOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listBySubscriptionPagingPage(options)) { + yield* page; + } + } + /** * Check the give namespace name availability. * @param locationName The desired region for the name check. * @param parameters Parameters to check availability of the given namespace name - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - checkNameAvailability(locationName: string, parameters: Models.CheckNameAvailabilityParameters, options?: msRest.RequestOptionsBase): Promise; - /** - * @param locationName The desired region for the name check. - * @param parameters Parameters to check availability of the given namespace name - * @param callback The callback - */ - checkNameAvailability(locationName: string, parameters: Models.CheckNameAvailabilityParameters, callback: msRest.ServiceCallback): void; - /** - * @param locationName The desired region for the name check. - * @param parameters Parameters to check availability of the given namespace name - * @param options The optional parameters - * @param callback The callback - */ - checkNameAvailability(locationName: string, parameters: Models.CheckNameAvailabilityParameters, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - checkNameAvailability(locationName: string, parameters: Models.CheckNameAvailabilityParameters, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + checkNameAvailability( + locationName: string, + parameters: CheckNameAvailabilityParameters, + options?: StorageSyncServicesCheckNameAvailabilityOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - locationName, - parameters, - options - }, - checkNameAvailabilityOperationSpec, - callback) as Promise; + { locationName, parameters, options }, + checkNameAvailabilityOperationSpec + ); } /** @@ -63,265 +148,366 @@ export class StorageSyncServices { * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param storageSyncServiceName Name of Storage Sync Service resource. * @param parameters Storage Sync Service resource name. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - create(resourceGroupName: string, storageSyncServiceName: string, parameters: Models.StorageSyncServiceCreateParameters, options?: msRest.RequestOptionsBase): Promise; + async beginCreate( + resourceGroupName: string, + storageSyncServiceName: string, + parameters: StorageSyncServiceCreateParameters, + options?: StorageSyncServicesCreateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + StorageSyncServicesCreateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, storageSyncServiceName, parameters, options }, + createOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + /** + * Create a new StorageSyncService. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param storageSyncServiceName Name of Storage Sync Service resource. * @param parameters Storage Sync Service resource name. - * @param callback The callback + * @param options The options parameters. */ - create(resourceGroupName: string, storageSyncServiceName: string, parameters: Models.StorageSyncServiceCreateParameters, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param parameters Storage Sync Service resource name. - * @param options The optional parameters - * @param callback The callback - */ - create(resourceGroupName: string, storageSyncServiceName: string, parameters: Models.StorageSyncServiceCreateParameters, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - create(resourceGroupName: string, storageSyncServiceName: string, parameters: Models.StorageSyncServiceCreateParameters, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - storageSyncServiceName, - parameters, - options - }, - createOperationSpec, - callback) as Promise; + async beginCreateAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + parameters: StorageSyncServiceCreateParameters, + options?: StorageSyncServicesCreateOptionalParams + ): Promise { + const poller = await this.beginCreate( + resourceGroupName, + storageSyncServiceName, + parameters, + options + ); + return poller.pollUntilDone(); } /** * Get a given StorageSyncService. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, storageSyncServiceName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param callback The callback - */ - get(resourceGroupName: string, storageSyncServiceName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, storageSyncServiceName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, storageSyncServiceName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + storageSyncServiceName: string, + options?: StorageSyncServicesGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - storageSyncServiceName, - options - }, - getOperationSpec, - callback) as Promise; + { resourceGroupName, storageSyncServiceName, options }, + getOperationSpec + ); } /** * Patch a given StorageSyncService. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - update(resourceGroupName: string, storageSyncServiceName: string, options?: Models.StorageSyncServicesUpdateOptionalParams): Promise; + async beginUpdate( + resourceGroupName: string, + storageSyncServiceName: string, + options?: StorageSyncServicesUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + StorageSyncServicesUpdateResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, storageSyncServiceName, options }, + updateOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + /** + * Patch a given StorageSyncService. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param callback The callback + * @param options The options parameters. */ - update(resourceGroupName: string, storageSyncServiceName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param options The optional parameters - * @param callback The callback - */ - update(resourceGroupName: string, storageSyncServiceName: string, options: Models.StorageSyncServicesUpdateOptionalParams, callback: msRest.ServiceCallback): void; - update(resourceGroupName: string, storageSyncServiceName: string, options?: Models.StorageSyncServicesUpdateOptionalParams | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - storageSyncServiceName, - options - }, - updateOperationSpec, - callback) as Promise; + async beginUpdateAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + options?: StorageSyncServicesUpdateOptionalParams + ): Promise { + const poller = await this.beginUpdate( + resourceGroupName, + storageSyncServiceName, + options + ); + return poller.pollUntilDone(); } /** * Delete a given StorageSyncService. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - deleteMethod(resourceGroupName: string, storageSyncServiceName: string, options?: msRest.RequestOptionsBase): Promise; + async beginDelete( + resourceGroupName: string, + storageSyncServiceName: string, + options?: StorageSyncServicesDeleteOptionalParams + ): Promise< + PollerLike< + PollOperationState, + StorageSyncServicesDeleteResponse + > + > { + const directSendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ): Promise => { + return this.client.sendOperationRequest(args, spec); + }; + const sendOperation = async ( + args: coreClient.OperationArguments, + spec: coreClient.OperationSpec + ) => { + let currentRawResponse: + | coreClient.FullOperationResponse + | undefined = undefined; + const providedCallback = args.options?.onResponse; + const callback: coreClient.RawResponseCallback = ( + rawResponse: coreClient.FullOperationResponse, + flatResponse: unknown + ) => { + currentRawResponse = rawResponse; + providedCallback?.(rawResponse, flatResponse); + }; + const updatedArgs = { + ...args, + options: { + ...args.options, + onResponse: callback + } + }; + const flatResponse = await directSendOperation(updatedArgs, spec); + return { + flatResponse, + rawResponse: { + statusCode: currentRawResponse!.status, + body: currentRawResponse!.parsedBody, + headers: currentRawResponse!.headers.toJSON() + } + }; + }; + + const lro = new LroImpl( + sendOperation, + { resourceGroupName, storageSyncServiceName, options }, + deleteOperationSpec + ); + return new LroEngine(lro, { + resumeFrom: options?.resumeFrom, + intervalInMs: options?.updateIntervalInMs + }); + } + /** + * Delete a given StorageSyncService. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param callback The callback + * @param options The options parameters. */ - deleteMethod(resourceGroupName: string, storageSyncServiceName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param options The optional parameters - * @param callback The callback - */ - deleteMethod(resourceGroupName: string, storageSyncServiceName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteMethod(resourceGroupName: string, storageSyncServiceName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - storageSyncServiceName, - options - }, - deleteMethodOperationSpec, - callback) as Promise; + async beginDeleteAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + options?: StorageSyncServicesDeleteOptionalParams + ): Promise { + const poller = await this.beginDelete( + resourceGroupName, + storageSyncServiceName, + options + ); + return poller.pollUntilDone(); } /** * Get a StorageSyncService list by Resource group name. * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param callback The callback - */ - listByResourceGroup(resourceGroupName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param options The optional parameters - * @param callback The callback - */ - listByResourceGroup(resourceGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByResourceGroup(resourceGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listByResourceGroup( + resourceGroupName: string, + options?: StorageSyncServicesListByResourceGroupOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - options - }, - listByResourceGroupOperationSpec, - callback) as Promise; + { resourceGroupName, options }, + listByResourceGroupOperationSpec + ); } /** * Get a StorageSyncService list by subscription. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listBySubscription(options?: msRest.RequestOptionsBase): Promise; - /** - * @param callback The callback - */ - listBySubscription(callback: msRest.ServiceCallback): void; - /** - * @param options The optional parameters - * @param callback The callback - */ - listBySubscription(options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listBySubscription(options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + private _listBySubscription( + options?: StorageSyncServicesListBySubscriptionOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - options - }, - listBySubscriptionOperationSpec, - callback) as Promise; + { options }, + listBySubscriptionOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const checkNameAvailabilityOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const checkNameAvailabilityOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/checkNameAvailability", httpMethod: "POST", - path: "subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/locations/{locationName}/checkNameAvailability", - urlParameters: [ - Parameters.locationName, - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.CheckNameAvailabilityParameters, - required: true - } - }, responses: { 200: { bodyMapper: Mappers.CheckNameAvailabilityResult - }, - default: { - bodyMapper: Mappers.CloudError } }, + requestBody: Parameters.parameters, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.locationName, + Parameters.subscriptionId + ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", serializer }; - -const createOperationSpec: msRest.OperationSpec = { +const createOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}", httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.storageSyncServiceName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.StorageSyncServiceCreateParameters, - required: true - } - }, responses: { 200: { bodyMapper: Mappers.StorageSyncService }, + 201: { + bodyMapper: Mappers.StorageSyncService + }, + 202: { + bodyMapper: Mappers.StorageSyncService + }, + 204: { + bodyMapper: Mappers.StorageSyncService + }, default: { bodyMapper: Mappers.StorageSyncError } }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}", + requestBody: Parameters.parameters1, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.storageSyncServiceName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.StorageSyncService, @@ -331,60 +517,67 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.StorageSyncError } }, - serializer -}; - -const updateOperationSpec: msRest.OperationSpec = { - httpMethod: "PATCH", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.storageSyncServiceName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: [ - "options", - "parameters" - ], - mapper: Mappers.StorageSyncServiceUpdateParameters - }, + headerParameters: [Parameters.accept], + serializer +}; +const updateOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}", + httpMethod: "PATCH", responses: { 200: { bodyMapper: Mappers.StorageSyncService, headersMapper: Mappers.StorageSyncServicesUpdateHeaders }, + 201: { + bodyMapper: Mappers.StorageSyncService, + headersMapper: Mappers.StorageSyncServicesUpdateHeaders + }, + 202: { + bodyMapper: Mappers.StorageSyncService, + headersMapper: Mappers.StorageSyncServicesUpdateHeaders + }, + 204: { + bodyMapper: Mappers.StorageSyncService, + headersMapper: Mappers.StorageSyncServicesUpdateHeaders + }, default: { bodyMapper: Mappers.StorageSyncError } }, - serializer -}; - -const deleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}", + requestBody: Parameters.parameters2, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.storageSyncServiceName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}", + httpMethod: "DELETE", responses: { 200: { headersMapper: Mappers.StorageSyncServicesDeleteHeaders }, + 201: { + headersMapper: Mappers.StorageSyncServicesDeleteHeaders + }, + 202: { + headersMapper: Mappers.StorageSyncServicesDeleteHeaders + }, 204: { headersMapper: Mappers.StorageSyncServicesDeleteHeaders }, @@ -392,22 +585,20 @@ const deleteMethodOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.StorageSyncError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageSyncServiceName + ], + headerParameters: [Parameters.accept], serializer }; - -const listByResourceGroupOperationSpec: msRest.OperationSpec = { +const listByResourceGroupOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.StorageSyncServiceArray, @@ -417,21 +608,19 @@ const listByResourceGroupOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.StorageSyncError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName + ], + headerParameters: [Parameters.accept], serializer }; - -const listBySubscriptionOperationSpec: msRest.OperationSpec = { +const listBySubscriptionOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/storageSyncServices", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/providers/Microsoft.StorageSync/storageSyncServices", - urlParameters: [ - Parameters.subscriptionId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.StorageSyncServiceArray, @@ -441,5 +630,8 @@ const listBySubscriptionOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.StorageSyncError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [Parameters.$host, Parameters.subscriptionId], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/storagesync/arm-storagesync/src/operations/syncGroups.ts b/sdk/storagesync/arm-storagesync/src/operations/syncGroups.ts index b8af33870b6..b620204682f 100644 --- a/sdk/storagesync/arm-storagesync/src/operations/syncGroups.ts +++ b/sdk/storagesync/arm-storagesync/src/operations/syncGroups.ts @@ -1,28 +1,40 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/syncGroupsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { SyncGroups } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { StorageSyncManagementClientContext } from "../storageSyncManagementClientContext"; +import { MicrosoftStorageSync } from "../microsoftStorageSync"; +import { + SyncGroup, + SyncGroupsListByStorageSyncServiceOptionalParams, + SyncGroupsListByStorageSyncServiceResponse, + SyncGroupCreateParameters, + SyncGroupsCreateOptionalParams, + SyncGroupsCreateResponse, + SyncGroupsGetOptionalParams, + SyncGroupsGetResponse, + SyncGroupsDeleteOptionalParams, + SyncGroupsDeleteResponse +} from "../models"; -/** Class representing a SyncGroups. */ -export class SyncGroups { - private readonly client: StorageSyncManagementClientContext; +/// +/** Class containing SyncGroups operations. */ +export class SyncGroupsImpl implements SyncGroups { + private readonly client: MicrosoftStorageSync; /** - * Create a SyncGroups. - * @param {StorageSyncManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class SyncGroups class. + * @param client Reference to the service client */ - constructor(client: StorageSyncManagementClientContext) { + constructor(client: MicrosoftStorageSync) { this.client = client; } @@ -30,32 +42,77 @@ export class SyncGroups { * Get a SyncGroup List. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param callback The callback - */ - listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param options The optional parameters - * @param callback The callback - */ - listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - storageSyncServiceName, - options + public listByStorageSyncService( + resourceGroupName: string, + storageSyncServiceName: string, + options?: SyncGroupsListByStorageSyncServiceOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByStorageSyncServicePagingAll( + resourceGroupName, + storageSyncServiceName, + options + ); + return { + next() { + return iter.next(); }, - listByStorageSyncServiceOperationSpec, - callback) as Promise; + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByStorageSyncServicePagingPage( + resourceGroupName, + storageSyncServiceName, + options + ); + } + }; + } + + private async *listByStorageSyncServicePagingPage( + resourceGroupName: string, + storageSyncServiceName: string, + options?: SyncGroupsListByStorageSyncServiceOptionalParams + ): AsyncIterableIterator { + let result = await this._listByStorageSyncService( + resourceGroupName, + storageSyncServiceName, + options + ); + yield result.value || []; + } + + private async *listByStorageSyncServicePagingAll( + resourceGroupName: string, + storageSyncServiceName: string, + options?: SyncGroupsListByStorageSyncServiceOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByStorageSyncServicePagingPage( + resourceGroupName, + storageSyncServiceName, + options + )) { + yield* page; + } + } + + /** + * Get a SyncGroup List. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param options The options parameters. + */ + private _listByStorageSyncService( + resourceGroupName: string, + storageSyncServiceName: string, + options?: SyncGroupsListByStorageSyncServiceOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageSyncServiceName, options }, + listByStorageSyncServiceOperationSpec + ); } /** @@ -64,28 +121,15 @@ export class SyncGroups { * @param storageSyncServiceName Name of Storage Sync Service resource. * @param syncGroupName Name of Sync Group resource. * @param parameters Sync Group Body - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, parameters: Models.SyncGroupCreateParameters, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param parameters Sync Group Body - * @param callback The callback - */ - create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, parameters: Models.SyncGroupCreateParameters, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param parameters Sync Group Body - * @param options The optional parameters - * @param callback The callback - */ - create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, parameters: Models.SyncGroupCreateParameters, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - create(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, parameters: Models.SyncGroupCreateParameters, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + create( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + parameters: SyncGroupCreateParameters, + options?: SyncGroupsCreateOptionalParams + ): Promise { return this.client.sendOperationRequest( { resourceGroupName, @@ -94,8 +138,8 @@ export class SyncGroups { parameters, options }, - createOperationSpec, - callback) as Promise; + createOperationSpec + ); } /** @@ -103,35 +147,18 @@ export class SyncGroups { * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param storageSyncServiceName Name of Storage Sync Service resource. * @param syncGroupName Name of Sync Group resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param callback The callback - */ - get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + options?: SyncGroupsGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - storageSyncServiceName, - syncGroupName, - options - }, - getOperationSpec, - callback) as Promise; + { resourceGroupName, storageSyncServiceName, syncGroupName, options }, + getOperationSpec + ); } /** @@ -139,54 +166,27 @@ export class SyncGroups { * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param storageSyncServiceName Name of Storage Sync Service resource. * @param syncGroupName Name of Sync Group resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - deleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param callback The callback - */ - deleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param syncGroupName Name of Sync Group resource. - * @param options The optional parameters - * @param callback The callback - */ - deleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - deleteMethod(resourceGroupName: string, storageSyncServiceName: string, syncGroupName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + delete( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + options?: SyncGroupsDeleteOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - storageSyncServiceName, - syncGroupName, - options - }, - deleteMethodOperationSpec, - callback) as Promise; + { resourceGroupName, storageSyncServiceName, syncGroupName, options }, + deleteOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listByStorageSyncServiceOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByStorageSyncServiceOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.storageSyncServiceName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.SyncGroupArray, @@ -196,31 +196,20 @@ const listByStorageSyncServiceOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.StorageSyncError } }, - serializer -}; - -const createOperationSpec: msRest.OperationSpec = { - httpMethod: "PUT", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.storageSyncServiceName, - Parameters.syncGroupName + Parameters.storageSyncServiceName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], - requestBody: { - parameterPath: "parameters", - mapper: { - ...Mappers.SyncGroupCreateParameters, - required: true - } - }, + headerParameters: [Parameters.accept], + serializer +}; +const createOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}", + httpMethod: "PUT", responses: { 200: { bodyMapper: Mappers.SyncGroup, @@ -230,24 +219,23 @@ const createOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.StorageSyncError } }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}", + requestBody: Parameters.parameters3, + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.storageSyncServiceName, Parameters.syncGroupName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept, Parameters.contentType], + mediaType: "json", + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.SyncGroup, @@ -257,34 +245,38 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.StorageSyncError } }, - serializer -}; - -const deleteMethodOperationSpec: msRest.OperationSpec = { - httpMethod: "DELETE", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.storageSyncServiceName, Parameters.syncGroupName ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept], + serializer +}; +const deleteOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}", + httpMethod: "DELETE", responses: { 200: { headersMapper: Mappers.SyncGroupsDeleteHeaders }, - 204: { - headersMapper: Mappers.SyncGroupsDeleteHeaders - }, + 204: {}, default: { bodyMapper: Mappers.StorageSyncError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageSyncServiceName, + Parameters.syncGroupName + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/storagesync/arm-storagesync/src/operations/workflows.ts b/sdk/storagesync/arm-storagesync/src/operations/workflows.ts index a2b8c6bbfe2..deccf111042 100644 --- a/sdk/storagesync/arm-storagesync/src/operations/workflows.ts +++ b/sdk/storagesync/arm-storagesync/src/operations/workflows.ts @@ -1,28 +1,37 @@ /* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. * * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. */ -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "../models"; -import * as Mappers from "../models/workflowsMappers"; +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { Workflows } from "../operationsInterfaces"; +import * as coreClient from "@azure/core-client"; +import * as Mappers from "../models/mappers"; import * as Parameters from "../models/parameters"; -import { StorageSyncManagementClientContext } from "../storageSyncManagementClientContext"; +import { MicrosoftStorageSync } from "../microsoftStorageSync"; +import { + Workflow, + WorkflowsListByStorageSyncServiceOptionalParams, + WorkflowsListByStorageSyncServiceResponse, + WorkflowsGetOptionalParams, + WorkflowsGetResponse, + WorkflowsAbortOptionalParams, + WorkflowsAbortResponse +} from "../models"; -/** Class representing a Workflows. */ -export class Workflows { - private readonly client: StorageSyncManagementClientContext; +/// +/** Class containing Workflows operations. */ +export class WorkflowsImpl implements Workflows { + private readonly client: MicrosoftStorageSync; /** - * Create a Workflows. - * @param {StorageSyncManagementClientContext} client Reference to the service client. + * Initialize a new instance of the class Workflows class. + * @param client Reference to the service client */ - constructor(client: StorageSyncManagementClientContext) { + constructor(client: MicrosoftStorageSync) { this.client = client; } @@ -30,32 +39,77 @@ export class Workflows { * Get a Workflow List * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param callback The callback - */ - listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param options The optional parameters - * @param callback The callback - */ - listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - listByStorageSyncService(resourceGroupName: string, storageSyncServiceName: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { - return this.client.sendOperationRequest( - { - resourceGroupName, - storageSyncServiceName, - options + public listByStorageSyncService( + resourceGroupName: string, + storageSyncServiceName: string, + options?: WorkflowsListByStorageSyncServiceOptionalParams + ): PagedAsyncIterableIterator { + const iter = this.listByStorageSyncServicePagingAll( + resourceGroupName, + storageSyncServiceName, + options + ); + return { + next() { + return iter.next(); }, - listByStorageSyncServiceOperationSpec, - callback) as Promise; + [Symbol.asyncIterator]() { + return this; + }, + byPage: () => { + return this.listByStorageSyncServicePagingPage( + resourceGroupName, + storageSyncServiceName, + options + ); + } + }; + } + + private async *listByStorageSyncServicePagingPage( + resourceGroupName: string, + storageSyncServiceName: string, + options?: WorkflowsListByStorageSyncServiceOptionalParams + ): AsyncIterableIterator { + let result = await this._listByStorageSyncService( + resourceGroupName, + storageSyncServiceName, + options + ); + yield result.value || []; + } + + private async *listByStorageSyncServicePagingAll( + resourceGroupName: string, + storageSyncServiceName: string, + options?: WorkflowsListByStorageSyncServiceOptionalParams + ): AsyncIterableIterator { + for await (const page of this.listByStorageSyncServicePagingPage( + resourceGroupName, + storageSyncServiceName, + options + )) { + yield* page; + } + } + + /** + * Get a Workflow List + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param options The options parameters. + */ + private _listByStorageSyncService( + resourceGroupName: string, + storageSyncServiceName: string, + options?: WorkflowsListByStorageSyncServiceOptionalParams + ): Promise { + return this.client.sendOperationRequest( + { resourceGroupName, storageSyncServiceName, options }, + listByStorageSyncServiceOperationSpec + ); } /** @@ -63,35 +117,18 @@ export class Workflows { * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param storageSyncServiceName Name of Storage Sync Service resource. * @param workflowId workflow Id - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - get(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param workflowId workflow Id - * @param callback The callback - */ - get(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param workflowId workflow Id - * @param options The optional parameters - * @param callback The callback - */ - get(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - get(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + get( + resourceGroupName: string, + storageSyncServiceName: string, + workflowId: string, + options?: WorkflowsGetOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - storageSyncServiceName, - workflowId, - options - }, - getOperationSpec, - callback) as Promise; + { resourceGroupName, storageSyncServiceName, workflowId, options }, + getOperationSpec + ); } /** @@ -99,54 +136,27 @@ export class Workflows { * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param storageSyncServiceName Name of Storage Sync Service resource. * @param workflowId workflow Id - * @param [options] The optional parameters - * @returns Promise + * @param options The options parameters. */ - abort(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options?: msRest.RequestOptionsBase): Promise; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param workflowId workflow Id - * @param callback The callback - */ - abort(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, callback: msRest.ServiceCallback): void; - /** - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param storageSyncServiceName Name of Storage Sync Service resource. - * @param workflowId workflow Id - * @param options The optional parameters - * @param callback The callback - */ - abort(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback): void; - abort(resourceGroupName: string, storageSyncServiceName: string, workflowId: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback, callback?: msRest.ServiceCallback): Promise { + abort( + resourceGroupName: string, + storageSyncServiceName: string, + workflowId: string, + options?: WorkflowsAbortOptionalParams + ): Promise { return this.client.sendOperationRequest( - { - resourceGroupName, - storageSyncServiceName, - workflowId, - options - }, - abortOperationSpec, - callback) as Promise; + { resourceGroupName, storageSyncServiceName, workflowId, options }, + abortOperationSpec + ); } } - // Operation Specifications -const serializer = new msRest.Serializer(Mappers); -const listByStorageSyncServiceOperationSpec: msRest.OperationSpec = { +const serializer = coreClient.createSerializer(Mappers, /* isXml */ false); + +const listByStorageSyncServiceOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows", httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows", - urlParameters: [ - Parameters.subscriptionId, - Parameters.resourceGroupName, - Parameters.storageSyncServiceName - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], responses: { 200: { bodyMapper: Mappers.WorkflowArray, @@ -156,24 +166,20 @@ const listByStorageSyncServiceOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.StorageSyncError } }, - serializer -}; - -const getOperationSpec: msRest.OperationSpec = { - httpMethod: "GET", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, - Parameters.storageSyncServiceName, - Parameters.workflowId - ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage + Parameters.storageSyncServiceName ], + headerParameters: [Parameters.accept], + serializer +}; +const getOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}", + httpMethod: "GET", responses: { 200: { bodyMapper: Mappers.Workflow, @@ -183,24 +189,21 @@ const getOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.StorageSyncError } }, - serializer -}; - -const abortOperationSpec: msRest.OperationSpec = { - httpMethod: "POST", - path: "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}/abort", + queryParameters: [Parameters.apiVersion], urlParameters: [ + Parameters.$host, Parameters.subscriptionId, Parameters.resourceGroupName, Parameters.storageSyncServiceName, Parameters.workflowId ], - queryParameters: [ - Parameters.apiVersion - ], - headerParameters: [ - Parameters.acceptLanguage - ], + headerParameters: [Parameters.accept], + serializer +}; +const abortOperationSpec: coreClient.OperationSpec = { + path: + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/workflows/{workflowId}/abort", + httpMethod: "POST", responses: { 200: { headersMapper: Mappers.WorkflowsAbortHeaders @@ -209,5 +212,14 @@ const abortOperationSpec: msRest.OperationSpec = { bodyMapper: Mappers.StorageSyncError } }, + queryParameters: [Parameters.apiVersion], + urlParameters: [ + Parameters.$host, + Parameters.subscriptionId, + Parameters.resourceGroupName, + Parameters.storageSyncServiceName, + Parameters.workflowId + ], + headerParameters: [Parameters.accept], serializer }; diff --git a/sdk/storagesync/arm-storagesync/src/operationsInterfaces/cloudEndpoints.ts b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/cloudEndpoints.ts new file mode 100644 index 00000000000..aee04df08ce --- /dev/null +++ b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/cloudEndpoints.ts @@ -0,0 +1,338 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + CloudEndpoint, + CloudEndpointsListBySyncGroupOptionalParams, + CloudEndpointCreateParameters, + CloudEndpointsCreateOptionalParams, + CloudEndpointsCreateResponse, + CloudEndpointsGetOptionalParams, + CloudEndpointsGetResponse, + CloudEndpointsDeleteOptionalParams, + CloudEndpointsDeleteResponse, + BackupRequest, + CloudEndpointsPreBackupOptionalParams, + CloudEndpointsPreBackupResponse, + CloudEndpointsPostBackupOptionalParams, + CloudEndpointsPostBackupResponse, + PreRestoreRequest, + CloudEndpointsPreRestoreOptionalParams, + CloudEndpointsRestoreheartbeatOptionalParams, + CloudEndpointsRestoreheartbeatResponse, + PostRestoreRequest, + CloudEndpointsPostRestoreOptionalParams, + TriggerChangeDetectionParameters, + CloudEndpointsTriggerChangeDetectionOptionalParams +} from "../models"; + +/// +/** Interface representing a CloudEndpoints. */ +export interface CloudEndpoints { + /** + * Get a CloudEndpoint List. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param options The options parameters. + */ + listBySyncGroup( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + options?: CloudEndpointsListBySyncGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Create a new CloudEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param parameters Body of Cloud Endpoint resource. + * @param options The options parameters. + */ + beginCreate( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: CloudEndpointCreateParameters, + options?: CloudEndpointsCreateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + CloudEndpointsCreateResponse + > + >; + /** + * Create a new CloudEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param parameters Body of Cloud Endpoint resource. + * @param options The options parameters. + */ + beginCreateAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: CloudEndpointCreateParameters, + options?: CloudEndpointsCreateOptionalParams + ): Promise; + /** + * Get a given CloudEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + options?: CloudEndpointsGetOptionalParams + ): Promise; + /** + * Delete a given CloudEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + options?: CloudEndpointsDeleteOptionalParams + ): Promise< + PollerLike< + PollOperationState, + CloudEndpointsDeleteResponse + > + >; + /** + * Delete a given CloudEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + options?: CloudEndpointsDeleteOptionalParams + ): Promise; + /** + * Pre Backup a given CloudEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param parameters Body of Backup request. + * @param options The options parameters. + */ + beginPreBackup( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: BackupRequest, + options?: CloudEndpointsPreBackupOptionalParams + ): Promise< + PollerLike< + PollOperationState, + CloudEndpointsPreBackupResponse + > + >; + /** + * Pre Backup a given CloudEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param parameters Body of Backup request. + * @param options The options parameters. + */ + beginPreBackupAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: BackupRequest, + options?: CloudEndpointsPreBackupOptionalParams + ): Promise; + /** + * Post Backup a given CloudEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param parameters Body of Backup request. + * @param options The options parameters. + */ + beginPostBackup( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: BackupRequest, + options?: CloudEndpointsPostBackupOptionalParams + ): Promise< + PollerLike< + PollOperationState, + CloudEndpointsPostBackupResponse + > + >; + /** + * Post Backup a given CloudEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param parameters Body of Backup request. + * @param options The options parameters. + */ + beginPostBackupAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: BackupRequest, + options?: CloudEndpointsPostBackupOptionalParams + ): Promise; + /** + * Pre Restore a given CloudEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param parameters Body of Cloud Endpoint object. + * @param options The options parameters. + */ + beginPreRestore( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: PreRestoreRequest, + options?: CloudEndpointsPreRestoreOptionalParams + ): Promise, void>>; + /** + * Pre Restore a given CloudEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param parameters Body of Cloud Endpoint object. + * @param options The options parameters. + */ + beginPreRestoreAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: PreRestoreRequest, + options?: CloudEndpointsPreRestoreOptionalParams + ): Promise; + /** + * Restore Heartbeat a given CloudEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param options The options parameters. + */ + restoreheartbeat( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + options?: CloudEndpointsRestoreheartbeatOptionalParams + ): Promise; + /** + * Post Restore a given CloudEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param parameters Body of Cloud Endpoint object. + * @param options The options parameters. + */ + beginPostRestore( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: PostRestoreRequest, + options?: CloudEndpointsPostRestoreOptionalParams + ): Promise, void>>; + /** + * Post Restore a given CloudEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param parameters Body of Cloud Endpoint object. + * @param options The options parameters. + */ + beginPostRestoreAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: PostRestoreRequest, + options?: CloudEndpointsPostRestoreOptionalParams + ): Promise; + /** + * Triggers detection of changes performed on Azure File share connected to the specified Azure File + * Sync Cloud Endpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param parameters Trigger Change Detection Action parameters. + * @param options The options parameters. + */ + beginTriggerChangeDetection( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: TriggerChangeDetectionParameters, + options?: CloudEndpointsTriggerChangeDetectionOptionalParams + ): Promise, void>>; + /** + * Triggers detection of changes performed on Azure File share connected to the specified Azure File + * Sync Cloud Endpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param cloudEndpointName Name of Cloud Endpoint object. + * @param parameters Trigger Change Detection Action parameters. + * @param options The options parameters. + */ + beginTriggerChangeDetectionAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + cloudEndpointName: string, + parameters: TriggerChangeDetectionParameters, + options?: CloudEndpointsTriggerChangeDetectionOptionalParams + ): Promise; +} diff --git a/sdk/storagesync/arm-storagesync/src/operationsInterfaces/index.ts b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/index.ts new file mode 100644 index 00000000000..d191ca1962b --- /dev/null +++ b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/index.ts @@ -0,0 +1,18 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +export * from "./operations"; +export * from "./storageSyncServices"; +export * from "./privateLinkResources"; +export * from "./privateEndpointConnections"; +export * from "./syncGroups"; +export * from "./cloudEndpoints"; +export * from "./serverEndpoints"; +export * from "./registeredServers"; +export * from "./workflows"; +export * from "./operationStatusOperations"; diff --git a/sdk/storagesync/arm-storagesync/src/operationsInterfaces/operationStatusOperations.ts b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/operationStatusOperations.ts new file mode 100644 index 00000000000..8dafd353652 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/operationStatusOperations.ts @@ -0,0 +1,31 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + OperationStatusGetOptionalParams, + OperationStatusGetResponse +} from "../models"; + +/** Interface representing a OperationStatusOperations. */ +export interface OperationStatusOperations { + /** + * Get Operation status + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param locationName The desired region to obtain information from. + * @param workflowId workflow Id + * @param operationId operation Id + * @param options The options parameters. + */ + get( + resourceGroupName: string, + locationName: string, + workflowId: string, + operationId: string, + options?: OperationStatusGetOptionalParams + ): Promise; +} diff --git a/sdk/storagesync/arm-storagesync/src/operationsInterfaces/operations.ts b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/operations.ts new file mode 100644 index 00000000000..144c7342d24 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/operations.ts @@ -0,0 +1,22 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { OperationEntity, OperationsListOptionalParams } from "../models"; + +/// +/** Interface representing a Operations. */ +export interface Operations { + /** + * Lists all of the available Storage Sync Rest API operations. + * @param options The options parameters. + */ + list( + options?: OperationsListOptionalParams + ): PagedAsyncIterableIterator; +} diff --git a/sdk/storagesync/arm-storagesync/src/operationsInterfaces/privateEndpointConnections.ts b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/privateEndpointConnections.ts new file mode 100644 index 00000000000..d2e446e0aa5 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/privateEndpointConnections.ts @@ -0,0 +1,119 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + PrivateEndpointConnection, + PrivateEndpointConnectionsListByStorageSyncServiceOptionalParams, + PrivateEndpointConnectionsGetOptionalParams, + PrivateEndpointConnectionsGetResponse, + PrivateEndpointConnectionsCreateOptionalParams, + PrivateEndpointConnectionsCreateResponse, + PrivateEndpointConnectionsDeleteOptionalParams +} from "../models"; + +/// +/** Interface representing a PrivateEndpointConnections. */ +export interface PrivateEndpointConnections { + /** + * Get a PrivateEndpointConnection List. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param options The options parameters. + */ + listByStorageSyncService( + resourceGroupName: string, + storageSyncServiceName: string, + options?: PrivateEndpointConnectionsListByStorageSyncServiceOptionalParams + ): PagedAsyncIterableIterator; + /** + * Gets the specified private endpoint connection associated with the storage sync service. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName The name of the storage sync service name within the specified + * resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the + * Azure resource + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageSyncServiceName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsGetOptionalParams + ): Promise; + /** + * Update the state of specified private endpoint connection associated with the storage sync service. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName The name of the storage sync service name within the specified + * resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the + * Azure resource + * @param properties The private endpoint connection properties. + * @param options The options parameters. + */ + beginCreate( + resourceGroupName: string, + storageSyncServiceName: string, + privateEndpointConnectionName: string, + properties: PrivateEndpointConnection, + options?: PrivateEndpointConnectionsCreateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + PrivateEndpointConnectionsCreateResponse + > + >; + /** + * Update the state of specified private endpoint connection associated with the storage sync service. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName The name of the storage sync service name within the specified + * resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the + * Azure resource + * @param properties The private endpoint connection properties. + * @param options The options parameters. + */ + beginCreateAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + privateEndpointConnectionName: string, + properties: PrivateEndpointConnection, + options?: PrivateEndpointConnectionsCreateOptionalParams + ): Promise; + /** + * Deletes the specified private endpoint connection associated with the storage sync service. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName The name of the storage sync service name within the specified + * resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the + * Azure resource + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + storageSyncServiceName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams + ): Promise, void>>; + /** + * Deletes the specified private endpoint connection associated with the storage sync service. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName The name of the storage sync service name within the specified + * resource group. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the + * Azure resource + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + privateEndpointConnectionName: string, + options?: PrivateEndpointConnectionsDeleteOptionalParams + ): Promise; +} diff --git a/sdk/storagesync/arm-storagesync/src/operationsInterfaces/privateLinkResources.ts b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/privateLinkResources.ts new file mode 100644 index 00000000000..00dc1b04bfb --- /dev/null +++ b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/privateLinkResources.ts @@ -0,0 +1,28 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + PrivateLinkResourcesListByStorageSyncServiceOptionalParams, + PrivateLinkResourcesListByStorageSyncServiceResponse +} from "../models"; + +/** Interface representing a PrivateLinkResources. */ +export interface PrivateLinkResources { + /** + * Gets the private link resources that need to be created for a storage sync service. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName The name of the storage sync service name within the specified + * resource group. + * @param options The options parameters. + */ + listByStorageSyncService( + resourceGroupName: string, + storageSyncServiceName: string, + options?: PrivateLinkResourcesListByStorageSyncServiceOptionalParams + ): Promise; +} diff --git a/sdk/storagesync/arm-storagesync/src/operationsInterfaces/registeredServers.ts b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/registeredServers.ts new file mode 100644 index 00000000000..f3d622f64b6 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/registeredServers.ts @@ -0,0 +1,154 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + RegisteredServer, + RegisteredServersListByStorageSyncServiceOptionalParams, + RegisteredServersGetOptionalParams, + RegisteredServersGetResponse, + RegisteredServerCreateParameters, + RegisteredServersCreateOptionalParams, + RegisteredServersCreateResponse, + RegisteredServersDeleteOptionalParams, + RegisteredServersDeleteResponse, + TriggerRolloverRequest, + RegisteredServersTriggerRolloverOptionalParams, + RegisteredServersTriggerRolloverResponse +} from "../models"; + +/// +/** Interface representing a RegisteredServers. */ +export interface RegisteredServers { + /** + * Get a given registered server list. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param options The options parameters. + */ + listByStorageSyncService( + resourceGroupName: string, + storageSyncServiceName: string, + options?: RegisteredServersListByStorageSyncServiceOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a given registered server. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param serverId GUID identifying the on-premises server. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageSyncServiceName: string, + serverId: string, + options?: RegisteredServersGetOptionalParams + ): Promise; + /** + * Add a new registered server. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param serverId GUID identifying the on-premises server. + * @param parameters Body of Registered Server object. + * @param options The options parameters. + */ + beginCreate( + resourceGroupName: string, + storageSyncServiceName: string, + serverId: string, + parameters: RegisteredServerCreateParameters, + options?: RegisteredServersCreateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + RegisteredServersCreateResponse + > + >; + /** + * Add a new registered server. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param serverId GUID identifying the on-premises server. + * @param parameters Body of Registered Server object. + * @param options The options parameters. + */ + beginCreateAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + serverId: string, + parameters: RegisteredServerCreateParameters, + options?: RegisteredServersCreateOptionalParams + ): Promise; + /** + * Delete the given registered server. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param serverId GUID identifying the on-premises server. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + storageSyncServiceName: string, + serverId: string, + options?: RegisteredServersDeleteOptionalParams + ): Promise< + PollerLike< + PollOperationState, + RegisteredServersDeleteResponse + > + >; + /** + * Delete the given registered server. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param serverId GUID identifying the on-premises server. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + serverId: string, + options?: RegisteredServersDeleteOptionalParams + ): Promise; + /** + * Triggers Server certificate rollover. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param serverId Server Id + * @param parameters Body of Trigger Rollover request. + * @param options The options parameters. + */ + beginTriggerRollover( + resourceGroupName: string, + storageSyncServiceName: string, + serverId: string, + parameters: TriggerRolloverRequest, + options?: RegisteredServersTriggerRolloverOptionalParams + ): Promise< + PollerLike< + PollOperationState, + RegisteredServersTriggerRolloverResponse + > + >; + /** + * Triggers Server certificate rollover. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param serverId Server Id + * @param parameters Body of Trigger Rollover request. + * @param options The options parameters. + */ + beginTriggerRolloverAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + serverId: string, + parameters: TriggerRolloverRequest, + options?: RegisteredServersTriggerRolloverOptionalParams + ): Promise; +} diff --git a/sdk/storagesync/arm-storagesync/src/operationsInterfaces/serverEndpoints.ts b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/serverEndpoints.ts new file mode 100644 index 00000000000..10ce98ffc81 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/serverEndpoints.ts @@ -0,0 +1,207 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + ServerEndpoint, + ServerEndpointsListBySyncGroupOptionalParams, + ServerEndpointCreateParameters, + ServerEndpointsCreateOptionalParams, + ServerEndpointsCreateResponse, + ServerEndpointsUpdateOptionalParams, + ServerEndpointsUpdateResponse, + ServerEndpointsGetOptionalParams, + ServerEndpointsGetResponse, + ServerEndpointsDeleteOptionalParams, + ServerEndpointsDeleteResponse, + RecallActionParameters, + ServerEndpointsRecallActionOptionalParams, + ServerEndpointsRecallActionResponse +} from "../models"; + +/// +/** Interface representing a ServerEndpoints. */ +export interface ServerEndpoints { + /** + * Get a ServerEndpoint list. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param options The options parameters. + */ + listBySyncGroup( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + options?: ServerEndpointsListBySyncGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Create a new ServerEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param serverEndpointName Name of Server Endpoint object. + * @param parameters Body of Server Endpoint object. + * @param options The options parameters. + */ + beginCreate( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + serverEndpointName: string, + parameters: ServerEndpointCreateParameters, + options?: ServerEndpointsCreateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ServerEndpointsCreateResponse + > + >; + /** + * Create a new ServerEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param serverEndpointName Name of Server Endpoint object. + * @param parameters Body of Server Endpoint object. + * @param options The options parameters. + */ + beginCreateAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + serverEndpointName: string, + parameters: ServerEndpointCreateParameters, + options?: ServerEndpointsCreateOptionalParams + ): Promise; + /** + * Patch a given ServerEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param serverEndpointName Name of Server Endpoint object. + * @param options The options parameters. + */ + beginUpdate( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + serverEndpointName: string, + options?: ServerEndpointsUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ServerEndpointsUpdateResponse + > + >; + /** + * Patch a given ServerEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param serverEndpointName Name of Server Endpoint object. + * @param options The options parameters. + */ + beginUpdateAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + serverEndpointName: string, + options?: ServerEndpointsUpdateOptionalParams + ): Promise; + /** + * Get a ServerEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param serverEndpointName Name of Server Endpoint object. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + serverEndpointName: string, + options?: ServerEndpointsGetOptionalParams + ): Promise; + /** + * Delete a given ServerEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param serverEndpointName Name of Server Endpoint object. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + serverEndpointName: string, + options?: ServerEndpointsDeleteOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ServerEndpointsDeleteResponse + > + >; + /** + * Delete a given ServerEndpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param serverEndpointName Name of Server Endpoint object. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + serverEndpointName: string, + options?: ServerEndpointsDeleteOptionalParams + ): Promise; + /** + * Recall a server endpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param serverEndpointName Name of Server Endpoint object. + * @param parameters Body of Recall Action object. + * @param options The options parameters. + */ + beginRecallAction( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + serverEndpointName: string, + parameters: RecallActionParameters, + options?: ServerEndpointsRecallActionOptionalParams + ): Promise< + PollerLike< + PollOperationState, + ServerEndpointsRecallActionResponse + > + >; + /** + * Recall a server endpoint. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param serverEndpointName Name of Server Endpoint object. + * @param parameters Body of Recall Action object. + * @param options The options parameters. + */ + beginRecallActionAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + serverEndpointName: string, + parameters: RecallActionParameters, + options?: ServerEndpointsRecallActionOptionalParams + ): Promise; +} diff --git a/sdk/storagesync/arm-storagesync/src/operationsInterfaces/storageSyncServices.ts b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/storageSyncServices.ts new file mode 100644 index 00000000000..5c34dd282e7 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/storageSyncServices.ts @@ -0,0 +1,155 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { PollerLike, PollOperationState } from "@azure/core-lro"; +import { + StorageSyncService, + StorageSyncServicesListByResourceGroupOptionalParams, + StorageSyncServicesListBySubscriptionOptionalParams, + CheckNameAvailabilityParameters, + StorageSyncServicesCheckNameAvailabilityOptionalParams, + StorageSyncServicesCheckNameAvailabilityResponse, + StorageSyncServiceCreateParameters, + StorageSyncServicesCreateOptionalParams, + StorageSyncServicesCreateResponse, + StorageSyncServicesGetOptionalParams, + StorageSyncServicesGetResponse, + StorageSyncServicesUpdateOptionalParams, + StorageSyncServicesUpdateResponse, + StorageSyncServicesDeleteOptionalParams, + StorageSyncServicesDeleteResponse +} from "../models"; + +/// +/** Interface representing a StorageSyncServices. */ +export interface StorageSyncServices { + /** + * Get a StorageSyncService list by Resource group name. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param options The options parameters. + */ + listByResourceGroup( + resourceGroupName: string, + options?: StorageSyncServicesListByResourceGroupOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get a StorageSyncService list by subscription. + * @param options The options parameters. + */ + listBySubscription( + options?: StorageSyncServicesListBySubscriptionOptionalParams + ): PagedAsyncIterableIterator; + /** + * Check the give namespace name availability. + * @param locationName The desired region for the name check. + * @param parameters Parameters to check availability of the given namespace name + * @param options The options parameters. + */ + checkNameAvailability( + locationName: string, + parameters: CheckNameAvailabilityParameters, + options?: StorageSyncServicesCheckNameAvailabilityOptionalParams + ): Promise; + /** + * Create a new StorageSyncService. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param parameters Storage Sync Service resource name. + * @param options The options parameters. + */ + beginCreate( + resourceGroupName: string, + storageSyncServiceName: string, + parameters: StorageSyncServiceCreateParameters, + options?: StorageSyncServicesCreateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + StorageSyncServicesCreateResponse + > + >; + /** + * Create a new StorageSyncService. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param parameters Storage Sync Service resource name. + * @param options The options parameters. + */ + beginCreateAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + parameters: StorageSyncServiceCreateParameters, + options?: StorageSyncServicesCreateOptionalParams + ): Promise; + /** + * Get a given StorageSyncService. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageSyncServiceName: string, + options?: StorageSyncServicesGetOptionalParams + ): Promise; + /** + * Patch a given StorageSyncService. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param options The options parameters. + */ + beginUpdate( + resourceGroupName: string, + storageSyncServiceName: string, + options?: StorageSyncServicesUpdateOptionalParams + ): Promise< + PollerLike< + PollOperationState, + StorageSyncServicesUpdateResponse + > + >; + /** + * Patch a given StorageSyncService. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param options The options parameters. + */ + beginUpdateAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + options?: StorageSyncServicesUpdateOptionalParams + ): Promise; + /** + * Delete a given StorageSyncService. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param options The options parameters. + */ + beginDelete( + resourceGroupName: string, + storageSyncServiceName: string, + options?: StorageSyncServicesDeleteOptionalParams + ): Promise< + PollerLike< + PollOperationState, + StorageSyncServicesDeleteResponse + > + >; + /** + * Delete a given StorageSyncService. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param options The options parameters. + */ + beginDeleteAndWait( + resourceGroupName: string, + storageSyncServiceName: string, + options?: StorageSyncServicesDeleteOptionalParams + ): Promise; +} diff --git a/sdk/storagesync/arm-storagesync/src/operationsInterfaces/syncGroups.ts b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/syncGroups.ts new file mode 100644 index 00000000000..b4af1f41272 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/syncGroups.ts @@ -0,0 +1,77 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + SyncGroup, + SyncGroupsListByStorageSyncServiceOptionalParams, + SyncGroupCreateParameters, + SyncGroupsCreateOptionalParams, + SyncGroupsCreateResponse, + SyncGroupsGetOptionalParams, + SyncGroupsGetResponse, + SyncGroupsDeleteOptionalParams, + SyncGroupsDeleteResponse +} from "../models"; + +/// +/** Interface representing a SyncGroups. */ +export interface SyncGroups { + /** + * Get a SyncGroup List. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param options The options parameters. + */ + listByStorageSyncService( + resourceGroupName: string, + storageSyncServiceName: string, + options?: SyncGroupsListByStorageSyncServiceOptionalParams + ): PagedAsyncIterableIterator; + /** + * Create a new SyncGroup. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param parameters Sync Group Body + * @param options The options parameters. + */ + create( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + parameters: SyncGroupCreateParameters, + options?: SyncGroupsCreateOptionalParams + ): Promise; + /** + * Get a given SyncGroup. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + options?: SyncGroupsGetOptionalParams + ): Promise; + /** + * Delete a given SyncGroup. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param syncGroupName Name of Sync Group resource. + * @param options The options parameters. + */ + delete( + resourceGroupName: string, + storageSyncServiceName: string, + syncGroupName: string, + options?: SyncGroupsDeleteOptionalParams + ): Promise; +} diff --git a/sdk/storagesync/arm-storagesync/src/operationsInterfaces/workflows.ts b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/workflows.ts new file mode 100644 index 00000000000..b9e2b7d0fe8 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/src/operationsInterfaces/workflows.ts @@ -0,0 +1,59 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { PagedAsyncIterableIterator } from "@azure/core-paging"; +import { + Workflow, + WorkflowsListByStorageSyncServiceOptionalParams, + WorkflowsGetOptionalParams, + WorkflowsGetResponse, + WorkflowsAbortOptionalParams, + WorkflowsAbortResponse +} from "../models"; + +/// +/** Interface representing a Workflows. */ +export interface Workflows { + /** + * Get a Workflow List + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param options The options parameters. + */ + listByStorageSyncService( + resourceGroupName: string, + storageSyncServiceName: string, + options?: WorkflowsListByStorageSyncServiceOptionalParams + ): PagedAsyncIterableIterator; + /** + * Get Workflows resource + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param workflowId workflow Id + * @param options The options parameters. + */ + get( + resourceGroupName: string, + storageSyncServiceName: string, + workflowId: string, + options?: WorkflowsGetOptionalParams + ): Promise; + /** + * Abort the given workflow. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageSyncServiceName Name of Storage Sync Service resource. + * @param workflowId workflow Id + * @param options The options parameters. + */ + abort( + resourceGroupName: string, + storageSyncServiceName: string, + workflowId: string, + options?: WorkflowsAbortOptionalParams + ): Promise; +} diff --git a/sdk/storagesync/arm-storagesync/src/storageSyncManagementClient.ts b/sdk/storagesync/arm-storagesync/src/storageSyncManagementClient.ts deleted file mode 100644 index e8507d47434..00000000000 --- a/sdk/storagesync/arm-storagesync/src/storageSyncManagementClient.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import * as msRest from "@azure/ms-rest-js"; -import * as Models from "./models"; -import * as Mappers from "./models/mappers"; -import * as operations from "./operations"; -import { StorageSyncManagementClientContext } from "./storageSyncManagementClientContext"; - - -class StorageSyncManagementClient extends StorageSyncManagementClientContext { - // Operation groups - operations: operations.Operations; - storageSyncServices: operations.StorageSyncServices; - syncGroups: operations.SyncGroups; - cloudEndpoints: operations.CloudEndpoints; - serverEndpoints: operations.ServerEndpoints; - registeredServers: operations.RegisteredServers; - workflows: operations.Workflows; - operationStatus: operations.OperationStatusOperations; - - /** - * Initializes a new instance of the StorageSyncManagementClient class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param subscriptionId The ID of the target subscription. - * @param [options] The parameter options - */ - constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.StorageSyncManagementClientOptions) { - super(credentials, subscriptionId, options); - this.operations = new operations.Operations(this); - this.storageSyncServices = new operations.StorageSyncServices(this); - this.syncGroups = new operations.SyncGroups(this); - this.cloudEndpoints = new operations.CloudEndpoints(this); - this.serverEndpoints = new operations.ServerEndpoints(this); - this.registeredServers = new operations.RegisteredServers(this); - this.workflows = new operations.Workflows(this); - this.operationStatus = new operations.OperationStatusOperations(this); - } -} - -// Operation Specifications - -export { - StorageSyncManagementClient, - StorageSyncManagementClientContext, - Models as StorageSyncManagementModels, - Mappers as StorageSyncManagementMappers -}; -export * from "./operations"; diff --git a/sdk/storagesync/arm-storagesync/src/storageSyncManagementClientContext.ts b/sdk/storagesync/arm-storagesync/src/storageSyncManagementClientContext.ts deleted file mode 100644 index ef8da155c09..00000000000 --- a/sdk/storagesync/arm-storagesync/src/storageSyncManagementClientContext.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for - * license information. - * - * Code generated by Microsoft (R) AutoRest Code Generator. - * Changes may cause incorrect behavior and will be lost if the code is - * regenerated. - */ - -import * as Models from "./models"; -import * as msRest from "@azure/ms-rest-js"; -import * as msRestAzure from "@azure/ms-rest-azure-js"; - -const packageName = "@azure/arm-storagesync"; -const packageVersion = "8.0.0"; - -export class StorageSyncManagementClientContext extends msRestAzure.AzureServiceClient { - credentials: msRest.ServiceClientCredentials; - apiVersion?: string; - subscriptionId: string; - - /** - * Initializes a new instance of the StorageSyncManagementClient class. - * @param credentials Credentials needed for the client to connect to Azure. - * @param subscriptionId The ID of the target subscription. - * @param [options] The parameter options - */ - constructor(credentials: msRest.ServiceClientCredentials, subscriptionId: string, options?: Models.StorageSyncManagementClientOptions) { - if (credentials == undefined) { - throw new Error('\'credentials\' cannot be null.'); - } - if (subscriptionId == undefined) { - throw new Error('\'subscriptionId\' cannot be null.'); - } - - if (!options) { - options = {}; - } - if(!options.userAgent) { - const defaultUserAgent = msRestAzure.getDefaultUserAgentValue(); - options.userAgent = `${packageName}/${packageVersion} ${defaultUserAgent}`; - } - - super(credentials, options); - - this.apiVersion = '2019-06-01'; - this.acceptLanguage = 'en-US'; - this.longRunningOperationRetryTimeout = 30; - this.baseUri = options.baseUri || this.baseUri || "https://management.azure.com"; - this.requestContentType = "application/json; charset=utf-8"; - this.credentials = credentials; - this.subscriptionId = subscriptionId; - - if(options.acceptLanguage !== null && options.acceptLanguage !== undefined) { - this.acceptLanguage = options.acceptLanguage; - } - if(options.longRunningOperationRetryTimeout !== null && options.longRunningOperationRetryTimeout !== undefined) { - this.longRunningOperationRetryTimeout = options.longRunningOperationRetryTimeout; - } - } -} diff --git a/sdk/storagesync/arm-storagesync/test/sampleTest.ts b/sdk/storagesync/arm-storagesync/test/sampleTest.ts new file mode 100644 index 00000000000..7ed89b043e1 --- /dev/null +++ b/sdk/storagesync/arm-storagesync/test/sampleTest.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) Microsoft Corporation. + * Licensed under the MIT License. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * Changes may cause incorrect behavior and will be lost if the code is regenerated. + */ + +import { + env, + record, + RecorderEnvironmentSetup, + Recorder +} from "@azure-tools/test-recorder"; +import * as assert from "assert"; + +const recorderEnvSetup: RecorderEnvironmentSetup = { + replaceableVariables: { + AZURE_CLIENT_ID: "azure_client_id", + AZURE_CLIENT_SECRET: "azure_client_secret", + AZURE_TENANT_ID: "88888888-8888-8888-8888-888888888888", + SUBSCRIPTION_ID: "azure_subscription_id" + }, + customizationsOnRecordings: [ + (recording: any): any => + recording.replace( + /"access_token":"[^"]*"/g, + `"access_token":"access_token"` + ) + ], + queryParametersToSkip: [] +}; + +describe("My test", () => { + let recorder: Recorder; + + beforeEach(async function() { + recorder = record(this, recorderEnvSetup); + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("sample test", async function() { + console.log("Hi, I'm a test!"); + }); +}); diff --git a/sdk/storagesync/arm-storagesync/tsconfig.json b/sdk/storagesync/arm-storagesync/tsconfig.json index 422b584abd5..1776ae4737f 100644 --- a/sdk/storagesync/arm-storagesync/tsconfig.json +++ b/sdk/storagesync/arm-storagesync/tsconfig.json @@ -3,7 +3,7 @@ "module": "es6", "moduleResolution": "node", "strict": true, - "target": "es5", + "target": "es6", "sourceMap": true, "declarationMap": true, "esModuleInterop": true, @@ -11,9 +11,10 @@ "forceConsistentCasingInFileNames": true, "lib": ["es6", "dom"], "declaration": true, - "outDir": "./esm", - "importHelpers": true + "outDir": "./dist-esm", + "importHelpers": true, + "paths": { "@azure/arm-storagesync": ["./src/index"] } }, - "include": ["./src/**/*.ts"], + "include": ["./src/**/*.ts", "./test/**/*.ts", "samples-dev/**/*.ts"], "exclude": ["node_modules"] } diff --git a/sdk/storagesync/ci.yml b/sdk/storagesync/ci.yml new file mode 100644 index 00000000000..57d1fe84895 --- /dev/null +++ b/sdk/storagesync/ci.yml @@ -0,0 +1,30 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/storagesync/ + +pr: + branches: + include: + - main + - release/* + - hotfix/* + paths: + include: + - sdk/storagesync/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: storagesync + Artifacts: + - name: azure-arm-storagesync + safeName: azurearmstoragesync + \ No newline at end of file